diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 892d54fe..c5332425 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -213,5 +213,7 @@ const Map> localizedValues = { }, 'livecare': {'en': 'Live Care', 'ar': 'Live Care'}, 'beingBad': {'en': 'being bad', 'ar': 'سيء'}, - 'beingGreat': {'en': 'being great', 'ar': 'راثع'}, + 'beingGreat': {'en': 'being great', 'ar': 'رائع'}, + 'cancel': {'en': 'CANCEL', 'ar': 'الغاء'}, + 'done': {'en': 'DONE', 'ar': 'تأكيد'}, }; diff --git a/lib/providers/project_provider.dart b/lib/providers/project_provider.dart index f3abc26c..81f50c42 100644 --- a/lib/providers/project_provider.dart +++ b/lib/providers/project_provider.dart @@ -72,10 +72,15 @@ class ProjectProvider with ChangeNotifier { currentLanguage = 'en'; sharedPref.setString(APP_Language, 'en'); } - getProfile(); + callServicesAfterChangeLang(); notifyListeners(); } + callServicesAfterChangeLang() { + getProfile(); + getClinicNames(); + } + @override void dispose() { if (subscription != null) subscription.cancel(); diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 3fda04d0..4a1a2f46 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -61,6 +61,7 @@ class _DashboardScreenState extends State { } _isInit = false; } + BuildContext myContext; GlobalKey _one = GlobalKey(); @@ -101,7 +102,9 @@ class _DashboardScreenState extends State { fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.5, ), - alignment: Alignment.centerLeft, + alignment: projectsProvider.isArabic + ? Alignment.topRight + : Alignment.topLeft, ), ), Row( @@ -112,6 +115,7 @@ class _DashboardScreenState extends State { InkWell( onTap: () { showCupertinoPicker( + decKey: '', context: context, actionList: projectsProvider.clinicList); }, @@ -310,7 +314,9 @@ class _DashboardScreenState extends State { TranslationBase.of(context).patientServices, fontWeight: FontWeight.bold, ), - alignment: Alignment.centerLeft, + alignment: projectsProvider.isArabic + ? Alignment.topRight + : Alignment.topLeft, ), ), Expanded( @@ -538,19 +544,17 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ CupertinoButton( - child: Text( - 'Cancel'.toUpperCase(), - // style: TextStyle(context) - ), + child: Text(TranslationBase.of(context).cancel + // style: TextStyle(context) + ), onPressed: () { Navigator.pop(context); }, ), CupertinoButton( - child: Text( - 'Done'.toUpperCase(), - // style: textStyle(context), - ), + child: Text(TranslationBase.of(context).done + // style: textStyle(context), + ), onPressed: () { Navigator.pop(context); // onSelectFun(cupertinoPickerIndex); @@ -564,14 +568,19 @@ class _DashboardScreenState extends State { color: Color(0xfff7f7f7), child: Column( children: actionList - .map((e) => Container( - child: InkWell( - onTap: () => - changeClinic(e.clinicID, context), - child: Text( - e.clinicName, - style: TextStyle(fontSize: 15), - )), + .map((e) => Flexible( + child: Container( + child: InkWell( + onTap: () => + changeClinic(e.clinicID, context), + child: Text( + e.clinicName ?? 'asd', + style: TextStyle( + fontSize: + SizeConfig.textMultiplier * + 1.9), + )), + ), )) .toList(), )) diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 6807edf3..41c0b4f7 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -11,6 +11,7 @@ import '../util/dr_app_toast_msg.dart'; import 'package:connectivity/connectivity.dart'; import 'dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -51,7 +52,7 @@ class Helpers { mainAxisAlignment: MainAxisAlignment.end, children: [ CupertinoButton( - child: Text('Cancel'.toUpperCase(), + child: Text(TranslationBase.of(context).cancel, style: textStyle(context)), onPressed: () { Navigator.pop(context); @@ -59,7 +60,7 @@ class Helpers { ), CupertinoButton( child: Text( - 'Done'.toUpperCase(), + TranslationBase.of(context).done, style: textStyle(context), ), onPressed: () { diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index ca49936e..ad52edd8 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -233,6 +233,8 @@ class TranslationBase { String get livecare => localizedValues['livecare'][locale.languageCode]; String get beingBad => localizedValues['beingBad'][locale.languageCode]; String get beingGreat => localizedValues['beingGreat'][locale.languageCode]; + String get cancel => localizedValues['cancel'][locale.languageCode]; + String get done => localizedValues['done'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {