From 70614d35556b75a1e5c554c974df5e80a2932cd8 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 9 Aug 2021 17:48:55 +0300 Subject: [PATCH] merge improvements-1. --- lib/config/localized_values.dart | 1 + lib/pages/landing/landing_page.dart | 32 +-- lib/pages/login/confirm-login.dart | 219 ++++++++++++-------- lib/pages/login/welcome.dart | 54 +++-- lib/widgets/others/app_scaffold_widget.dart | 64 +++++- lib/widgets/others/not_auh_page.dart | 89 +++++++- 6 files changed, 305 insertions(+), 154 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 04c1fbf0..c3035621 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -132,6 +132,7 @@ const Map localizedValues = { "verify-with-faceid": {"en": "Face ID", "ar": "معرف الوجه"}, "verify-with-sms": {"en": "SMS", "ar": "الرسائل القصيرة"}, "verify-with-whatsapp": {"en": "Whatsapp", "ar": " الواتس اب"}, + "verify-through": {"en": "Verify Through", "ar": " تحقق من خلال"}, "last-login": {"en": "LAST LOGIN AT:", "ar": "آخر تسجيل دخول"}, "last-login-with": {"en": "VERIFICATION TYPE:", "ar": "نوع التحقق:"}, "verify-fingerprint": { diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 412ca4a6..e90c36d2 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -98,7 +98,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { LocationUtils locationUtils; changeCurrentTab(int tab) { - if (!projectViewModel.isLogin) { if (tab == 3) { List imagesInfo = []; @@ -234,8 +233,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (token != null && DEVICE_TOKEN == "") { DEVICE_TOKEN = token; checkUserStatus(token); - if (projectViewModel.isLogin) - this.getNotificationCount(DEVICE_TOKEN); + if (projectViewModel.isLogin) this.getNotificationCount(DEVICE_TOKEN); } }); if (results[Permission.location].isGranted) ; @@ -451,9 +449,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { GifLoaderDialogUtils.showMyDialog(context); - authService - .selectDeviceImei(DEVICE_TOKEN) - .then((SelectDeviceIMEIRES value) { + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { setUserValues(value); @@ -483,13 +479,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (value != null) { setState(() { - notificationCount = value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] > - 99 - ? '99+' - : value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] - .toString(); + notificationCount = + value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); }) @@ -611,14 +602,13 @@ class _LandingPageState extends State with WidgetsBindingObserver { index: currentTab, ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - floatingActionButton: - (projectViewModel.havePrivilege(34) && currentTab == 0) - ? FloatingButton( - elevation: true, - onTap: () { - changeCurrentTab(2); - }) - : null); + floatingActionButton: (projectViewModel.havePrivilege(34) && currentTab == 0) + ? FloatingButton( + elevation: true, + onTap: () { + changeCurrentTab(2); + }) + : null); } triggerRobot() { diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index bde18174..721139cc 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -117,110 +117,145 @@ class _ConfirmLogin extends State { physics: BouncingScrollPhysics(), children: [ SizedBox(height: 12), - Text( - TranslationBase.of(context).welcomeBack, - style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), - ), - Text( - user.name.toLowerCase().capitalizeFirstofEach, - style: TextStyle(fontSize: 24, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Color(0xff2B353E), height: 1, letterSpacing: -1.44), - ), - SizedBox(height: 10), - Text( - TranslationBase.of(context).accountInfo, - style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16), - ), - Container( - height: 72, - margin: EdgeInsets.only(top: 23, bottom: 23), - alignment: Alignment.center, - padding: EdgeInsets.only(left: 17, right: 12), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: Column( + if (user != null) + Column( mainAxisSize: MainAxisSize.min, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - TranslationBase.of(context).lastLoginAt.toCamelCase, - style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), - ), - Text( - user.editedOn != null - ? formatDateToDate(DateUtil.convertStringToDate(user.editedOn)) - : user.createdOn != null - ? formatDateToDate(DateUtil.convertStringToDate(user.createdOn)) - : '--', - style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), - ), - ], + Text( + TranslationBase.of(context).welcomeBack, + style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - TranslationBase.of(context).lastLoginWith.toCamelCase, - style: TextStyle( - fontSize: 10, - fontFamily: "Poppins", - fontWeight: FontWeight.w600, - color: Color(0xff575757), - ), + Text( + user.name.toLowerCase().capitalizeFirstofEach, + style: TextStyle(fontSize: 24, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Color(0xff2B353E), height: 1, letterSpacing: -1.44), + ), + SizedBox(height: 10), + Text( + TranslationBase.of(context).accountInfo, + style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16), + ), + Container( + height: 72, + margin: EdgeInsets.only(top: 23, bottom: 23), + alignment: Alignment.center, + padding: EdgeInsets.only(left: 17, right: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), - Text( - " " + getType(user.logInType, context), - style: TextStyle( - fontSize: 12, - fontFamily: "Poppins", - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + TranslationBase.of(context).lastLoginAt.toCamelCase, + style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), + ), + Text( + user.editedOn != null + ? formatDateToDate(DateUtil.convertStringToDate(user.editedOn)) + : user.createdOn != null + ? formatDateToDate(DateUtil.convertStringToDate(user.createdOn)) + : '--', + style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], ), - ), - Expanded(child: SizedBox()), - Text( - user.editedOn != null - ? formatDateToTime(DateUtil.convertStringToDate(user.editedOn)) - : user.createdOn != null - ? formatDateToTime(DateUtil.convertStringToDate(user.createdOn)) - : '--', - style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48), - ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + TranslationBase.of(context).lastLoginWith.toCamelCase, + style: TextStyle( + fontSize: 10, + fontFamily: "Poppins", + fontWeight: FontWeight.w600, + color: Color(0xff575757), + ), + ), + Text( + " " + getType(user.logInType, context), + style: TextStyle( + fontSize: 12, + fontFamily: "Poppins", + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + ), + ), + Expanded(child: SizedBox()), + Text( + user.editedOn != null + ? formatDateToTime(DateUtil.convertStringToDate(user.editedOn)) + : user.createdOn != null + ? formatDateToTime(DateUtil.convertStringToDate(user.createdOn)) + : '--', + style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48), + ), + ], + ) + ], + ), + ), + Text( + TranslationBase.of(context).pleaseVerify, + style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), + ), + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 9), + shrinkWrap: true, + children: [ + getButton(3), + getButton(2), + getButton(1), + getButton(4), ], ) ], - ), - ), - Text( - TranslationBase.of(context).pleaseVerify, - style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), - ), - GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), - physics: NeverScrollableScrollPhysics(), - padding: EdgeInsets.only(top: 9), - shrinkWrap: true, - children: [ - getButton(3), - getButton(2), - getButton(1), - getButton(4), - ], - ) + ) + else + Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ + Image.asset( + 'assets/images/habib-logo.png', + height: 90, + width: 90, + ), + this.onlySMSBox == false + ? Texts( + TranslationBase.of(context).verifyLoginWith, + fontSize: SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.left, + ) + : Texts( + TranslationBase.of(context).verifyFingerprint2, + fontSize: SizeConfig.textMultiplier * 2.5, + textAlign: TextAlign.start, + ), + onlySMSBox == false + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [Expanded(child: getButton(3)), Expanded(child: getButton(2))], + ) + : SizedBox(), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [Expanded(child: getButton(1)), Expanded(child: getButton(4))], + ), + ]), ], ), ), SizedBox( - height: 12, // todo discuss + height: 12, ), SizedBox( height: 43, diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 6a007e0a..7e37f621 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -30,37 +30,35 @@ class _WelcomeLogin extends State { appBarTitle: TranslationBase.of(context).welcome, isShowDecPage: false, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: false, body: Padding( padding: EdgeInsets.all(20), child: Column( children: [ Expanded( flex: 6, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset('assets/images/DQ/logo.png', - height: 90, width: 90), - AppText( - TranslationBase.of(context).welcome, - fontSize: 30, - fontWeight: FontWeight.bold, - ), - AppText( - TranslationBase.of(context).welcomeText, - fontSize: 24, - textAlign: TextAlign.start, - ), - AppText( - TranslationBase.of(context).welcomeText2, - fontSize: 24, - textAlign: TextAlign.start, - ), - SizedBox( - height: SizeConfig.realScreenHeight * .15, - ) - ]), + child: Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ + Image.asset('assets/images/DQ/logo.png', height: 90, width: 90), + AppText( + TranslationBase.of(context).welcome, + fontSize: 30, + fontWeight: FontWeight.bold, + ), + AppText( + TranslationBase.of(context).welcomeText, + fontSize: 24, + textAlign: TextAlign.start, + ), + AppText( + TranslationBase.of(context).welcomeText2, + fontSize: 24, + textAlign: TextAlign.start, + ), + SizedBox( + height: SizeConfig.realScreenHeight * .15, + ) + ]), ), Expanded( flex: 2, @@ -74,8 +72,7 @@ class _WelcomeLogin extends State { child: DefaultButton( TranslationBase.of(context).yes, () => { - Navigator.of(context) - .push(FadePage(page: LoginType())), + Navigator.of(context).push(FadePage(page: LoginType())), }, color: Color(0xFFc5272c), textColor: Colors.white, @@ -88,8 +85,7 @@ class _WelcomeLogin extends State { child: DefaultButton( TranslationBase.of(context).no, () => { - Navigator.of(context) - .push(FadePage(page: Register())), + Navigator.of(context).push(FadePage(page: Register())), }, )) ], diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 6066ed5e..dcef2c67 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -40,6 +40,8 @@ class AppScaffold extends StatelessWidget { final Widget bottomSheet; final bool isLoading; final bool isShowAppBar; + final bool showNewAppBar; + final bool showNewAppBarTitle; final bool hasAppBarParam; final BaseViewModel baseViewModel; final bool isBottomBar; @@ -67,6 +69,8 @@ class AppScaffold extends StatelessWidget { this.appBarTitle = '', this.isLoading = false, this.isShowAppBar = false, + this.showNewAppBar = false, + this.showNewAppBarTitle = false, this.hasAppBarParam, this.bottomSheet, this.baseViewModel, @@ -98,18 +102,23 @@ class AppScaffold extends StatelessWidget { AppGlobal.context = context; return Scaffold( backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, - appBar: isShowAppBar - ? appBar = AppBarWidget( - appBarTitle: appBarTitle, - appBarIcons: appBarIcons, - showHomeAppBarIcon: showHomeAppBarIcon, - isPharmacy: isPharmacy, - showPharmacyCart: showPharmacyCart, - isOfferPackages: isOfferPackages, - showOfferPackagesCart: showOfferPackagesCart, - isShowDecPage: isShowDecPage, + appBar: showNewAppBar + ? NewAppBarWidget( + title: appBarTitle, + showTitle: showNewAppBarTitle, ) - : null, + : (isShowAppBar + ? appBar = AppBarWidget( + appBarTitle: appBarTitle, + appBarIcons: appBarIcons, + showHomeAppBarIcon: showHomeAppBarIcon, + isPharmacy: isPharmacy, + showPharmacyCart: showPharmacyCart, + isOfferPackages: isOfferPackages, + showOfferPackagesCart: showOfferPackagesCart, + isShowDecPage: isShowDecPage, + ) + : null), bottomSheet: bottomSheet, body: SafeArea( top: true, @@ -142,6 +151,39 @@ class AppScaffold extends StatelessWidget { } } +class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { + final bool showTitle; + final String title; + NewAppBarWidget({Key key, this.showTitle = false, this.title = ""}) : super(key: key); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return AppBar( + elevation: 0, + backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + title: Row( + children: [ + ArrowBack(), + if (showTitle) + Expanded( + child: Text( + title, + maxLines: 1, + style: TextStyle( + fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24), + ), + ) + ], + ), + ); + } + + @override + Size get preferredSize => Size(double.maxFinite, 60); +} + class AppBarWidget extends StatefulWidget with PreferredSizeWidget { final AuthenticatedUserObject authenticatedUserObject = locator(); diff --git a/lib/widgets/others/not_auh_page.dart b/lib/widgets/others/not_auh_page.dart index 9bef623b..e5ea9845 100644 --- a/lib/widgets/others/not_auh_page.dart +++ b/lib/widgets/others/not_auh_page.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -33,7 +34,93 @@ class _NotAutPageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return Scaffold( + return AppScaffold( + appBarTitle: widget.title, + isShowDecPage: false, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: false, + body: Padding( + padding: EdgeInsets.only(bottom: 20, left: 21, right: 21), + child: Column(children: [ + Expanded( + child: ListView( + padding: EdgeInsets.zero, + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 12), + if (widget.icon != null) + Align( + alignment: Alignment.centerLeft, + child: SvgPicture.asset( + widget.icon, + height: 35, + width: 35, + ), + ), + SizedBox(height: 16), + Text( + widget.title, + style: TextStyle(fontSize: 24, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 23 / 24), + ), + Text( + widget.description, + style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56, height: 21 / 14), + ), + SizedBox( + height: 14, + ), + if (!projectViewModel.isInternetConnection) + Center( + child: SizedBox( + height: MediaQuery.of(context).size.height * 0.55, + width: MediaQuery.of(context).size.width * 0.50, + child: Image.asset(projectViewModel.isArabic ? 'assets/images/Wifi-AR.png' : 'assets/images/wifi-EN.png'), + ), + ), + if (projectViewModel.isInternetConnection && widget.imagesInfo != null) + CarouselSlider( + items: widget.imagesInfo.map((image) { + return Builder( + builder: (BuildContext context) { + return SizedBox( + width: MediaQuery.of(context).size.width * 0.50, + child: image.isAsset ? Image.asset(projectViewModel.isArabic ? image.imageAr : image.imageEn) : Image.network(projectViewModel.isArabic ? image.imageAr : image.imageEn)); + }, + ); + }).toList(), + options: CarouselOptions( + height: MediaQuery.of(context).size.height * 0.55, + autoPlay: widget.imagesInfo.length > 1, + viewportFraction: 1.0, + ), + ), + ], + ), + ), + SizedBox( + height: 43, + width: double.infinity, + child: FlatButton( + onPressed: () { + loginCheck(context); + }, + child: Text( + TranslationBase.of(context).loginregister, + style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), + ), + // color: Color(0xffD02127), + color: Color(0xffD02127), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), + ), + ), + ]), + ), + ); + + Scaffold( backgroundColor: Color(0xfff8f8f8), resizeToAvoidBottomPadding: false, appBar: AppBar(