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/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -196,6 +197,19 @@ class _Login extends State<Login> {
}) })
.catchError((err) { .catchError((err) {
print(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); GifLoaderDialogUtils.hideDialog(context);
}); });
// SMSOTP.showLoadingDialog(context, false), // 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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:screen/screen.dart';
class GeneralSettings extends StatefulWidget { class GeneralSettings extends StatefulWidget {
@override @override
@ -16,8 +17,11 @@ class _GeneralSettings extends State<GeneralSettings>
with TickerProviderStateMixin { with TickerProviderStateMixin {
var themeNotifier; var themeNotifier;
int blindValue = 0; int blindValue = 0;
bool vibration =false;
bool accessibility =false;
bool camera =false;
bool location =false ;
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool isVibration = true;
themeNotifier = Provider.of<ThemeNotifier>(context); themeNotifier = Provider.of<ThemeNotifier>(context);
return Container( return Container(
@ -36,12 +40,12 @@ class _GeneralSettings extends State<GeneralSettings>
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text(TranslationBase.of(context).vibration), AppText(TranslationBase.of(context).vibration),
Switch( Switch(
value: isVibration, value: vibration,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
isVibration = value; vibration = value;
}); });
}, },
activeTrackColor: Colors.lightGreenAccent, activeTrackColor: Colors.lightGreenAccent,
@ -57,10 +61,10 @@ class _GeneralSettings extends State<GeneralSettings>
children: [ children: [
AppText(TranslationBase.of(context).accessibility), AppText(TranslationBase.of(context).accessibility),
Switch( Switch(
value: isVibration, value: accessibility,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
isVibration = value; accessibility = value;
}); });
}, },
activeTrackColor: Colors.lightGreenAccent, activeTrackColor: Colors.lightGreenAccent,
@ -175,10 +179,10 @@ class _GeneralSettings extends State<GeneralSettings>
children: [ children: [
AppText(TranslationBase.of(context).cameraPermission), AppText(TranslationBase.of(context).cameraPermission),
Switch( Switch(
value: isVibration, value: camera,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
isVibration = value; camera = value;
}); });
}, },
activeTrackColor: Colors.lightGreenAccent, activeTrackColor: Colors.lightGreenAccent,
@ -194,10 +198,10 @@ class _GeneralSettings extends State<GeneralSettings>
children: [ children: [
AppText(TranslationBase.of(context).locationPermission), AppText(TranslationBase.of(context).locationPermission),
Switch( Switch(
value: isVibration, value: location,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
isVibration = value; location = value;
}); });
}, },
activeTrackColor: Colors.lightGreenAccent, activeTrackColor: Colors.lightGreenAccent,
@ -212,15 +216,23 @@ class _GeneralSettings extends State<GeneralSettings>
switch (value) { switch (value) {
case 0: case 0:
themeNotifier.setTheme(defaultTheme); themeNotifier.setTheme(defaultTheme);
Screen.setBrightness(1.0);
break; break;
case 1: case 1:
themeNotifier.setTheme(invertTheme); themeNotifier.setTheme(invertTheme);
Screen.setBrightness(1.0);
break; break;
case 2: case 2:
themeNotifier.setTheme(dimTheme); //themeNotifier.setTheme(dimTheme);
Screen.setBrightness(0.01);
break;
case 3:
themeNotifier.setTheme(bwTheme);
Screen.setBrightness(1.0);
break; break;
default: default:
themeNotifier.setTheme(defaultTheme); themeNotifier.setTheme(defaultTheme);
Screen.setBrightness(1.0);
break; break;
} }
} }

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

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

Loading…
Cancel
Save