setting theme

merge-requests/140/head
Sultan Khan 4 years ago
parent 283473a06a
commit 58b1f648c1

@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -196,6 +197,19 @@ class _Login extends State<Login> {
})
.catchError((err) {
print(err);
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: err,
okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {
Navigator.of(context).pushNamed(
REGISTER,
),
ConfirmDialog.closeAlertDialog(context)
},
cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)});
dialog.showAlertDialog(context);
GifLoaderDialogUtils.hideDialog(context);
});
// SMSOTP.showLoadingDialog(context, false),

@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:screen/screen.dart';
class GeneralSettings extends StatefulWidget {
@override
@ -16,8 +17,11 @@ class _GeneralSettings extends State<GeneralSettings>
with TickerProviderStateMixin {
var themeNotifier;
int blindValue = 0;
bool vibration =false;
bool accessibility =false;
bool camera =false;
bool location =false ;
Widget build(BuildContext context) {
bool isVibration = true;
themeNotifier = Provider.of<ThemeNotifier>(context);
return Container(
@ -36,12 +40,12 @@ class _GeneralSettings extends State<GeneralSettings>
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(TranslationBase.of(context).vibration),
AppText(TranslationBase.of(context).vibration),
Switch(
value: isVibration,
value: vibration,
onChanged: (value) {
setState(() {
isVibration = value;
vibration = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
@ -57,10 +61,10 @@ class _GeneralSettings extends State<GeneralSettings>
children: [
AppText(TranslationBase.of(context).accessibility),
Switch(
value: isVibration,
value: accessibility,
onChanged: (value) {
setState(() {
isVibration = value;
accessibility = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
@ -175,10 +179,10 @@ class _GeneralSettings extends State<GeneralSettings>
children: [
AppText(TranslationBase.of(context).cameraPermission),
Switch(
value: isVibration,
value: camera,
onChanged: (value) {
setState(() {
isVibration = value;
camera = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
@ -194,10 +198,10 @@ class _GeneralSettings extends State<GeneralSettings>
children: [
AppText(TranslationBase.of(context).locationPermission),
Switch(
value: isVibration,
value: location,
onChanged: (value) {
setState(() {
isVibration = value;
location = value;
});
},
activeTrackColor: Colors.lightGreenAccent,
@ -212,15 +216,23 @@ class _GeneralSettings extends State<GeneralSettings>
switch (value) {
case 0:
themeNotifier.setTheme(defaultTheme);
Screen.setBrightness(1.0);
break;
case 1:
themeNotifier.setTheme(invertTheme);
Screen.setBrightness(1.0);
break;
case 2:
themeNotifier.setTheme(dimTheme);
//themeNotifier.setTheme(dimTheme);
Screen.setBrightness(0.01);
break;
case 3:
themeNotifier.setTheme(bwTheme);
Screen.setBrightness(1.0);
break;
default:
themeNotifier.setTheme(defaultTheme);
Screen.setBrightness(1.0);
break;
}
}

@ -28,12 +28,13 @@ final defaultTheme = ThemeData(
textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5),
textSelectionHandleColor: Colors.grey,
canvasColor: Colors.white,
backgroundColor: Color.fromRGBO(255, 255, 255, 1),
backgroundColor: Colors.white,
highlightColor: Colors.grey[100].withOpacity(0.4),
splashColor: Colors.transparent,
primaryColor: Color(0xff40ACC9),
bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)),
cursorColor: Colors.grey,
cardColor: Colors.white,
iconTheme: IconThemeData(),
appBarTheme: AppBarTheme(
color: Color(0xff40ACC9),
@ -47,70 +48,76 @@ final defaultTheme = ThemeData(
final invertTheme = ThemeData(
// fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans',
primarySwatch: Colors.black,
primarySwatch: Colors.grey,
visualDensity: VisualDensity.adaptivePlatformDensity,
brightness: Brightness.dark,
brightness: Brightness.light,
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: ZoomPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
},
),
hintColor: Colors.white,
disabledColor: Colors.white,
hintColor: Colors.grey[400],
cardColor: Colors.black,
buttonColor: Colors.grey[400],
disabledColor: Colors.grey[300],
errorColor: Color.fromRGBO(235, 80, 60, 1.0),
scaffoldBackgroundColor: Color(0xffEEEEEE),
scaffoldBackgroundColor: Colors.grey,
textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5),
textSelectionHandleColor: Colors.white,
textSelectionHandleColor: Colors.grey,
canvasColor: Colors.white,
backgroundColor: Color.fromRGBO(255, 255, 255, 1),
backgroundColor: Colors.grey,
highlightColor: Colors.grey[100].withOpacity(0.4),
splashColor: Colors.transparent,
primaryColor: Color(0xff40ACC9),
primaryColor: Colors.grey,
bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)),
cursorColor: Colors.grey,
iconTheme: IconThemeData(),
appBarTheme: AppBarTheme(
color: Color(0xff000000),
color: Colors.grey,
brightness: Brightness.dark,
elevation: 5.0,
elevation: 10.0,
actionsIconTheme: IconThemeData(
color: Color(0xff000000),
color: Colors.grey,
),
),
);
final dimTheme = ThemeData(
final bwTheme = ThemeData(
// fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans',
primarySwatch: Colors.blue,
primarySwatch: Colors.black54,
visualDensity: VisualDensity.adaptivePlatformDensity,
brightness: Brightness.dark,
brightness: Brightness.light,
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: ZoomPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
},
),
hintColor: Colors.grey[400],
disabledColor: Colors.grey[300],
hintColor: Colors.black54,
cardColor:Colors.black54,
buttonColor: Colors.black54,
disabledColor: Colors.black54,
errorColor: Color.fromRGBO(235, 80, 60, 1.0),
scaffoldBackgroundColor: Color(0xffEEEEEE),
scaffoldBackgroundColor: Colors.black54,
textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5),
textSelectionHandleColor: Colors.grey,
canvasColor: Colors.white,
backgroundColor: Color.fromRGBO(255, 255, 255, 1),
textSelectionHandleColor: Colors.black54,
canvasColor:Colors.black54,
backgroundColor: Colors.black54,
highlightColor: Colors.grey[100].withOpacity(0.4),
splashColor: Colors.transparent,
primaryColor: Color(0xff40ACC9),
primaryColor: Colors.black54,
bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)),
cursorColor: Colors.grey,
cursorColor: Colors.black54,
iconTheme: IconThemeData(),
appBarTheme: AppBarTheme(
color: Color(0xff40ACC9),
color: Colors.black54,
brightness: Brightness.dark,
elevation: 10.0,
actionsIconTheme: IconThemeData(
color: Color(0xff40ACC9),
color: Colors.black54,
),
),
);

@ -139,7 +139,7 @@ dependencies:
#Handle Geolocation
geolocator: ^6.0.0+1
screen: ^0.0.5
#google maps places
google_maps_place_picker: ^1.0.0

Loading…
Cancel
Save