diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 8793452a..b64d2330 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -40,8 +40,7 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - PharmacyModuleViewModel pharmacyModuleViewModel = - locator(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); @override Widget build(BuildContext context) { @@ -66,9 +65,7 @@ class _HomePageState extends State { height: 210, decoration: BoxDecoration( image: DecorationImage( - image: ExactAssetImage( - 'assets/images/dashboard_top_bg.png'), - fit: BoxFit.cover), + image: ExactAssetImage('assets/images/dashboard_top_bg.png'), fit: BoxFit.cover), ), child: Stack( children: [ @@ -77,131 +74,112 @@ class _HomePageState extends State { left: 5, right: 5, child: Container( - width: - MediaQuery.of(context).size.width * 0.8, + width: MediaQuery.of(context).size.width * 0.8, child: Row( children: [ Expanded( child: Container( - height: 125, - padding: EdgeInsets.all(5), - margin: EdgeInsets.all(5), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - "assets/images/new-design/covid_bg_transparent.png"), - fit: BoxFit.fill, - ), - color: - Colors.white.withOpacity(0.3), - borderRadius: BorderRadius.all( - Radius.circular(5))), - child: Container( - child: Column( - children: [ - Texts( - TranslationBase.of(context) - .covidTest, - color: Colors.white, - fontWeight: FontWeight.w700, + height: 125, + padding: EdgeInsets.all(5), + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + image: DecorationImage( + image: + AssetImage("assets/images/new-design/covid_bg_transparent.png"), + fit: BoxFit.fill, ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - children: [ - Container( - margin: EdgeInsets.only( - top: 15.0, - ), - child: SvgPicture.asset( - 'assets/images/new-design/covid-19-car.svg', - width: 45.0, - height: 45.0), + color: Colors.white.withOpacity(0.3), + borderRadius: BorderRadius.all(Radius.circular(5))), + child: (model.user != null && model.user.outSA == 1) + ? Container( + width: double.infinity, + height: double.infinity, + color: Colors.grey.shade500.withOpacity(0.3), + child: Icon( + Icons.lock_outline, + size: 40, ), - Container( - margin: EdgeInsets.only( - top: 5.0), - child: Column( - children: [ - Texts( - TranslationBase.of( - context) - .driveThru, - fontWeight: - FontWeight.w700, - color: Colors.white, - ), - ButtonTheme( - shape: - RoundedRectangleBorder( - borderRadius: - BorderRadius - .circular( - 5.0), + ) + : Container( + child: Column( + children: [ + Texts( + TranslationBase.of(context).covidTest, + color: Colors.white, + fontWeight: FontWeight.w700, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: EdgeInsets.only( + top: 15.0, + ), + child: SvgPicture.asset( + 'assets/images/new-design/covid-19-car.svg', + width: 45.0, + height: 45.0), ), - minWidth: MediaQuery.of( - context) - .size - .width * - 0.15, - height: 25.0, - child: RaisedButton( - color: Colors - .red[800], - textColor: - Colors.white, - disabledTextColor: - Colors.white, - disabledColor: - new Color( - 0xFFbcc2c4), - onPressed: () { - navigateToCovidDriveThru(); - }, - child: Center( - child: Center( - child: Center( - child: - Center( - child: - Texts( - TranslationBase.of(context) - .bookNow, - fontWeight: - FontWeight.w700, - color: Colors - .white, + Container( + margin: EdgeInsets.only(top: 5.0), + child: Column( + children: [ + Texts( + TranslationBase.of(context).driveThru, + fontWeight: FontWeight.w700, + color: Colors.white, + ), + ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.15, + height: 25.0, + child: RaisedButton( + color: Colors.red[800], + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: + (model.user != null && model.user.outSA == 1) + ? () {} + : () { + navigateToCovidDriveThru(); + }, + child: Center( + child: Center( + child: Center( + child: Center( + child: Texts( + TranslationBase.of(context).bookNow, + fontWeight: FontWeight.w700, + color: Colors.white, + ), + ), + ), + ), ), ), ), - ), + ], ), ), - ), - ], - ), + ], + ), + ], ), - ], - ), - ], - ), - ), - ), + )), ), Expanded( child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: LiveCareHome())), + onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())), child: Container( height: 125, padding: EdgeInsets.all(15), margin: EdgeInsets.all(5), decoration: BoxDecoration( - color: Colors.white - .withOpacity(0.3), - borderRadius: BorderRadius.all( - Radius.circular(5))), + 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' @@ -217,23 +195,15 @@ class _HomePageState extends State { ], ), ), - Container( - width: double.infinity, - height: projectViewModel.isArabic ? 110 : 80) + Container(width: double.infinity, height: projectViewModel.isArabic ? 110 : 80) ], ), Positioned( top: 155, left: MediaQuery.of(context).size.width * - (MediaQuery.of(context).orientation == - Orientation.landscape - ? 0.02 - : 0.03), + (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), + (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03), child: (!model.isLogin) ? Container( width: double.infinity, @@ -241,14 +211,10 @@ class _HomePageState extends State { decoration: BoxDecoration( color: HexColor('#A59E9E'), shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, width: 0.5), - borderRadius: - BorderRadius.all(Radius.circular(9)), + 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: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)), child: Container( margin: EdgeInsets.all(5), child: Column( @@ -264,37 +230,30 @@ class _HomePageState extends State { fontSize: 23, ), Texts( - TranslationBase.of(context) - .myMedicalFileSubTitle, + TranslationBase.of(context).myMedicalFileSubTitle, color: Colors.black, fontSize: 16, ), Align( - alignment: projectViewModel.isArabic - ? Alignment.bottomLeft - : Alignment.bottomRight, + alignment: + projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, child: InkWell( onTap: () { widget.goToMyProfile(); }, child: Container( - margin: EdgeInsets.only( - left: 15, right: 15), + margin: EdgeInsets.only(left: 15, right: 15), width: 90, height: 30, decoration: BoxDecoration( color: HexColor('#D81A2E'), shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, - width: 0.5), - borderRadius: BorderRadius.all( - Radius.circular(0)), + border: Border.all(color: Colors.transparent, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(0)), ), child: Center( child: Texts( - TranslationBase.of(context) - .viewMore, + TranslationBase.of(context).viewMore, color: Colors.white, fontWeight: FontWeight.w700, fontSize: 12, @@ -313,14 +272,10 @@ class _HomePageState extends State { decoration: BoxDecoration( color: HexColor('#A59E9E'), shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, width: 0.5), - borderRadius: - BorderRadius.all(Radius.circular(9)), + 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: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover), ), child: Container( margin: EdgeInsets.all(5), @@ -328,81 +283,51 @@ class _HomePageState extends State { children: [ Row( children: [ - if (projectViewModel.user != null && - model.isLogin) + if (projectViewModel.user != null && model.isLogin) Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 8, ), - model.user.cRSVerificationStatus == - 2 + model.user.cRSVerificationStatus == 2 ? Row( children: [ Texts( - model.user - .firstName + - " " + - model.user - .lastName, - color: Colors - .grey[100], + model.user.firstName + " " + model.user.lastName, + color: Colors.grey[100], bold: true, fontSize: 15, ), Container( - margin: EdgeInsets - .fromLTRB( - 8.0, - 0.0, - 8.0, - 0.0), + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), child: SvgPicture.asset( "assets/images/new-design/verification_check.svg"), ), ], ) - : model.user.cRSVerificationStatus == - 3 + : model.user.cRSVerificationStatus == 3 ? Row( children: [ Texts( - model.user - .firstName + - " " + - model.user - .lastName, - color: Colors - .grey[100], + model.user.firstName + " " + model.user.lastName, + color: Colors.grey[100], bold: true, fontSize: 15, ), Container( - margin: EdgeInsets - .fromLTRB( - 8.0, - 0.0, - 8.0, - 0.0), - child: SvgPicture - .asset( - "assets/images/new-design/pending.svg"), + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), + child: SvgPicture.asset( + "assets/images/new-design/pending.svg"), ), ], ) : Row( children: [ Texts( - model.user - .firstName + - " " + - model.user - .lastName, - color: Colors - .grey[100], + model.user.firstName + " " + model.user.lastName, + color: Colors.grey[100], bold: true, fontSize: 15, ), @@ -436,17 +361,14 @@ class _HomePageState extends State { decoration: BoxDecoration( color: HexColor('#D81A2E'), shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, - width: 0.5), + border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all( Radius.circular(5), ), ), child: Center( child: Texts( - TranslationBase.of(context) - .myMedicalFile, + TranslationBase.of(context).myMedicalFile, color: Colors.white, fontSize: 12, textAlign: TextAlign.center, @@ -485,10 +407,8 @@ 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) ], ), ), @@ -503,9 +423,7 @@ class _HomePageState extends State { width: 35, height: 40, ), - Texts('${model.booldType}', - color: Colors.white, - fontSize: 17) + Texts('${model.booldType}', color: Colors.white, fontSize: 17) ], ), ), @@ -519,12 +437,10 @@ class _HomePageState extends State { ], ), Padding( - padding: - const EdgeInsets.only(bottom: 15, right: 15, left: 15), + padding: const EdgeInsets.only(bottom: 15, right: 15, left: 15), child: InkWell( onTap: () { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => PackagesHomePage())); + Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage())); }, child: Container( decoration: BoxDecoration( @@ -571,13 +487,14 @@ class _HomePageState extends State { }, child: Center( child: Padding( - padding: const EdgeInsets.all(15.0), - child: (model.user != null && - model.user.outSA == 1) + 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, height: double.infinity, - color: Colors.grey.withOpacity(0.7), + color: Colors.grey.shade500.withOpacity(0.3), child: Icon( Icons.lock_outline, size: 40, @@ -594,14 +511,11 @@ class _HomePageState extends State { height: 10, ), Texts( - TranslationBase.of(context) - .homeHealthCare, + TranslationBase.of(context).homeHealthCare, textAlign: TextAlign.center, color: Colors.white, fontWeight: FontWeight.w700, - fontSize: - SizeConfig.textMultiplier * - 1.55, + fontSize: SizeConfig.textMultiplier * 1.55, ) ], )), @@ -613,18 +527,17 @@ class _HomePageState extends State { if (projectViewModel.havePrivilege(65)) DashboardItem( onTap: () => - (model.user != null && model.user.outSA == 1) - ? () {} - : getPharmacyToken(model), + (model.user != null && model.user.outSA == 1) ? () {} : getPharmacyToken(model), child: Center( child: Padding( - padding: const EdgeInsets.all(15.0), - child: (model.user != null && - model.user.outSA == 1) + 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, height: double.infinity, - color: Colors.grey.withOpacity(0.7), + color: Colors.grey.shade500.withOpacity(0.3), child: Icon( Icons.lock_outline, size: 40, @@ -647,14 +560,11 @@ class _HomePageState extends State { height: 20, ), Texts( - TranslationBase.of(context) - .onlinePharmacy, + TranslationBase.of(context).onlinePharmacy, textAlign: TextAlign.center, color: Colors.white, fontWeight: FontWeight.w700, - fontSize: - SizeConfig.textMultiplier * - 1.55, + fontSize: SizeConfig.textMultiplier * 1.55, ) ], ), @@ -677,13 +587,14 @@ class _HomePageState extends State { }, child: Center( child: Padding( - padding: const EdgeInsets.all(15.0), - child: (model.user != null && - model.user.outSA == 1) + 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, height: double.infinity, - color: Colors.grey.withOpacity(0.7), + color: Colors.grey.shade500.withOpacity(0.3), child: Icon( Icons.lock_outline, size: 40, @@ -700,14 +611,11 @@ class _HomePageState extends State { height: 10, ), Texts( - TranslationBase.of(context) - .cmcHeading, + TranslationBase.of(context).cmcHeading, textAlign: TextAlign.center, color: Colors.white, fontWeight: FontWeight.w700, - fontSize: - SizeConfig.textMultiplier * - 1.55, + fontSize: SizeConfig.textMultiplier * 1.55, ) ], )), @@ -723,8 +631,7 @@ class _HomePageState extends State { height: 8, ), InkWell( - onTap: () => - Navigator.push(context, FadePage(page: PaymentService())), + onTap: () => Navigator.push(context, FadePage(page: PaymentService())), child: Container( margin: EdgeInsets.only(left: 15, right: 15), child: Row( @@ -745,8 +652,7 @@ class _HomePageState extends State { height: 5, ), Texts( - TranslationBase.of(context) - .onlinePaymentService, + TranslationBase.of(context).onlinePaymentService, textAlign: TextAlign.center, color: Colors.black87, bold: false, @@ -777,8 +683,7 @@ class _HomePageState extends State { height: 10, ), Texts( - TranslationBase.of(context) - .offersAndPackages, + TranslationBase.of(context).offersAndPackages, textAlign: TextAlign.center, color: Colors.black87, bold: false, @@ -818,13 +723,11 @@ class _HomePageState extends State { height: 10, ), Texts( - TranslationBase.of(context) - .emergencyServices, + TranslationBase.of(context).emergencyServices, textAlign: TextAlign.center, color: Colors.black87, bold: false, - fontSize: - SizeConfig.textMultiplier * 1.7, + fontSize: SizeConfig.textMultiplier * 1.7, ) ], ), @@ -862,8 +765,7 @@ class _HomePageState extends State { fontWeight: FontWeight.normal, ), Texts( - TranslationBase.of(context) - .viewAllHabibMedicalService, + TranslationBase.of(context).viewAllHabibMedicalService, color: Colors.white, fontWeight: FontWeight.normal, fontSize: 10, @@ -884,15 +786,13 @@ class _HomePageState extends State { opacity: 0.5, color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, - onTap: () => Navigator.push( - context, FadePage(page: AllHabibMedicalService())), + onTap: () => Navigator.push(context, FadePage(page: AllHabibMedicalService())), ), DashboardItem( onTap: () { // Navigator.push( // context, FadePage(page: FeedbackHomePage())); - Navigator.push( - context, FadePage(page: ContactUsPage())); + Navigator.push(context, FadePage(page: ContactUsPage())); }, child: Container( width: double.infinity, @@ -1014,10 +914,8 @@ class DashboardItem extends StatelessWidget { ? 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, ),