From 79c17de0de3828969dc7e6cfc5681a78dcdf1e80 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 3 Dec 2020 16:02:17 +0300 Subject: [PATCH 1/2] ltr issue fixed --- lib/pages/login/login.dart | 5 +++-- lib/pages/login/register.dart | 5 +++-- lib/widgets/mobile-no/mobile_no.dart | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 25ad13bb..a1540ef7 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -93,7 +93,8 @@ class _Login extends State { onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - Container( + Directionality( + textDirection:TextDirection.ltr,child:Container( child: TextFields( fontWeight: FontWeight.normal, controller: nationalIDorFile, @@ -108,7 +109,7 @@ class _Login extends State { hintText: loginType == 1 ? TranslationBase.of(context).nationalID : TranslationBase.of(context).fileNo, - )) + ))) ], ), ), diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 042f56fe..9245d6c3 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -72,7 +72,8 @@ class _Register extends State { onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - Container( + Directionality( + textDirection:TextDirection.ltr,child:Container( child: TextFields( controller: nationalIDorFile, onChanged: (value) => validateForm(), @@ -81,7 +82,7 @@ class _Register extends State { padding: EdgeInsets.only( top: 20, bottom: 20, left: 10, right: 10), hintText: TranslationBase.of(context).nationalID, - )), + ))), Row( children: [ Expanded( diff --git a/lib/widgets/mobile-no/mobile_no.dart b/lib/widgets/mobile-no/mobile_no.dart index 2bb12a68..a16f40ce 100644 --- a/lib/widgets/mobile-no/mobile_no.dart +++ b/lib/widgets/mobile-no/mobile_no.dart @@ -89,7 +89,8 @@ class _MobileNo extends State { }).toList())))), ], ), - Container( + Directionality( + textDirection:TextDirection.ltr,child:Container( padding: EdgeInsets.all(5), decoration: BoxDecoration( color: Colors.white, @@ -131,7 +132,7 @@ class _MobileNo extends State { ), ) ]), - ) + )) ])); } } From 81c82394127d4c4edf19e3e11d2059bcc65d75e1 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 3 Dec 2020 19:43:45 +0300 Subject: [PATCH 2/2] bug fixes --- lib/config/localized_values.dart | 5 +- .../weather/weather_view_model.dart | 2 +- .../all_habib_medical_service_page.dart | 4 +- .../health-weather-indicator.dart | 76 ++++++++++++++++++- lib/pages/DrawerPages/family/my-family.dart | 24 +++++- lib/pages/landing/landing_page.dart | 8 +- lib/uitl/location_util.dart | 10 +-- lib/uitl/translations_delegate_base.dart | 1 + 8 files changed, 113 insertions(+), 17 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 50d189a5..cc0e0566 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1215,6 +1215,9 @@ const Map localizedValues = { "en": "This service is designed to enable you to have a quick link to the list of tasks that need to be done", "ar": "هذه الخدمة تم تصميمها لتمكنك من الوصول الى رابط سريع لقائمة المهام التي يجب القيام بها" }, - + "family-info": { + "en": "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file.", + "ar": "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." + } }; diff --git a/lib/core/viewModels/weather/weather_view_model.dart b/lib/core/viewModels/weather/weather_view_model.dart index 85b019e4..bb201843 100644 --- a/lib/core/viewModels/weather/weather_view_model.dart +++ b/lib/core/viewModels/weather/weather_view_model.dart @@ -13,7 +13,7 @@ class WeatherViewModel extends BaseViewModel { WeatherService _weatherService = locator(); List get weatherIndicatorData => _weatherService.weatherIndicatorData; - getWeatherData({int id, int projectID}) async { + getWeatherData() async { setState(ViewState.Busy); // if (id != null && projectID != null) { diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 5deac2f2..88d21bf8 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -52,6 +52,8 @@ class _AllHabibMedicalServiceState extends State { void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { getAuthUser(); + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); locationUtils.getCurrentLocation(); }); super.initState(); @@ -272,7 +274,7 @@ class _AllHabibMedicalServiceState extends State { }); } var data = await this.sharedPref.getObject(WEATHER); - weather = data['Temperature'].toString() + '\u2103' ?? '--'; + weather = data !=null ? data['Temperature'].toString() + '\u2103' : '--'; print(data); } } diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index 98aba205..95cbdde7 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -1,6 +1,8 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -19,13 +21,15 @@ class HealthWeatherIndicator extends StatefulWidget { class _HospitalsPageState extends State { var data; LocationUtils locationUtils; + AppSharedPreferences sharedPref = AppSharedPreferences(); + var weather = '--'; @override void initState() { locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); WidgetsBinding.instance .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); - + getWeather(); super.initState(); } @override @@ -33,14 +37,73 @@ class _HospitalsPageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getWeatherData(), + allowAny:true, builder: (_, mode, widget) => AppScaffold( isShowDecPage: false, appBarTitle: TranslationBase.of(context).healthWeatherIndicators, isShowAppBar: true, - baseViewModel: mode, body: mode.weatherIndicatorData.length>0 ? SingleChildScrollView( child: Column(children: [ + + Container( + margin: EdgeInsets.all(8), + width: double.infinity, + height: 150, + decoration: BoxDecoration( + image: DecorationImage( + image: ExactAssetImage('assets/images/Weather_img.png'), + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.circular(8.0)), + + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Row( + children: [ + Expanded( + flex:3, + child: + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .healthWeatherIndicators, + color: Colors.white, + fontWeight: FontWeight.w600, + ), + AppText( + TranslationBase.of(context).healthTipsBasedOnCurrentWeather, + color: Colors.white, + fontSize: 14, + ), + ], + )), + Expanded( + flex: 2, + child:InkWell( + onTap: (){ + + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset('assets/images/Weather_ico.png',width: 60,height: 60,), + AppText(weather, fontSize: 22, color:Colors.white) + ],), + ], + )), + ) + ], + ), + ), + ), Padding(padding: EdgeInsets.all(15), child:AppText( projectViewModel.isArabic ? mode.weatherIndicatorData[0].cityNameN : mode.weatherIndicatorData[0].cityName, fontSize: 24, fontWeight: FontWeight.bold,)), + Padding( padding: EdgeInsets.all(15), child: Column(children: @@ -50,7 +113,14 @@ class _HospitalsPageState extends State { data); }).toList() - ))])) : Container(child:AppText('Loading...'))), + ))])) : Container()), ); } + getWeather() async{ + var data = await this.sharedPref.getObject(WEATHER); + setState(() { + weather = data['Temperature'].toString() + '\u2103' ?? '--'; + }); + + } } diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 6a6e98c4..80de8ecd 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -1,12 +1,13 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; +import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as list; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -28,7 +29,6 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:provider/provider.dart'; - class MyFamily extends StatefulWidget { final bool isAppbarVisible; MyFamily({this.isAppbarVisible =true}); @@ -37,6 +37,7 @@ class MyFamily extends StatefulWidget { } class _MyFamily extends State with TickerProviderStateMixin { + List imagesInfo = List(); final familyFileProvider = FamilyFilesProvider(); AppSharedPreferences sharedPref = new AppSharedPreferences(); var userID; @@ -56,12 +57,27 @@ class _MyFamily extends State with TickerProviderStateMixin { } bool expandFlag = false; + Widget build(BuildContext context) { - projectViewModel = Provider.of(context); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'), + ); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'), + ); + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).myFamilyFiles, isShowAppBar: widget.isAppbarVisible, + imagesInfo: imagesInfo, + description: TranslationBase.of(context).familyInfo, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -648,7 +664,7 @@ class _MyFamily extends State with TickerProviderStateMixin { // Navigator.of(context).pushNamed( // HOME, // ); - result = CheckActivationCode.fromJson(result); + result = list.CheckActivationCode.fromJson(result); var familyFile = await sharedPref.getObject(FAMILY_FILE); var mainUser = await sharedPref.getObject(MAIN_USER); this.sharedPref.clear(); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 826c8b76..8de82ed1 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -19,6 +19,7 @@ import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; @@ -71,7 +72,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { } bool isPageNavigated = false; - + LocationUtils locationUtils; _changeCurrentTab(int tab) { setState(() { currentTab = tab; @@ -138,7 +139,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); - + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance + .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); if (Platform.isIOS) { diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index e3012734..1c85d898 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -15,12 +15,12 @@ class LocationUtils { void getCurrentLocation() async { print("current location"); - isLocationServiceEnabled().then((value) { + Geolocator.isLocationServiceEnabled().then((value) { if (value) { - checkPermission().then((permission) { + Geolocator.checkPermission().then((permission) { if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - getLastKnownPosition().then((value) => setLocation(value)); + Geolocator.getLastKnownPosition().then((value) => setLocation(value)); } if (permission == LocationPermission.denied || @@ -48,9 +48,9 @@ class LocationUtils { okFunction: () => { ConfirmDialog.closeAlertDialog(context), if (isPermissionError) - openAppSettings() + Geolocator.openAppSettings() else - openLocationSettings() + Geolocator.openLocationSettings() }, cancelFunction: () => {}); return dialog.showAlertDialog(context); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index b1477629..2cb521d9 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -910,6 +910,7 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get infoMyAppointments => localizedValues['info-my-appointments'][locale.languageCode]; String get infoTodo => localizedValues['info-todo'][locale.languageCode]; + String get familyInfo => localizedValues['family-info'][locale.languageCode]; }