@ -20,10 +20,10 @@ class _GeneralSettings extends State<GeneralSettings>
with TickerProviderStateMixin {
var themeNotifier ;
int blindValue = 0 ;
bool vibration = false ;
bool accsibility = false ;
bool camera = false ;
bool location = false ;
bool vibration = false ;
bool accsibility = false ;
bool camera = false ;
bool location = false ;
var sharedPref = new AppSharedPreferences ( ) ;
var permission = new PermissionService ( ) ;
var mediaQueryData ;
@ -33,10 +33,9 @@ class _GeneralSettings extends State<GeneralSettings>
super . initState ( ) ;
}
Widget build ( BuildContext context ) {
mediaQueryData = MediaQuery . of ( context ) ;
themeNotifier = Provider . of < ThemeNotifier > ( context ) ;
mediaQueryData = MediaQuery . of ( context ) ;
themeNotifier = Provider . of < ThemeNotifier > ( context ) ;
return Container (
child: ListView ( scrollDirection: Axis . vertical , children: < Widget > [
Container (
@ -59,7 +58,6 @@ class _GeneralSettings extends State<GeneralSettings>
onChanged: ( value ) {
setState ( ( ) {
vibration = value ;
} ) ;
setVibration ( value ) ;
} ,
@ -81,7 +79,7 @@ class _GeneralSettings extends State<GeneralSettings>
setState ( ( ) {
accsibility = value ;
} ) ;
/ / setAccisibility ( value ) ;
/ / setAccisibility ( value ) ;
} ,
activeTrackColor: Colors . lightGreenAccent ,
activeColor: Colors . green ,
@ -228,7 +226,7 @@ class _GeneralSettings extends State<GeneralSettings>
] ) ) ;
}
setTheme ( value ) async {
setTheme ( value ) async {
switch ( value ) {
case 0 :
{
@ -239,7 +237,7 @@ class _GeneralSettings extends State<GeneralSettings>
case 1 :
{
themeNotifier . setTheme ( ThemeData (
fontFamily: await sharedPref . getString ( APP_LANGUAGE ) = = ' ar ' ? ' Cairo ' : ' WorkSans ' ,
/ / fontFamily: await sharedPref . getString ( APP_LANGUAGE ) = = ' ar ' ? ' Cairo ' : ' WorkSans ' ,
primarySwatch: Colors . grey ,
visualDensity: VisualDensity . adaptivePlatformDensity ,
brightness: Brightness . light ,
@ -262,7 +260,8 @@ class _GeneralSettings extends State<GeneralSettings>
highlightColor: Colors . grey [ 100 ] . withOpacity ( 0.4 ) ,
splashColor: Colors . transparent ,
primaryColor: Colors . grey ,
bottomSheetTheme: BottomSheetThemeData ( backgroundColor: Color ( 0xffE0E0E0 ) ) ,
bottomSheetTheme:
BottomSheetThemeData ( backgroundColor: Color ( 0xffE0E0E0 ) ) ,
cursorColor: Colors . grey ,
iconTheme: IconThemeData ( ) ,
@ -296,139 +295,142 @@ class _GeneralSettings extends State<GeneralSettings>
break ;
}
/ / permission . setTheme ( value ) ;
}
setVibration ( value ) {
setVibration ( value ) {
permission . setVibrationPermission ( value ) ;
}
setAccisibility ( ) {
if ( ! accsibility ) {
}
/ / permission . setVibrationPermission ( value ) ;
setAccisibility ( ) {
if ( ! accsibility ) { }
/ / permission . setVibrationPermission ( value ) ;
}
getValues ( ) async {
blindValue = permission . isThemeEnabled ( ) = = null ? 0 : permission . isThemeEnabled ( ) ;
vibration = permission . isVibrationEnabled ( ) = = null ? false : permission . isVibrationEnabled ( ) ;
accsibility = mediaQueryData . accessibleNavigation ;
}
getTheme ( value ) async {
if ( value = = 1 ) {
return ThemeData (
fontFamily: await sharedPref . getString ( APP_LANGUAGE ) = = ' ar ' ? ' Cairo ' : ' WorkSans ' ,
primarySwatch: Colors . grey ,
visualDensity: VisualDensity . adaptivePlatformDensity ,
brightness: Brightness . light ,
pageTransitionsTheme: const PageTransitionsTheme (
builders: {
TargetPlatform . android: ZoomPageTransitionsBuilder ( ) ,
TargetPlatform . iOS: CupertinoPageTransitionsBuilder ( ) ,
} ,
) ,
hintColor: Colors . grey [ 400 ] ,
cardColor: Colors . black ,
buttonColor: Colors . grey [ 400 ] ,
disabledColor: Colors . grey [ 300 ] ,
errorColor: Color . fromRGBO ( 235 , 80 , 60 , 1.0 ) ,
scaffoldBackgroundColor: Colors . grey ,
textSelectionColor: Color . fromRGBO ( 80 , 100 , 253 , 0.5 ) ,
textSelectionHandleColor: Colors . grey ,
canvasColor: Colors . white ,
backgroundColor: Colors . grey ,
highlightColor: Colors . grey [ 100 ] . withOpacity ( 0.4 ) ,
splashColor: Colors . transparent ,
primaryColor: Colors . grey ,
bottomSheetTheme: BottomSheetThemeData ( backgroundColor: Color ( 0xffE0E0E0 ) ) ,
cursorColor: Colors . grey ,
iconTheme: IconThemeData ( ) ,
appBarTheme: AppBarTheme (
color: Colors . grey ,
brightness: Brightness . dark ,
elevation: 10.0 ,
actionsIconTheme: IconThemeData (
color: Colors . grey ,
) ,
) ,
) ;
} else if ( value = = 3 ) {
return ThemeData (
fontFamily: await sharedPref . getString ( APP_LANGUAGE ) = = ' ar ' ? ' Cairo ' : ' WorkSans ' ,
primarySwatch: Colors . grey ,
visualDensity: VisualDensity . adaptivePlatformDensity ,
brightness: Brightness . light ,
pageTransitionsTheme: const PageTransitionsTheme (
builders: {
TargetPlatform . android: ZoomPageTransitionsBuilder ( ) ,
TargetPlatform . iOS: CupertinoPageTransitionsBuilder ( ) ,
} ,
) ,
hintColor: Colors . grey [ 400 ] ,
cardColor: Colors . black ,
buttonColor: Colors . grey [ 400 ] ,
disabledColor: Colors . grey [ 300 ] ,
errorColor: Color . fromRGBO ( 235 , 80 , 60 , 1.0 ) ,
scaffoldBackgroundColor: Colors . grey ,
textSelectionColor: Color . fromRGBO ( 80 , 100 , 253 , 0.5 ) ,
textSelectionHandleColor: Colors . grey ,
canvasColor: Colors . white ,
backgroundColor: Colors . grey ,
highlightColor: Colors . grey [ 100 ] . withOpacity ( 0.4 ) ,
splashColor: Colors . transparent ,
primaryColor: Colors . grey ,
bottomSheetTheme: BottomSheetThemeData ( backgroundColor: Color ( 0xffE0E0E0 ) ) ,
cursorColor: Colors . grey ,
getValues ( ) async {
blindValue =
permission . isThemeEnabled ( ) = = null ? 0 : permission . isThemeEnabled ( ) ;
vibration = permission . isVibrationEnabled ( ) = = null
? false
: permission . isVibrationEnabled ( ) ;
accsibility = mediaQueryData . accessibleNavigation ;
}
iconTheme: IconThemeData ( ) ,
appBarTheme: AppBarTheme (
color: Colors . black45 ,
brightness: Brightness . dark ,
elevation: 10.0 ,
actionsIconTheme: IconThemeData (
color: Colors . grey ,
) ,
) ,
) ;
getTheme ( value ) async {
if ( value = = 1 ) {
return ThemeData (
/ / fontFamily: await sharedPref . getString ( APP_LANGUAGE ) = = ' ar ' ? ' Cairo ' : ' WorkSans ' ,
primarySwatch: Colors . grey ,
visualDensity: VisualDensity . adaptivePlatformDensity ,
brightness: Brightness . light ,
pageTransitionsTheme: const PageTransitionsTheme (
builders: {
TargetPlatform . android: ZoomPageTransitionsBuilder ( ) ,
TargetPlatform . iOS: CupertinoPageTransitionsBuilder ( ) ,
} ,
) ,
hintColor: Colors . grey [ 400 ] ,
cardColor: Colors . black ,
buttonColor: Colors . grey [ 400 ] ,
disabledColor: Colors . grey [ 300 ] ,
errorColor: Color . fromRGBO ( 235 , 80 , 60 , 1.0 ) ,
scaffoldBackgroundColor: Colors . grey ,
textSelectionColor: Color . fromRGBO ( 80 , 100 , 253 , 0.5 ) ,
textSelectionHandleColor: Colors . grey ,
canvasColor: Colors . white ,
backgroundColor: Colors . grey ,
highlightColor: Colors . grey [ 100 ] . withOpacity ( 0.4 ) ,
splashColor: Colors . transparent ,
primaryColor: Colors . grey ,
bottomSheetTheme:
BottomSheetThemeData ( backgroundColor: Color ( 0xffE0E0E0 ) ) ,
cursorColor: Colors . grey ,
} else {
return ThemeData (
fontFamily: await sharedPref . getString ( APP_LANGUAGE ) = = ' ar ' ? ' Cairo ' : ' WorkSans ' ,
primarySwatch: Colors . blue ,
visualDensity: VisualDensity . adaptivePlatformDensity ,
brightness: Brightness . light ,
pageTransitionsTheme: const PageTransitionsTheme (
builders: {
TargetPlatform . android: ZoomPageTransitionsBuilder ( ) ,
TargetPlatform . iOS: CupertinoPageTransitionsBuilder ( ) ,
} ,
) ,
hintColor: Colors . grey [ 400 ] ,
disabledColor: Colors . grey [ 300 ] ,
errorColor: Color . fromRGBO ( 235 , 80 , 60 , 1.0 ) ,
scaffoldBackgroundColor: Color ( 0xffEEEEEE ) ,
textSelectionColor: Color . fromRGBO ( 80 , 100 , 253 , 0.5 ) ,
textSelectionHandleColor: Colors . grey ,
canvasColor: Colors . white ,
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 ) ,
brightness: Brightness . dark ,
elevation: 10.0 ,
actionsIconTheme: IconThemeData (
color: Color ( 0xff40ACC9 ) ,
) ,
) ,
) ;
iconTheme: IconThemeData ( ) ,
appBarTheme: AppBarTheme (
color: Colors . grey ,
brightness: Brightness . dark ,
elevation: 10.0 ,
actionsIconTheme: IconThemeData (
color: Colors . grey ,
) ,
) ,
) ;
} else if ( value = = 3 ) {
return ThemeData (
/ / fontFamily: await sharedPref . getString ( APP_LANGUAGE ) = = ' ar ' ? ' Cairo ' : ' WorkSans ' ,
primarySwatch: Colors . grey ,
visualDensity: VisualDensity . adaptivePlatformDensity ,
brightness: Brightness . light ,
pageTransitionsTheme: const PageTransitionsTheme (
builders: {
TargetPlatform . android: ZoomPageTransitionsBuilder ( ) ,
TargetPlatform . iOS: CupertinoPageTransitionsBuilder ( ) ,
} ,
) ,
hintColor: Colors . grey [ 400 ] ,
cardColor: Colors . black ,
buttonColor: Colors . grey [ 400 ] ,
disabledColor: Colors . grey [ 300 ] ,
errorColor: Color . fromRGBO ( 235 , 80 , 60 , 1.0 ) ,
scaffoldBackgroundColor: Colors . grey ,
textSelectionColor: Color . fromRGBO ( 80 , 100 , 253 , 0.5 ) ,
textSelectionHandleColor: Colors . grey ,
canvasColor: Colors . white ,
backgroundColor: Colors . grey ,
highlightColor: Colors . grey [ 100 ] . withOpacity ( 0.4 ) ,
splashColor: Colors . transparent ,
primaryColor: Colors . grey ,
bottomSheetTheme:
BottomSheetThemeData ( backgroundColor: Color ( 0xffE0E0E0 ) ) ,
cursorColor: Colors . grey ,
}
iconTheme: IconThemeData ( ) ,
appBarTheme: AppBarTheme (
color: Colors . black45 ,
brightness: Brightness . dark ,
elevation: 10.0 ,
actionsIconTheme: IconThemeData (
color: Colors . grey ,
) ,
) ,
) ;
} else {
return ThemeData (
/ / fontFamily: await sharedPref . getString ( APP_LANGUAGE ) = = ' ar ' ? ' Cairo ' : ' WorkSans ' ,
primarySwatch: Colors . blue ,
visualDensity: VisualDensity . adaptivePlatformDensity ,
brightness: Brightness . light ,
pageTransitionsTheme: const PageTransitionsTheme (
builders: {
TargetPlatform . android: ZoomPageTransitionsBuilder ( ) ,
TargetPlatform . iOS: CupertinoPageTransitionsBuilder ( ) ,
} ,
) ,
hintColor: Colors . grey [ 400 ] ,
disabledColor: Colors . grey [ 300 ] ,
errorColor: Color . fromRGBO ( 235 , 80 , 60 , 1.0 ) ,
scaffoldBackgroundColor: Color ( 0xffEEEEEE ) ,
textSelectionColor: Color . fromRGBO ( 80 , 100 , 253 , 0.5 ) ,
textSelectionHandleColor: Colors . grey ,
canvasColor: Colors . white ,
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 ) ,
brightness: Brightness . dark ,
elevation: 10.0 ,
actionsIconTheme: IconThemeData (
color: Color ( 0xff40ACC9 ) ,
) ,
) ,
) ;
}
}
}