diff --git a/lib/main.dart b/lib/main.dart index 424b6c9a..548ca38e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,7 @@ import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:firebase_analytics/firebase_analytics.dart'; -import 'package:firebase_analytics/observer.dart'; +import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -21,7 +21,6 @@ import 'locator.dart'; import 'pages/pharmacies/compare-list.dart'; import 'package:firebase_core/firebase_core.dart'; - void main() async { WidgetsFlutterBinding.ensureInitialized(); FirebaseApp defaultApp = await Firebase.initializeApp(); @@ -36,7 +35,6 @@ class MyApp extends StatefulWidget { } class _MyApp extends State { - @override void initState() { // ProjectViewModel projectProvider; @@ -52,11 +50,9 @@ class _MyApp extends State { PlatformBridge.init(context); LocalNotification.init(onNotificationClick: (payload) { - LocalNotification.getInstance() - .showNow(title: "Payload", subtitle: payload, payload: payload); + LocalNotification.getInstance().showNow(title: "Payload", subtitle: payload, payload: payload); }); - SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, @@ -73,27 +69,24 @@ class _MyApp extends State { ChangeNotifierProvider( create: (context) => ProjectViewModel(), ), - ChangeNotifierProvider( - create: (context) => ToDoCountProviderModel()), - ChangeNotifierProvider( - create: (context) => SearchProvider()), + ChangeNotifierProvider( + create: (context) => DashboardViewModel(), + ), + ChangeNotifierProvider(create: (context) => ToDoCountProviderModel()), + ChangeNotifierProvider(create: (context) => SearchProvider()), ChangeNotifierProvider.value( value: SearchProvider(), ), - ChangeNotifierProvider( - create: (context) => ThemeNotifier(defaultTheme())), + ChangeNotifierProvider(create: (context) => ThemeNotifier(defaultTheme())), StreamProvider.value( value: RobotProvider().intStream(), initialData: RobotProvider().setValue({}), ), - ChangeNotifierProvider( - create: (context) => CompareList()), + ChangeNotifierProvider(create: (context) => CompareList()), ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( - navigatorObservers: [ - GAnalytics.shared.navObserver() - ], + navigatorObservers: [GAnalytics.shared.navObserver()], showSemanticsDebugger: false, title: 'Diplomatic Quarter App', locale: projectProvider.appLocal, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index b64d2330..e686ed5a 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -64,8 +64,7 @@ class _HomePageState extends State { width: double.infinity, height: 210, decoration: BoxDecoration( - image: DecorationImage( - image: ExactAssetImage('assets/images/dashboard_top_bg.png'), fit: BoxFit.cover), + image: DecorationImage(image: ExactAssetImage('assets/images/dashboard_top_bg.png'), fit: BoxFit.cover), ), child: Stack( children: [ @@ -84,8 +83,7 @@ class _HomePageState extends State { margin: EdgeInsets.all(5), decoration: BoxDecoration( image: DecorationImage( - image: - AssetImage("assets/images/new-design/covid_bg_transparent.png"), + image: AssetImage("assets/images/new-design/covid_bg_transparent.png"), fit: BoxFit.fill, ), color: Colors.white.withOpacity(0.3), @@ -115,10 +113,7 @@ class _HomePageState extends State { margin: EdgeInsets.only( top: 15.0, ), - child: SvgPicture.asset( - 'assets/images/new-design/covid-19-car.svg', - width: 45.0, - height: 45.0), + child: SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 45.0, height: 45.0), ), Container( margin: EdgeInsets.only(top: 5.0), @@ -140,12 +135,11 @@ class _HomePageState extends State { textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), - onPressed: - (model.user != null && model.user.outSA == 1) - ? () {} - : () { - navigateToCovidDriveThru(); - }, + onPressed: (model.user != null && model.user.outSA == 1) + ? () {} + : () { + navigateToCovidDriveThru(); + }, child: Center( child: Center( child: Center( @@ -177,13 +171,9 @@ class _HomePageState extends State { height: 125, padding: EdgeInsets.all(15), margin: EdgeInsets.all(5), - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.3), - borderRadius: BorderRadius.all(Radius.circular(5))), + decoration: BoxDecoration(color: Colors.white.withOpacity(0.3), borderRadius: BorderRadius.all(Radius.circular(5))), child: SvgPicture.asset( - projectViewModel.isArabic - ? 'assets/images/new-design/livecare_arabic_logo.svg' - : 'assets/images/new-design/liveCare_white_logo.svg', + projectViewModel.isArabic ? 'assets/images/new-design/livecare_arabic_logo.svg' : 'assets/images/new-design/liveCare_white_logo.svg', ), ), ), @@ -200,10 +190,8 @@ class _HomePageState extends State { ), Positioned( top: 155, - left: MediaQuery.of(context).size.width * - (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03), - right: MediaQuery.of(context).size.width * - (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03), + left: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03), + right: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03), child: (!model.isLogin) ? Container( width: double.infinity, @@ -213,8 +201,7 @@ class _HomePageState extends State { shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all(Radius.circular(9)), - image: DecorationImage( - image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)), + image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)), child: Container( margin: EdgeInsets.all(5), child: Column( @@ -235,8 +222,7 @@ class _HomePageState extends State { fontSize: 16, ), Align( - alignment: - projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, + alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, child: InkWell( onTap: () { widget.goToMyProfile(); @@ -274,8 +260,7 @@ class _HomePageState extends State { shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all(Radius.circular(9)), - image: DecorationImage( - image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover), + image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover), ), child: Container( margin: EdgeInsets.all(5), @@ -302,8 +287,7 @@ class _HomePageState extends State { ), Container( margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), - child: SvgPicture.asset( - "assets/images/new-design/verification_check.svg"), + child: SvgPicture.asset("assets/images/new-design/verification_check.svg"), ), ], ) @@ -318,8 +302,7 @@ class _HomePageState extends State { ), Container( margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), - child: SvgPicture.asset( - "assets/images/new-design/pending.svg"), + child: SvgPicture.asset("assets/images/new-design/pending.svg"), ), ], ) @@ -407,8 +390,7 @@ class _HomePageState extends State { width: 25, height: 40, ), - Texts('${model.weightKg} ${TranslationBase.of(context).kg}', - color: Colors.white, fontSize: 17) + Texts('${model.weightKg} ${TranslationBase.of(context).kg}', color: Colors.white, fontSize: 17) ], ), ), @@ -465,9 +447,7 @@ class _HomePageState extends State { ), ), ), - if (projectViewModel.havePrivilege(64) || - projectViewModel.havePrivilege(65) || - projectViewModel.havePrivilege(67)) + if (projectViewModel.havePrivilege(64) || projectViewModel.havePrivilege(65) || projectViewModel.havePrivilege(67)) Container( margin: EdgeInsets.only(left: 15, right: 15), child: Row( @@ -487,9 +467,7 @@ class _HomePageState extends State { }, child: Center( child: Padding( - padding: (model.user != null && model.user.outSA == 1) - ? const EdgeInsets.all(0.0) - : const EdgeInsets.all(15.0), + padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0), child: (model.user != null && model.user.outSA == 1) ? Container( width: double.infinity, @@ -526,13 +504,10 @@ class _HomePageState extends State { ), if (projectViewModel.havePrivilege(65)) DashboardItem( - onTap: () => - (model.user != null && model.user.outSA == 1) ? () {} : getPharmacyToken(model), + onTap: () => (model.user != null && model.user.outSA == 1) ? () {} : getPharmacyToken(model), child: Center( child: Padding( - padding: (model.user != null && model.user.outSA == 1) - ? const EdgeInsets.all(0.0) - : const EdgeInsets.all(15.0), + padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0), child: (model.user != null && model.user.outSA == 1) ? Container( width: double.infinity, @@ -587,9 +562,7 @@ class _HomePageState extends State { }, child: Center( child: Padding( - padding: (model.user != null && model.user.outSA == 1) - ? const EdgeInsets.all(0.0) - : const EdgeInsets.all(15.0), + padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0), child: (model.user != null && model.user.outSA == 1) ? Container( width: double.infinity, @@ -867,17 +840,7 @@ class _HomePageState extends State { } class DashboardItem extends StatelessWidget { - const DashboardItem( - {this.hasBorder = false, - this.imageName, - @required this.child, - this.onTap, - Key key, - this.width, - this.height, - this.color, - this.opacity = 0.4, - this.hasColorFilter = true}) + const DashboardItem({this.hasBorder = false, this.imageName, @required this.child, this.onTap, Key key, this.width, this.height, this.color, this.opacity = 0.4, this.hasColorFilter = true}) : super(key: key); final bool hasBorder; final String imageName; @@ -907,15 +870,12 @@ class DashboardItem extends StatelessWidget { : HexColor('#050705').withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(6.0), - border: hasBorder - ? Border.all(width: 1.0, color: const Color(0xffcccccc)) - : Border.all(width: 0.0, color: Colors.transparent), + border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent), image: imageName != null ? DecorationImage( image: ExactAssetImage('assets/images/$imageName'), fit: BoxFit.cover, - colorFilter: - hasColorFilter ? new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn) : null, + colorFilter: hasColorFilter ? new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn) : null, ) : null, ), diff --git a/lib/pages/landing/home_page_2.dart b/lib/pages/landing/home_page_2.dart index 26416f79..5e786011 100644 --- a/lib/pages/landing/home_page_2.dart +++ b/lib/pages/landing/home_page_2.dart @@ -50,21 +50,6 @@ class _HomePageState2 extends State { physics: BouncingScrollPhysics(), child: Column( children: [ - // !model.isLogin - // ? HomePageFragment2( - // onPharmacyClick: () { - // getPharmacyToken(model); - // }, - // onLoginClick: () { - // widget.onLoginClick(); - // }, - // ) - // : LoggedHomePageFragment( - // projectViewModel, - // onPharmacyClick: () { - // getPharmacyToken(model); - // }, - // ), HomePageFragment2( model, onLoginClick: () { diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 2627133d..dc28a50a 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -157,8 +157,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController.jumpToPage(0); else if (tab != 0) { if (tab == 4 && model.count == 0) { - AppToast.showErrorToast( - message: TranslationBase.of(context).noBookedAppo); + AppToast.showErrorToast(message: TranslationBase.of(context).noBookedAppo); } else { pageController.jumpToPage(tab); } @@ -249,10 +248,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { } }); if (results[Permission.location].isGranted) ; - if (results[Permission.storage].isGranted) ; - if (results[Permission.camera].isGranted) ; - if (results[Permission.photos].isGranted) ; - if (results[Permission.accessMediaLocation].isGranted) ; + // if (results[Permission.storage].isGranted) ; + // if (results[Permission.camera].isGranted) ; + // if (results[Permission.photos].isGranted) ; + // if (results[Permission.accessMediaLocation].isGranted) ; // if (results[Permission.calendar].isGranted) ; }); @@ -387,11 +386,11 @@ class _LandingPageState extends State with WidgetsBindingObserver { var permissionResults = [ Permission.location, Permission.locationAlways, - Permission.storage, - Permission.camera, - Permission.photos, - Permission.notification, - Permission.accessMediaLocation, + // Permission.storage, + // Permission.camera, + // Permission.photos, + // Permission.notification, + // Permission.accessMediaLocation, // Permission.calendar, Permission.activityRecognition ].request(); diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index 2466cd02..abfb3e9f 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMe import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_page.dart'; +import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; @@ -43,7 +44,7 @@ class ServicesView extends StatelessWidget { } else if (index == 7) { Navigator.push(context, FadePage(page: H2OPage())); } else if (index == 8) { - Navigator.push(context, FadePage(page: FindUsPage())); + Navigator.push(context, FadePage(page: ContactUsPage())); } }, child: Container( diff --git a/lib/pages/medical/prescriptions/prescriptions_page.dart b/lib/pages/medical/prescriptions/prescriptions_page.dart index 2afc3dfc..215fba7f 100644 --- a/lib/pages/medical/prescriptions/prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_page.dart @@ -39,42 +39,9 @@ class PrescriptionsPage extends StatelessWidget { }), ], ), - // ...List.generate( - // prescriptionsViewModel.prescriptionsOrderList.length, - // (index) => AppExpandableNotifier( - // title: prescriptionsViewModel - // .prescriptionsOrderList[index].filterName, - // bodyWidget: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: prescriptionsViewModel - // .prescriptionsOrderList[index].prescriptionsList - // .map((prescriptions) { - // return InkWell( - // onTap: () => Navigator.push( - // context, - // FadePage( - // page: PrescriptionItemsPage(prescriptions: prescriptions,), - // ), - // ), - // child: DoctorCard( - // name: prescriptions.doctorName, - // profileUrl: prescriptions.doctorImageURL, - // rat: prescriptions.actualDoctorRate.toDouble(), - // subName: prescriptions.name, - // isInOutPatient: prescriptions.isInOutPatient, - // isLiveCareAppointment: prescriptions.isLiveCareAppointment, - // date:DateUtil.convertStringToDate(prescriptions.appointmentDate)//projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), - // ), - // ); - // }).toList(), - // )), - // ), ListView.separated( physics: NeverScrollableScrollPhysics(), shrinkWrap: true, - // padding: EdgeInsets.only(left: 21, right: 21), - separatorBuilder: (context, index) { return Container( height: 1, diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index bdb733c4..46d21fae 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -527,8 +528,8 @@ class _AppDrawerState extends State { switchUser(user, context) { GifLoaderDialogUtils.showMyDialog(context); this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser).then((value) { - GifLoaderDialogUtils.hideDialog(context); - Navigator.of(context).pop(); + // GifLoaderDialogUtils.hideDialog(context); + // Navigator.of(context).pop(); loginAfter(value, context); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -562,9 +563,9 @@ class _AppDrawerState extends State { await authenticatedUserObject.getUser(getUser: true); Provider.of(context, listen: false).user = authenticatedUserObject.user; Provider.of(context, listen: false).setUser(authenticatedUserObject.user); - await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { - if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser(); - }); + await pharmacyModuleViewModel.generatePharmacyToken(); + + if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser(); appointmentRateViewModel .getIsLastAppointmentRatedList()