diff --git a/assets/images/soundWaveAnimation.gif b/assets/images/soundWaveAnimation.gif new file mode 100644 index 00000000..730e27eb Binary files /dev/null and b/assets/images/soundWaveAnimation.gif differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 3ca7f502..b45b625d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,8 +12,8 @@ const EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/exacartapi'; const PACKAGES_CATEGORIES = '/api/categories'; const PACKAGES_PRODUCTS = '/api/products'; -//const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +//const BASE_URL = 'https://hmgwebservices.com/'; //const BASE_PHARMACY_URL = 'http://swd-pharapp-01:7200/api/'; const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/main.dart b/lib/main.dart index e0444a32..4a07edba 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -23,18 +24,33 @@ import 'pages/pharmacies/compare-list.dart'; void main() async { setupLocator(); - runApp(ChangeNotifierProvider(create: (context) => ThemeNotifier(defaultTheme), child: MyApp())); + runApp(MyApp()); } -class MyApp extends StatelessWidget { +class MyApp extends StatefulWidget { + @override + _MyApp createState() => new _MyApp(); +} + +class _MyApp extends State { + @override + void initState() { + // ProjectViewModel projectProvider; + // projectProvider = Provider.of(context); + // var font = projectProvider.isArabic ? 'Cairo' : 'WorkSans'; + ThemeNotifier(defaultTheme()); + super.initState(); + } + @override Widget build(BuildContext context) { PlatformBridge.init(context); - LocalNotification.init(onNotificationClick: (payload){ - LocalNotification.getInstance().showNow(title: "Payload", subtitle: payload, payload: payload); + LocalNotification.init(onNotificationClick: (payload) { + LocalNotification.getInstance() + .showNow(title: "Payload", subtitle: payload, payload: payload); }); - final themeNotifier = Provider.of(context); + // final themeNotifier = Provider.of(context); precacheImage(AssetImage('assets/images/powerd-by.jpg'), context); return LayoutBuilder( builder: (context, constraints) { @@ -46,11 +62,15 @@ class MyApp extends StatelessWidget { ChangeNotifierProvider( create: (context) => ProjectViewModel(), ), - ChangeNotifierProvider(create: (context) => ToDoCountProviderModel()), - ChangeNotifierProvider(create: (context) => SearchProvider()), + ChangeNotifierProvider( + create: (context) => ToDoCountProviderModel()), + ChangeNotifierProvider( + create: (context) => SearchProvider()), ChangeNotifierProvider.value( value: SearchProvider(), ), + ChangeNotifierProvider( + create: (context) => ThemeNotifier(defaultTheme())), StreamProvider.value( value: RobotProvider().intStream(), initialData: RobotProvider().setValue({}), @@ -60,7 +80,6 @@ class MyApp extends StatelessWidget { ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( - showSemanticsDebugger: false, title: 'Diplomatic Quarter App', locale: projectProvider.appLocal, @@ -74,47 +93,50 @@ class MyApp extends StatelessWidget { const Locale('ar', ''), // Arabic const Locale('en', ''), // English ], - theme: ThemeData( - fontFamily: projectProvider.isArabic ? '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], - textTheme: TextTheme( - headline1: TextStyle( - color: Color(0xffB8382C), - ), - ), - disabledColor: Colors.grey[300], - errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xffE9E9E9), // Colors.grey[100], - textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - textSelectionHandleColor: Colors.grey, - canvasColor: Colors.white, - backgroundColor: Color.fromRGBO(255, 255, 255, 1), - highlightColor: Colors.grey[100].withOpacity(0.4), - splashColor: Colors.transparent, - primaryColor: Color(0xff515A5D), - toggleableActiveColor: secondaryColor, - indicatorColor: secondaryColor, - bottomSheetTheme: BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), - cursorColor: Colors.grey, - iconTheme: IconThemeData(), - appBarTheme: AppBarTheme( - color: Color(0xff515A5D), - brightness: Brightness.light, - elevation: 0.0, - actionsIconTheme: IconThemeData( - color: Colors.grey[800], - ), - ), - ), + theme: Provider.of(context).getTheme(), + // theme: ThemeData( + // fontFamily: projectProvider.isArabic ? '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], + // textTheme: TextTheme( + // headline1: TextStyle( + // color: Color(0xffB8382C), + // ), + // ), + // disabledColor: Colors.grey[300], + // errorColor: Color.fromRGBO(235, 80, 60, 1.0), + // scaffoldBackgroundColor: + // Color(0xffE9E9E9), // Colors.grey[100], + // textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + // textSelectionHandleColor: Colors.grey, + // canvasColor: Colors.white, + // backgroundColor: Color.fromRGBO(255, 255, 255, 1), + // highlightColor: Colors.grey[100].withOpacity(0.4), + // splashColor: Colors.transparent, + // primaryColor: Color(0xff515A5D), + // toggleableActiveColor: secondaryColor, + // indicatorColor: secondaryColor, + // bottomSheetTheme: BottomSheetThemeData( + // backgroundColor: HexColor('#E0E0E0')), + // cursorColor: Colors.grey, + // iconTheme: IconThemeData(), + // appBarTheme: AppBarTheme( + // color: Color(0xff515A5D), + // brightness: Brightness.light, + // elevation: 0.0, + // actionsIconTheme: IconThemeData( + // color: Colors.grey[800], + // ), + // ), + // ), initialRoute: SPLASH, routes: routes, debugShowCheckedModeBanner: false, diff --git a/lib/models/Authentication/send_activation_request.dart b/lib/models/Authentication/send_activation_request.dart index b53e19b8..f9b386c6 100644 --- a/lib/models/Authentication/send_activation_request.dart +++ b/lib/models/Authentication/send_activation_request.dart @@ -21,7 +21,7 @@ class SendActivationRequest { Null sessionID; bool isDentalAllowedBackend; int deviceTypeID; - + String sMSSignature; SendActivationRequest( {this.patientMobileNumber, this.mobileNo, @@ -44,7 +44,8 @@ class SendActivationRequest { this.patientOutSA, this.sessionID, this.isDentalAllowedBackend, - this.deviceTypeID}); + this.deviceTypeID, + this.sMSSignature}); SendActivationRequest.fromJson(Map json) { patientMobileNumber = json['PatientMobileNumber']; @@ -69,6 +70,7 @@ class SendActivationRequest { sessionID = json['SessionID']; isDentalAllowedBackend = json['isDentalAllowedBackend']; deviceTypeID = json['DeviceTypeID']; + sMSSignature = json['SMSSignature']; } Map toJson() { @@ -95,6 +97,7 @@ class SendActivationRequest { data['SessionID'] = this.sessionID; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; + data['SMSSignature'] = sMSSignature; return data; } } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index deb20bd9..704aef54 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -339,47 +339,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { return permissionResults; } - setTheme() async { - // - // defaultTheme = - // ThemeData( - // fontFamily:projectViewModel.isArabic ? '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), - // ), - // ), - // ); - // themeNotifier.setTheme(defaultTheme); - } - static Future myBackgroundMessageHandler( Map message) async { Map myMap = new Map.from(message['data']); @@ -494,14 +453,15 @@ class _LandingPageState extends State with WidgetsBindingObserver { appBar: AppBar( elevation: 0, textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + headline6: TextStyle( + color: Theme.of(context).textTheme.headline1.color, + fontWeight: FontWeight.bold), ), title: Text( getText(currentTab).toUpperCase(), style: TextStyle( fontWeight: FontWeight.bold, - color: Colors.white, + color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'), // bold: true, // color: Colors.white, @@ -513,12 +473,12 @@ class _LandingPageState extends State with WidgetsBindingObserver { currentTab == 0 ? IconButton( icon: Icon(Icons.menu), - color: Colors.white, + color: Theme.of(context).textTheme.headline1.color, onPressed: () => Scaffold.of(context).openDrawer(), ) : IconButton( icon: Icon(Icons.arrow_back), - color: Colors.white, + color: Theme.of(context).textTheme.headline1.color, onPressed: () { setState(() { currentTab = 0; @@ -561,7 +521,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { //iconSize: 70, icon: Icon( projectViewModel.isLogin ? Icons.settings : Icons.login, - color: Colors.white, + color: Theme.of(context).textTheme.headline1.color, ), onPressed: () { if (projectViewModel.isLogin) diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index dd749e98..851c7729 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -353,6 +353,7 @@ class _ConfirmLogin extends State { sendActivationCode(type) async { var request = this.getCommonRequest(type: type); + request.sMSSignature = await SMSOTP.getSignature(); GifLoaderDialogUtils.showMyDialog(context); await this.authService.sendActivationCode(request).then((result) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index 6ce64d15..14f24181 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; @@ -39,15 +40,15 @@ class _GeneralSettings extends State return Container( child: ListView(scrollDirection: Axis.vertical, children: [ Container( + color: Theme.of(context).primaryColor, padding: EdgeInsets.all(10), child: AppText( TranslationBase.of(context).modes, - color: Colors.black, fontWeight: FontWeight.bold, ), ), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.all(10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -67,7 +68,7 @@ class _GeneralSettings extends State ], )), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.all(10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -87,15 +88,15 @@ class _GeneralSettings extends State ], )), Container( + color: Theme.of(context).primaryColor, padding: EdgeInsets.all(10), child: AppText( TranslationBase.of(context).blindMode, - color: Colors.black, fontWeight: FontWeight.bold, ), ), new Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.all(8.0), child: new Column( mainAxisAlignment: MainAxisAlignment.center, @@ -178,15 +179,15 @@ class _GeneralSettings extends State ) ])), Container( + color: Theme.of(context).primaryColor, padding: EdgeInsets.all(10), child: AppText( TranslationBase.of(context).permissions, - color: Colors.black, fontWeight: FontWeight.bold, ), ), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.all(10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -205,7 +206,7 @@ class _GeneralSettings extends State ], )), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.all(10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -236,46 +237,9 @@ class _GeneralSettings extends State break; case 1: { - themeNotifier.setTheme(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, - ), - ), - )); - Screen.setBrightness(1.0); + themeNotifier.setTheme(await getTheme(value)); } + break; case 2: themeNotifier.setTheme(await getTheme(value)); @@ -294,7 +258,7 @@ class _GeneralSettings extends State } break; } - //permission.setTheme(value); + permission.setTheme(value); } setVibration(value) { @@ -307,130 +271,28 @@ class _GeneralSettings extends State } getValues() async { - blindValue = - permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); - vibration = permission.isVibrationEnabled() == null - ? false - : permission.isVibrationEnabled(); - accsibility = mediaQueryData.accessibleNavigation; + if (permission.isThemeEnabled() != null) { + blindValue = + permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); + vibration = permission.isVibrationEnabled() == null + ? false + : permission.isVibrationEnabled(); + accsibility = mediaQueryData.accessibleNavigation; + setTheme(blindValue); + } } 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, - ), - ), - ); + return invertThemes(); } 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, - ), - ), - ); + return bwThemes(); } 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), - ), - ), - ); + return defaultTheme( + fontName: + Provider.of(context, listen: false).isArabic + ? 'Cairo' + : 'WorkSans'); } } } diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index dcfdb8a8..833cdf2b 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -14,7 +14,6 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:provider/provider.dart'; class ProfileSettings extends StatefulWidget { - @override _ProfileSettings createState() => _ProfileSettings(); } @@ -45,6 +44,7 @@ class _ProfileSettings extends State child: model.user != null ? ListView(scrollDirection: Axis.vertical, children: [ Container( + color: Theme.of(context).primaryColor, padding: EdgeInsets.all(15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -74,7 +74,7 @@ class _ProfileSettings extends State padding: EdgeInsets.all(10), ), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Row( @@ -93,7 +93,7 @@ class _ProfileSettings extends State ], )), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Row( @@ -116,7 +116,7 @@ class _ProfileSettings extends State padding: EdgeInsets.all(10), ), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Row( @@ -136,7 +136,7 @@ class _ProfileSettings extends State ], )), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Row( @@ -160,7 +160,7 @@ class _ProfileSettings extends State padding: EdgeInsets.all(10), ), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Column( @@ -175,7 +175,7 @@ class _ProfileSettings extends State ], )), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Column( @@ -190,7 +190,7 @@ class _ProfileSettings extends State ], )), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, padding: EdgeInsets.only( top: 0, left: 10, right: 10, bottom: 0), child: Column( diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index 0c63b900..b578eb3f 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -21,7 +21,7 @@ class _Settings extends State with TickerProviderStateMixin { _tabController = new TabController(length: 2, vsync: this, initialIndex: widget.type); - if(widget.type==1){ + if (widget.type == 1) { _tabController.animateTo(1); } @@ -51,7 +51,8 @@ class _Settings extends State with TickerProviderStateMixin { controller: _tabController, ), title: Text(TranslationBase.of(context).settings, - style: TextStyle(color: Colors.white)), + style: + TextStyle(color: Theme.of(context).textTheme.bodyText2.color)), leading: Builder( builder: (BuildContext context) { return ArrowBack(); diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart new file mode 100644 index 00000000..893449f1 --- /dev/null +++ b/lib/theme/colors.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; + +class CustomColors { + static const Color lightPurple = Color(0xFFBB86FA); + static const Color purple = Color(0xFF6002EE); + static const Color deepPurple = Color(0xFF3900B1); + static const Color grey = Color(0xFF848484); + static const Color darkGrey = Color(0xFF222222); + static const Color black = Color(0xFF141414); + static const Color white = Color(0xFFFFFFFF); +} diff --git a/lib/theme/config.dart b/lib/theme/config.dart new file mode 100644 index 00000000..4c321fb8 --- /dev/null +++ b/lib/theme/config.dart @@ -0,0 +1,3 @@ +// import 'package:diplomaticquarterapp/theme/custom_theme.dart'; + +// CustomTheme currentTheme = CustomTheme(); diff --git a/lib/theme/custom_theme.dart b/lib/theme/custom_theme.dart new file mode 100644 index 00000000..8361ec4e --- /dev/null +++ b/lib/theme/custom_theme.dart @@ -0,0 +1,89 @@ +// import 'package:diplomaticquarterapp/Constants.dart'; +// import 'package:flutter/material.dart'; +// import 'package:hexcolor/hexcolor.dart'; + +// import 'colors.dart'; + +// class CustomTheme with ChangeNotifier { +// static bool _isDarkTheme = true; +// ThemeMode get currentTheme => +// _isDarkTheme ? ThemeMode.dark : ThemeMode.system; + +// void toggleTheme() { +// _isDarkTheme = !_isDarkTheme; +// notifyListeners(); +// } + +// static ThemeData get lightTheme { +// //1 +// return ThemeData( +// //2 +// primaryColor: CustomColors.purple, +// scaffoldBackgroundColor: Colors.white, +// fontFamily: 'Montserrat', //3 +// buttonTheme: ButtonThemeData( +// // 4 +// shape: +// RoundedRectangleBorder(borderRadius: BorderRadius.circular(18.0)), +// buttonColor: CustomColors.lightPurple, +// )); +// } + +// static ThemeData get darkTheme { +// return ThemeData( +// primaryColor: CustomColors.darkGrey, +// scaffoldBackgroundColor: Colors.black, +// fontFamily: 'Montserrat', +// textTheme: ThemeData.dark().textTheme, +// buttonTheme: ButtonThemeData( +// shape: +// RoundedRectangleBorder(borderRadius: BorderRadius.circular(18.0)), +// buttonColor: CustomColors.lightPurple, +// )); +// } + +// static ThemeData get defaultTheme { +// return ThemeData( +// // fontFamily: projectProvider.isArabic ? '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], +// textTheme: TextTheme( +// headline1: TextStyle( +// color: Color(0xffB8382C), +// ), +// ), +// disabledColor: Colors.grey[300], +// errorColor: Color.fromRGBO(235, 80, 60, 1.0), +// scaffoldBackgroundColor: Color(0xffE9E9E9), // Colors.grey[100], +// textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), +// textSelectionHandleColor: Colors.grey, +// canvasColor: Colors.white, +// backgroundColor: Color.fromRGBO(255, 255, 255, 1), +// highlightColor: Colors.grey[100].withOpacity(0.4), +// splashColor: Colors.transparent, +// primaryColor: Color(0xff515A5D), +// toggleableActiveColor: secondaryColor, +// indicatorColor: secondaryColor, +// bottomSheetTheme: +// BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), +// cursorColor: Colors.grey, +// iconTheme: IconThemeData(), +// appBarTheme: AppBarTheme( +// color: Color(0xff515A5D), +// brightness: Brightness.light, +// elevation: 0.0, +// actionsIconTheme: IconThemeData( +// color: Colors.grey[800], +// ), +// ), +// ); +// } +// } diff --git a/lib/theme/theme_notifier.dart b/lib/theme/theme_notifier.dart index e414d159..402a7865 100644 --- a/lib/theme/theme_notifier.dart +++ b/lib/theme/theme_notifier.dart @@ -1,15 +1,18 @@ -import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; class ThemeNotifier with ChangeNotifier { - ThemeData _themeData = defaultTheme; + ThemeData _themeData; + ThemeNotifier(this._themeData); + getTheme() => _themeData; setTheme(ThemeData themeData) async { _themeData = themeData; - notifyListeners(); } } diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index d19e13b2..9f26bb6f 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -1,9 +1,8 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; /// ---- Default Theme ---- @@ -13,11 +12,11 @@ import 'package:provider/provider.dart'; final bluePrimary = Color(0xFF3F51B5); final blueAccent = Color(0xFFFF9800); final blueBackground = Color(0xFFFFFFFF); +defaultTheme({fontName}) { + return ThemeData( + fontFamily: fontName, //projectProvider.isArabic ? 'Cairo' : 'WorkSans', -// ProjectViewModel projectProvider = Provider.of(AppGlobal.context); - final bwTheme = ThemeData( - //fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.grey, + primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.light, pageTransitionsTheme: const PageTransitionsTheme( @@ -27,37 +26,92 @@ final blueBackground = Color(0xFFFFFFFF); }, ), 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, + scaffoldBackgroundColor: Color(0xffE9E9E9), // Colors.grey[100], textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, canvasColor: Colors.white, - backgroundColor: Colors.grey, + backgroundColor: Color.fromRGBO(255, 255, 255, 1), highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Colors.grey, - bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + primaryColor: Color(0xffffffff), + toggleableActiveColor: secondaryColor, + indicatorColor: secondaryColor, + bottomSheetTheme: + BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), cursorColor: Colors.grey, + primaryTextTheme: TextTheme(bodyText2: TextStyle(color: Colors.white)), + iconTheme: IconThemeData(), + textTheme: TextTheme( + bodyText1: TextStyle(color: Colors.black), + headline1: TextStyle(color: Colors.white), + ), + appBarTheme: AppBarTheme( + color: Color(0xff515A5D), + brightness: Brightness.light, + elevation: 0.0, + actionsIconTheme: IconThemeData( + color: Colors.grey[800], + ), + ), + ); +} + +invertThemes({fontName}) { + return ThemeData( + fontFamily: fontName, //projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.dark, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + textTheme: TextTheme( + bodyText1: TextStyle(color: Colors.white), + headline1: TextStyle(color: Colors.white), + ), + disabledColor: Colors.grey[800], + errorColor: Color.fromRGBO(235, 80, 60, 1.0), + scaffoldBackgroundColor: Color(0xff000000), // Colors.grey[100], + textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + textSelectionHandleColor: Colors.grey, + canvasColor: Colors.black, + backgroundColor: Color.fromRGBO(255, 255, 255, 1), + highlightColor: Colors.grey[100].withOpacity(0.4), + splashColor: Colors.transparent, + primaryColor: Color(0xff515A5D), + toggleableActiveColor: secondaryColor, + indicatorColor: secondaryColor, + bottomSheetTheme: + BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), + cursorColor: Colors.black, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( - color: Colors.black45, + color: Color(0xff000000), brightness: Brightness.dark, - elevation: 10.0, + elevation: 0.0, actionsIconTheme: IconThemeData( - color: Colors.grey, + color: Colors.grey[800], ), ), ); +} - final defaultTheme = ThemeData( - //fontFamily: ProjectViewModel().isArabic? 'Cairo' : 'WorkSans', +bwThemes({fontName}) { + return ThemeData( + fontFamily: fontName, //projectProvider.isArabic ? 'Cairo' : 'WorkSans', primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, - brightness: Brightness.light, + brightness: Brightness.dark, + unselectedWidgetColor: Colors.red, + pageTransitionsTheme: const PageTransitionsTheme( builders: { TargetPlatform.android: ZoomPageTransitionsBuilder(), @@ -65,35 +119,50 @@ final blueBackground = Color(0xFFFFFFFF); }, ), hintColor: Colors.grey[400], - disabledColor: Colors.grey[300], + + textTheme: TextTheme( + bodyText1: TextStyle(color: Colors.red[900]), + headline1: TextStyle(color: Colors.red[900]), + bodyText2: TextStyle(color: Colors.red[900]), + subtitle1: TextStyle(color: Colors.red[900]), + ), + + tabBarTheme: TabBarTheme(labelColor: Colors.red[900]), + + disabledColor: Colors.grey[800], errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xffEEEEEE), + scaffoldBackgroundColor: Color(0xffffffe4), // Colors.grey[100], textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, - canvasColor: Colors.white, - backgroundColor: Colors.white, + canvasColor: Colors.black, + backgroundColor: Color(0xffffffe4), highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Color(0xff40ACC9), - bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), - cursorColor: Colors.grey, - cardColor: Colors.white, + primaryColor: Color(0xfffffff4), + toggleableActiveColor: secondaryColor, + indicatorColor: secondaryColor, + bottomSheetTheme: + BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), + cursorColor: Colors.black, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( - color: Color(0xff40ACC9), + color: Color(0xffffffe4), brightness: Brightness.dark, - elevation: 10.0, + elevation: 0.0, actionsIconTheme: IconThemeData( - color: Color(0xff40ACC9), + color: Colors.grey[800], ), ), ); +} - final invertTheme = ThemeData( - //fontFamily: projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.grey, +dimTheme({fontName}) { + return ThemeData( + fontFamily: fontName, //projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, - brightness: Brightness.light, + brightness: Brightness.dark, + pageTransitionsTheme: const PageTransitionsTheme( builders: { TargetPlatform.android: ZoomPageTransitionsBuilder(), @@ -101,29 +170,26 @@ final blueBackground = Color(0xFFFFFFFF); }, ), 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, + scaffoldBackgroundColor: Color(0xffEEEEEE), textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, canvasColor: Colors.white, - backgroundColor: Colors.grey, + backgroundColor: Color.fromRGBO(255, 255, 255, 1), highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Colors.grey, + primaryColor: Color(0xff40ACC9), bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), cursorColor: Colors.grey, - iconTheme: IconThemeData(), appBarTheme: AppBarTheme( - color: Colors.grey, + color: Color(0xff40ACC9), brightness: Brightness.dark, elevation: 10.0, actionsIconTheme: IconThemeData( - color: Colors.grey, + color: Color(0xff40ACC9), ), ), ); - +} diff --git a/lib/widgets/data_display/text.dart b/lib/widgets/data_display/text.dart index 49f31354..722920a1 100644 --- a/lib/widgets/data_display/text.dart +++ b/lib/widgets/data_display/text.dart @@ -230,7 +230,8 @@ class _TextsState extends State { fontSize: widget.fontSize ?? _getFontSize(), letterSpacing: widget.variant == "overline" ? 1 : null, fontWeight: widget.fontWeight ?? _getFontWeight(), - ), + fontFamily: + projectViewModel.isArabic ? 'Cairo' : 'WorkSans'), ), if (widget.readMore && text.length > widget.maxLength && hidden) Positioned( diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 5eb62069..e70e5043 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -344,6 +344,16 @@ class _AppDrawerState extends State { login(); }, ), + // InkWell( + // child: DrawerItem( + // TranslationBase.of(context).appsetting, + // Icons.settings_input_composite), + // onTap: () { + // Navigator.of(context).pushNamed( + // SETTINGS, + // ); + // }, + // ) ], ) ], diff --git a/lib/widgets/drawer/drawer_item_widget.dart b/lib/widgets/drawer/drawer_item_widget.dart index 100b9ae0..bca885b0 100644 --- a/lib/widgets/drawer/drawer_item_widget.dart +++ b/lib/widgets/drawer/drawer_item_widget.dart @@ -2,6 +2,7 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/material.dart'; /// @@ -15,8 +16,8 @@ class DrawerItem extends StatefulWidget { final bool sideArrow; final Widget count; DrawerItem(this.title, this.icon, - {this.textColor = Colors.black, - this.iconColor = Colors.black87, + {this.textColor, + this.iconColor, this.subTitle = '', this.bottomLine = true, this.count, @@ -48,7 +49,9 @@ class _DrawerItemState extends State { flex: 1, child: Icon( widget.icon, - color: widget.iconColor, + color: widget.iconColor == null + ? Theme.of(context).textTheme.bodyText1.color + : widget.iconColor, size: SizeConfig.imageSizeMultiplier * 5, )), Expanded( @@ -59,18 +62,16 @@ class _DrawerItemState extends State { children: [ Row( children: [ - Texts( + AppText( widget.title, - color: widget.textColor, fontSize: SizeConfig.textMultiplier * 2.3, ), widget.count ?? SizedBox(), ], ), widget.subTitle != '' - ? Texts( + ? AppText( widget.subTitle, - color: widget.textColor, fontSize: SizeConfig.textMultiplier * 2.5, ) : SizedBox(), diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 56c7fc0c..bcd74ed1 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -148,7 +148,9 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { backgroundColor: isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, textTheme: TextTheme( - headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + headline6: TextStyle( + color: Theme.of(context).textTheme.headline1.color, + fontWeight: FontWeight.bold), ), title: Text( authenticatedUserObject.isLogin || !isShowDecPage @@ -156,7 +158,7 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { : TranslationBase.of(context).serviceInformationTitle, style: TextStyle( fontWeight: FontWeight.bold, - color: Colors.white, + color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), leading: Builder( builder: (BuildContext context) { @@ -168,14 +170,14 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { isPharmacy ? IconButton( icon: Icon(Icons.shopping_cart), - color: Colors.white, + color: Theme.of(context).textTheme.headline1.color, onPressed: () { Navigator.of(context).popUntil(ModalRoute.withName('/')); }) : Container(), IconButton( icon: Icon(FontAwesomeIcons.home), - color: Colors.white, + color: Theme.of(context).textTheme.headline1.color, onPressed: () { Navigator.pushAndRemoveUntil( context, diff --git a/lib/widgets/others/arrow_back.dart b/lib/widgets/others/arrow_back.dart index f20e060f..d88f9d83 100644 --- a/lib/widgets/others/arrow_back.dart +++ b/lib/widgets/others/arrow_back.dart @@ -16,7 +16,8 @@ class ArrowBack extends StatelessWidget { onTap: Feedback.wrapForTap(() { onTap != null ? onTap() : Navigator.pop(context); }, context), - child: Icon(Icons.arrow_back_ios, color: Colors.white), + child: Icon(Icons.arrow_back_ios, + color: Theme.of(context).textTheme.headline1.color), ); } } diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index d795fd48..9a3dad6d 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -1017,13 +1017,20 @@ class _MyStatefulBuilderState extends State { Expanded( flex: 1, child: Center( - child: Text(searchText != null && searchText != 'null' + child: Image.asset( + 'assets/images/soundWaveAnimation.gif', + height: 75, + ))), + Expanded( + flex: 1, + child: Center( + child: AppText(searchText != null && searchText != 'null' ? searchText : TranslationBase.of(context).trySaying))), searchText == 'null' ? Center( child: RaisedButton( - child: Text('Retry'), + child: AppText('Retry'), onPressed: () { RoboSearch.closeAlertDialog(context); event.setValue({'startPopUp': 'true'}); diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 75c51da3..5faf6940 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -9,6 +9,8 @@ import 'dart:math'; import 'package:provider/provider.dart'; +import 'package:sms_otp_auto_verify/sms_otp_auto_verify.dart'; + class SMSOTP { final type; final mobileNo; @@ -52,9 +54,10 @@ class SMSOTP { String errorMsg; ProjectViewModel projectProvider; String displayTime = ''; - + String _code; + dynamic setState; + static String signature; displayDialog(BuildContext context) async { - return showDialog( context: context, builder: (context) { @@ -78,10 +81,11 @@ class SMSOTP { if (displayTime == '') { startTimer(setState); } + return Container( color: Colors.white, height: SizeConfig.realScreenHeight * 0.5, - width: SizeConfig.realScreenWidth * 0.8, + width: SizeConfig.realScreenWidth, child: Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -99,121 +103,151 @@ class SMSOTP { .substring(mobileNo.toString().length - 3), textAlign: TextAlign.center, )), - Form( - key: verifyAccountForm, - child: Padding( - padding: EdgeInsets.only(top: 20), - child: Directionality( - textDirection:TextDirection.ltr, - child:Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - width: SizeConfig.realScreenWidth * 0.15, - child: TextFormField( - textInputAction: TextInputAction.next, - style: buildTextStyle(), - autofocus: true, - maxLength: 1, - controller: digit1, - textAlign: TextAlign.center, - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) {}, - validator: validateCodeDigit, - onFieldSubmitted: (_) { - FocusScope.of(context).requestFocus(focusD2); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD2); - verifyAccountFormValue['digit1'] = - val.trim(); - checkValue(); - } - }, - ), - ), - Container( - width: SizeConfig.realScreenWidth * 0.15, - child: TextFormField( - focusNode: focusD2, - textInputAction: TextInputAction.next, - maxLength: 1, - controller: digit2, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) {}, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD3); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD3); - verifyAccountFormValue['digit2'] = - val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit), - ), - Container( - width: SizeConfig.realScreenWidth * 0.15, - child: TextFormField( - focusNode: focusD3, - textInputAction: TextInputAction.next, - maxLength: 1, - controller: digit3, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) {}, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD4); - verifyAccountFormValue['digit3'] = - val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit)), - Container( - width: SizeConfig.realScreenWidth * 0.15, - child: TextFormField( - focusNode: focusD4, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - controller: digit4, - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, - onChanged: (val) { - if (val.length == 1) { - verifyAccountFormValue['digit4'] = - val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit)), - ], + + Directionality( + textDirection: TextDirection.ltr, + child: TextFieldPin( + filled: true, + filledColor: Colors.grey[100], + codeLength: 4, + filledAfterTextChange: true, + boxSize: 50, + margin: 10, + borderStyeAfterTextChange: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10)), + borderSide: BorderSide(color: Colors.black), + ), + borderStyle: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10)), + borderSide: BorderSide(color: Colors.black), + ), + onOtpCallback: (code, isAutofill) => + _onOtpCallBack(code, isAutofill), )), - ), - ), + // Form( + // key: verifyAccountForm, + // child: Padding( + // padding: EdgeInsets.only(top: 20), + // child: Directionality( + // textDirection: TextDirection.ltr, + // child: + // // Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // children: [ + // Container( + + // child: , + // ) + // Container( + // width: SizeConfig.realScreenWidth * 0.15, + // child: TextFormField( + // textInputAction: TextInputAction.next, + // style: buildTextStyle(), + // autofocus: true, + // maxLength: 1, + // controller: digit1, + // textAlign: TextAlign.center, + // keyboardType: TextInputType.number, + // decoration: buildInputDecoration(context), + // onSaved: (val) {}, + // validator: validateCodeDigit, + // onFieldSubmitted: (_) { + // FocusScope.of(context) + // .requestFocus(focusD2); + // }, + // onChanged: (val) { + // if (val.length == 1) { + // FocusScope.of(context) + // .requestFocus(focusD2); + // verifyAccountFormValue['digit1'] = + // val.trim(); + // checkValue(); + // } + // }, + // ), + // ), + // Container( + // width: SizeConfig.realScreenWidth * 0.15, + // child: TextFormField( + // focusNode: focusD2, + // textInputAction: TextInputAction.next, + // maxLength: 1, + // controller: digit2, + // textAlign: TextAlign.center, + // style: buildTextStyle(), + // keyboardType: TextInputType.number, + // decoration: buildInputDecoration(context), + // onSaved: (val) {}, + // onFieldSubmitted: (_) { + // FocusScope.of(context) + // .requestFocus(focusD3); + // }, + // onChanged: (val) { + // if (val.length == 1) { + // FocusScope.of(context) + // .requestFocus(focusD3); + // verifyAccountFormValue['digit2'] = + // val.trim(); + // checkValue(); + // } + // }, + // validator: validateCodeDigit), + // ), + // Container( + // width: SizeConfig.realScreenWidth * 0.15, + // child: TextFormField( + // focusNode: focusD3, + // textInputAction: TextInputAction.next, + // maxLength: 1, + // controller: digit3, + // textAlign: TextAlign.center, + // style: buildTextStyle(), + // keyboardType: TextInputType.number, + // decoration: + // buildInputDecoration(context), + // onSaved: (val) {}, + // onFieldSubmitted: (_) { + // FocusScope.of(context) + // .requestFocus(focusD4); + // }, + // onChanged: (val) { + // if (val.length == 1) { + // FocusScope.of(context) + // .requestFocus(focusD4); + // verifyAccountFormValue['digit3'] = + // val.trim(); + // checkValue(); + // } + // }, + // validator: validateCodeDigit)), + // Container( + // width: SizeConfig.realScreenWidth * 0.15, + // child: TextFormField( + // focusNode: focusD4, + // maxLength: 1, + // textAlign: TextAlign.center, + // style: buildTextStyle(), + // controller: digit4, + // keyboardType: TextInputType.number, + // decoration: + // buildInputDecoration(context), + // onFieldSubmitted: (_) { + // FocusScope.of(context) + // .requestFocus(focusD4); + // }, + // onChanged: (val) { + // if (val.length == 1) { + // verifyAccountFormValue['digit4'] = + // val.trim(); + // checkValue(); + // } + // }, + // validator: validateCodeDigit)), + // ], + //)), + //), + //), + SizedBox(height: 20), Padding( padding: EdgeInsets.only(top: 10), child: AppText( @@ -274,9 +308,11 @@ class SMSOTP { checkValue() { //print(verifyAccountFormValue); if (verifyAccountForm.currentState.validate()) { - onSuccess(digit1.text.toString()+digit2.text.toString()+digit3.text.toString()+digit4.text.toString()); + onSuccess(digit1.text.toString() + + digit2.text.toString() + + digit3.text.toString() + + digit4.text.toString()); } - } getSecondsAsDigitalClock(int inputSeconds) { @@ -311,7 +347,7 @@ class SMSOTP { static void showLoadingDialog(BuildContext context, bool _loading) async { _context = context; - + //setSignature(); if (_loading == false) { Navigator.of(context).pop(); return; @@ -338,4 +374,14 @@ class SMSOTP { static void hideSMSBox(context) { Navigator.pop(context); } + + _onOtpCallBack(String otpCode, bool isAutofill) { + if (otpCode.length == 4) { + onSuccess(otpCode); + } + } + + static getSignature() async { + return await SmsRetrieved.getAppSignature(); + } } diff --git a/lib/widgets/text/app_texts_widget.dart b/lib/widgets/text/app_texts_widget.dart index bba514be..e3c6af9a 100644 --- a/lib/widgets/text/app_texts_widget.dart +++ b/lib/widgets/text/app_texts_widget.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; // OWNER : Ibrahim albitar // DATE : 12-04-2020 @@ -22,11 +24,11 @@ class AppText extends StatefulWidget { final Color backGroundcolor; final bool underline; AppText(this.data, - {this.color = Colors.black, + {this.color, this.fontWeight = FontWeight.normal, this.fontSize, // this.fontFamily = 'WorkSans', - this.fontFamily, + this.fontFamily, this.margin, this.marginTop = 0, this.marginRight = 0, @@ -44,6 +46,7 @@ class AppText extends StatefulWidget { class _AppTextState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Visibility( visible: widget.visibility, child: Container( @@ -59,10 +62,16 @@ class _AppTextState extends State { textAlign: widget.textAlign, overflow: TextOverflow.clip, style: TextStyle( - color: widget.color, + color: widget.color == null + ? Theme.of(context).textTheme.bodyText1.color + : widget.color, fontWeight: widget.fontWeight, fontSize: widget.fontSize ?? (SizeConfig.textMultiplier * 2), - fontFamily: widget.fontFamily, + fontFamily: widget.fontFamily == null + ? projectViewModel.isArabic + ? 'Cairo' + : 'WorkSans' + : widget.fontFamily, decoration: widget.underline == true ? TextDecoration.underline : TextDecoration.none diff --git a/lib/widgets/typewriter/typewiter.dart b/lib/widgets/typewriter/typewiter.dart index cc258251..a86cc9f0 100644 --- a/lib/widgets/typewriter/typewiter.dart +++ b/lib/widgets/typewriter/typewiter.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/material.dart'; class TyperAnimatedTextKit extends StatefulWidget { @@ -64,9 +65,9 @@ class _TyperState extends State animation: _characterCount, builder: (BuildContext context, Widget child) { String text = widget.text.substring(0, _characterCount.value); - return Text( + return AppText( text, - style: TextStyle(color: Colors.black, fontSize: 12), + fontSize: 12, textAlign: TextAlign.start, ); }, diff --git a/pubspec.yaml b/pubspec.yaml index 22f081c2..4bdf1476 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -87,7 +87,7 @@ dependencies: # Qr code Scanner TODO fix it # barcode_scanner: ^1.0.1 - barcode_scan: any + barcode_scan: ^2.0.0 flutter_polyline_points: ^0.1.0 location: ^2.3.5 # Qr code Scanner @@ -169,7 +169,7 @@ dependencies: flutter_tts: path: flutter_tts-voice_enhancement # flutter_tts: ^1.2.6 - + sms_otp_auto_verify: ^1.2.2 wifi: ^0.1.5 vibration: ^1.7.3