From 856ab524390d86cb6c5cbb2774e4b1a231e63c7d Mon Sep 17 00:00:00 2001 From: Mohammad Aljmma Date: Wed, 28 Oct 2020 11:30:54 +0300 Subject: [PATCH] fix ui issues --- lib/config/localized_values.dart | 3 + lib/pages/landing/home_page.dart | 22 +- lib/pages/landing/landing_page.dart | 337 +++++++++--------- lib/uitl/translations_delegate_base.dart | 2 + .../bottom_navigation/bottom_nav_bar.dart | 2 +- lib/widgets/buttons/floatingActionButton.dart | 65 ++-- .../medical/medical_profile_item.dart | 9 +- lib/widgets/others/app_scaffold_widget.dart | 2 +- 8 files changed, 220 insertions(+), 222 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 29455158..0e362021 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -671,4 +671,7 @@ const Map> localizedValues = { "en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك" }, + "Book": {"en": "Book", "ar": "احجز"}, + "AppointmentLabel": {"en": "Appointment", "ar": "موعد"}, + }; diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 550eae30..37503b61 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -393,7 +393,7 @@ class _HomePageState extends State { .vitalSigns, textAlign: TextAlign.center, color: Colors.white, - fontWeight: FontWeight.w700, + bold: true, fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, ) ], @@ -440,7 +440,7 @@ class _HomePageState extends State { TranslationBase.of(context).searchMedicine, textAlign: TextAlign.center, color: Colors.white, - fontWeight: FontWeight.w700, + bold: true, fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, ) ], @@ -480,12 +480,11 @@ class _HomePageState extends State { fit: BoxFit.contain,)), ), SizedBox(height: 15,), - Texts( TranslationBase.of(context).onlinePaymentService, textAlign: TextAlign.center, color: Colors.white, - fontWeight: FontWeight.w700, + bold: true, fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, ) ], @@ -641,11 +640,10 @@ class _HomePageState extends State { Texts( TranslationBase.of(context).hMGService, color: Colors.white, - fontWeight: FontWeight.normal, + bold: true, ), Texts( - TranslationBase.of(context) - .viewAllHabibMedicalService, + TranslationBase.of(context).viewAllHabibMedicalService, color: Colors.white, fontWeight: FontWeight.normal, fontSize: 10, @@ -656,7 +654,7 @@ class _HomePageState extends State { Texts( TranslationBase.of(context).viewMore, color: Colors.white, - //fontWeight: FontWeight.normal, + bold: true, ) ], ), @@ -671,8 +669,6 @@ class _HomePageState extends State { DashboardItem( opacity:1.0, onTap: () { - // Navigator.push( - // context, FadePage(page: FeedbackHomePage())); Navigator.push( context, FadePage(page: ContactUsPage())); }, @@ -685,13 +681,13 @@ class _HomePageState extends State { Texts( TranslationBase.of(context).contactUs, color: Colors.white, - fontWeight: FontWeight.normal, + bold: true, ), Texts( TranslationBase.of(context).viewAllWaysReachUs, color: Colors.white, fontWeight: FontWeight.normal, - fontSize: 10, + fontSize: SizeConfig.textMultiplier * 1.0 , ), Expanded( child: Container(), @@ -699,7 +695,7 @@ class _HomePageState extends State { Texts( TranslationBase.of(context).viewMore, color: Colors.white, - fontWeight: FontWeight.normal, + bold: true, ) ], ), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index ecfef891..3c9c435c 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -21,6 +21,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/slide_up_page.dart'; @@ -49,8 +50,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { int currentTab = 0; PageController pageController; ProjectViewModel projectProvider; + ///inject the user data - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); final authService = new AuthProvider(); @@ -131,7 +134,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { AppGlobal.context = context; }); _requestIOSPermissions(); - pageController = PageController(keepPage: true); + pageController = PageController(keepPage: true); // _firebaseMessaging.setAutoInitEnabled(true); // // if (Platform.isIOS) { @@ -149,119 +152,119 @@ class _LandingPageState extends State with WidgetsBindingObserver { // }); //_firebase Background message handler - // _firebaseMessaging.configure( - // onMessage: (Map message) async { - // showDialog("onMessage: $message"); - // print("onMessage: $message"); - // print(message); - // print(message['name']); - // print(message['appointmentdate']); - // - // if (Platform.isIOS) { - // if (message['is_call'] == "true") { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = new Map.from(message); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => IncomingCall( - // incomingCallData: LandingPage.incomingCallData))) - // .then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // - // if (Platform.isAndroid) { - // if (message['data'].containsKey("is_call")) { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = - // new Map.from(message['data']); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => IncomingCall( - // incomingCallData: LandingPage.incomingCallData))) - // .then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found Android"); - // } - // } else { - // print("Is Call Not Found Android"); - // } - // }, - // onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, - // onLaunch: (Map message) async { - // print("onLaunch: $message"); - // showDialog("onLaunch: $message"); - // }, - // onResume: (Map message) async { - // print("onResume: $message"); - // print(message); - // print(message['name']); - // print(message['appointmentdate']); - // - // showDialog("onResume: $message"); - // - // if (Platform.isIOS) { - // if (message['is_call'] == "true") { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = - // new Map.from(message); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => IncomingCall( - // incomingCallData: LandingPage.incomingCallData))) - // .then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // }, + // _firebaseMessaging.configure( + // onMessage: (Map message) async { + // showDialog("onMessage: $message"); + // print("onMessage: $message"); + // print(message); + // print(message['name']); + // print(message['appointmentdate']); + // + // if (Platform.isIOS) { + // if (message['is_call'] == "true") { + // var route = ModalRoute.of(context); + // + // if (route != null) { + // print(route.settings.name); + // } + // + // Map myMap = new Map.from(message); + // print(myMap); + // LandingPage.isOpenCallPage = true; + // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + // if (!isPageNavigated) { + // isPageNavigated = true; + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => IncomingCall( + // incomingCallData: LandingPage.incomingCallData))) + // .then((value) { + // isPageNavigated = false; + // }); + // } + // } else { + // print("Is Call Not Found iOS"); + // } + // } else { + // print("Is Call Not Found iOS"); + // } + // + // if (Platform.isAndroid) { + // if (message['data'].containsKey("is_call")) { + // var route = ModalRoute.of(context); + // + // if (route != null) { + // print(route.settings.name); + // } + // + // Map myMap = + // new Map.from(message['data']); + // print(myMap); + // LandingPage.isOpenCallPage = true; + // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + // if (!isPageNavigated) { + // isPageNavigated = true; + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => IncomingCall( + // incomingCallData: LandingPage.incomingCallData))) + // .then((value) { + // isPageNavigated = false; + // }); + // } + // } else { + // print("Is Call Not Found Android"); + // } + // } else { + // print("Is Call Not Found Android"); + // } + // }, + // onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, + // onLaunch: (Map message) async { + // print("onLaunch: $message"); + // showDialog("onLaunch: $message"); + // }, + // onResume: (Map message) async { + // print("onResume: $message"); + // print(message); + // print(message['name']); + // print(message['appointmentdate']); + // + // showDialog("onResume: $message"); + // + // if (Platform.isIOS) { + // if (message['is_call'] == "true") { + // var route = ModalRoute.of(context); + // + // if (route != null) { + // print(route.settings.name); + // } + // + // Map myMap = + // new Map.from(message); + // print(myMap); + // LandingPage.isOpenCallPage = true; + // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + // if (!isPageNavigated) { + // isPageNavigated = true; + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => IncomingCall( + // incomingCallData: LandingPage.incomingCallData))) + // .then((value) { + // isPageNavigated = false; + // }); + // } + // } else { + // print("Is Call Not Found iOS"); + // } + // } else { + // print("Is Call Not Found iOS"); + // } + // }, // ); } @@ -337,56 +340,63 @@ class _LandingPageState extends State with WidgetsBindingObserver { // projectProvider = Provider.of(context); // checkValue(projectProvider); return Scaffold( - appBar: AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + appBar: AppBar( + elevation: 0, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Texts(getText(currentTab).toUpperCase(),bold: true,color: Colors.white,), + leading: Builder( + builder: (BuildContext context) { + return IconButton( + icon: Icon(Icons.menu), + color: Colors.white, + onPressed: () => Scaffold.of(context).openDrawer(), + ); + }, + ), + actions: [ + // IconButton( + // iconSize: 70, + // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', + // height: 100, width: 100, fit: BoxFit.cover), + // onPressed: () { + // triggerRobot(); + // } //do something, + // ) + ], + centerTitle: true, + ), + drawer: SafeArea(child: AppDrawer()), + extendBody: true, + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + HomePage( + goToMyProfile: () { + _changeCurrentTab(1); + }, + ), + MedicalProfilePage(), + BookingOptions(), + Container(), + ToDo(), + ], // Please do not remove the BookingOptions from this array ), - title: Text(getText(currentTab).toUpperCase()), - leading: Builder( - builder: (BuildContext context) { - return IconButton( - icon: Icon(Icons.menu), - color: Colors.white, - onPressed: () => Scaffold.of(context).openDrawer(), - ); - }, + bottomNavigationBar: BottomNavBar( + changeIndex: _changeCurrentTab, + index: currentTab, ), - actions: [ - // IconButton( - // iconSize: 70, - // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', - // height: 100, width: 100, fit: BoxFit.cover), - // onPressed: () { - // triggerRobot(); - // } //do something, - // ) - ], - centerTitle: true, - ), - drawer: SafeArea(child: AppDrawer()), - extendBody: true, - body: PageView( - physics: NeverScrollableScrollPhysics(), - controller: pageController, - children: [ - HomePage(goToMyProfile: () {_changeCurrentTab(1);},), - MedicalProfilePage(), - BookingOptions(), - Container(), - ToDo(), - - ], // Please do not remove the BookingOptions from this array - ), - bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab, index: currentTab,), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - floatingActionButton: currentTab ==0? FloatingButton( - elevation: true, - - onTap: () { - _changeCurrentTab(2); - }):null - ); + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + floatingActionButton: currentTab == 0 + ? FloatingButton( + elevation: true, + onTap: () { + _changeCurrentTab(2); + }) + : null); } triggerRobot() { @@ -405,7 +415,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { return TranslationBase.of(context).mySchedule; case 4: return TranslationBase.of(context).services; - } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index d89a8b1b..62754d6f 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -728,6 +728,8 @@ class TranslationBase { String get selectAge => localizedValues['select-age'][locale.languageCode]; String get iAm => localizedValues['i-am'][locale.languageCode]; String get yearOld => localizedValues['years-old'][locale.languageCode]; + String get book => localizedValues['Book'][locale.languageCode]; + String get appointmentLabel => localizedValues['AppointmentLabel'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart index 0e1b8bd2..c6cbeeda 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -67,7 +67,7 @@ class _BottomNavBarState extends State { if(widget.index != 0) BottomNavigationItem( icon: EvaIcons.calendar, - activeIcon: EvaIcons.calendarOutline, + activeIcon: EvaIcons.calendar, changeIndex: _changeIndex, index: _index, currentIndex: 2, diff --git a/lib/widgets/buttons/floatingActionButton.dart b/lib/widgets/buttons/floatingActionButton.dart index d046aba0..e7640c86 100644 --- a/lib/widgets/buttons/floatingActionButton.dart +++ b/lib/widgets/buttons/floatingActionButton.dart @@ -1,24 +1,19 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; -/// Button widget -/// [label] button label -/// [icon] button icon its optional +/// FloatingButton widget /// [onTap] button function -/// [loading] show the progress indicator /// [elevation] color elevation value class FloatingButton extends StatefulWidget { - FloatingButton( - {Key key, - this.onTap, - this.elevation: true}) - : super(key: key); + FloatingButton({Key key, this.onTap, this.elevation: true}) : super(key: key); final VoidCallback onTap; final bool elevation; - @override _FloatingButtonState createState() => _FloatingButtonState(); } @@ -54,9 +49,9 @@ class _FloatingButtonState extends State super.dispose(); } - @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return (GestureDetector( onTapDown: (TapDownDetails tap) { _animationController.reverse(from: 1.0); @@ -74,9 +69,9 @@ class _FloatingButtonState extends State child: AnimatedContainer( duration: Duration(milliseconds: 150), margin: EdgeInsets.only(bottom: 4), - padding: EdgeInsets.symmetric(vertical: 22, horizontal: 22), + padding: EdgeInsets.symmetric(vertical: 24, horizontal: 24), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(45.0)), + borderRadius: BorderRadius.all(Radius.circular(54.0)), color: Theme.of(context).primaryColor, boxShadow: [ BoxShadow( @@ -87,29 +82,29 @@ class _FloatingButtonState extends State offset: Offset(0, 7.0), blurRadius: 55.0) ]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - child: Center( - child: Column( - children: [ - //TODO change the icon - Image.asset("assets/images/blood-drop.png", fit: BoxFit.cover), - Texts('BOOK',bold: true,color: Colors.white,), - Texts('APPPINTEMNT',color: Colors.white,fontSize: 7,), - ], - ), + child: Container( + child: Column( + children: [ + Icon(EvaIcons.calendar,color: Colors.white,size: 23,), + Texts( + TranslationBase.of(context).book, + bold: !projectViewModel.isArabic, + color: Colors.white, + fontSize: projectViewModel.isArabic ? 8 : 17, ), - width: 50, - height: 50, - decoration: BoxDecoration( - shape: BoxShape.circle, + Texts( + TranslationBase.of(context).appointmentLabel, + bold: projectViewModel.isArabic, + color: Colors.white, + fontSize:projectViewModel.isArabic ? 8.8 : 8, ), - ) - ], + ], + ), + width: 54, + height: 54, + decoration: BoxDecoration( + shape: BoxShape.circle, + ), ), )), )); diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index 25606ffd..04bf3bb9 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -36,14 +36,7 @@ class MedicalProfileItem extends StatelessWidget { fontSize: 1.5 * SizeConfig.textMultiplier, color: Theme.of(context).primaryColor, fontWeight: FontWeight.bold), - RichText( - text: TextSpan( - style: TextStyle(color: Colors.black), - children: [ - TextSpan(text: subTitle), - ], - ), - ), + Texts(subTitle,fontSize: 1.4 * SizeConfig.textMultiplier,), Align( alignment: Alignment.bottomRight, child: Image.asset( diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 44fa9ef3..15727972 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -70,7 +70,7 @@ class AppScaffold extends StatelessWidget { ), title: Texts(authenticatedUserObject.isLogin || !isShowDecPage ? appBarTitle.toUpperCase() - : TranslationBase.of(context).serviceInformationTitle,color: Colors.white,), + : TranslationBase.of(context).serviceInformationTitle,color: Colors.white,bold: true,), leading: Builder( builder: (BuildContext context) { return ArrowBack();