get clinic list after changing the language

merge-requests/146/head
hussam al-habibeh 5 years ago
parent 629ccbeda8
commit aa57f4c4d7

@ -213,5 +213,7 @@ const Map<String, Map<String, String>> localizedValues = {
}, },
'livecare': {'en': 'Live Care', 'ar': 'Live Care'}, 'livecare': {'en': 'Live Care', 'ar': 'Live Care'},
'beingBad': {'en': 'being bad', 'ar': 'سيء'}, 'beingBad': {'en': 'being bad', 'ar': 'سيء'},
'beingGreat': {'en': 'being great', 'ar': 'راثع'}, 'beingGreat': {'en': 'being great', 'ar': 'رائع'},
'cancel': {'en': 'CANCEL', 'ar': 'الغاء'},
'done': {'en': 'DONE', 'ar': 'تأكيد'},
}; };

@ -72,10 +72,15 @@ class ProjectProvider with ChangeNotifier {
currentLanguage = 'en'; currentLanguage = 'en';
sharedPref.setString(APP_Language, 'en'); sharedPref.setString(APP_Language, 'en');
} }
getProfile(); callServicesAfterChangeLang();
notifyListeners(); notifyListeners();
} }
callServicesAfterChangeLang() {
getProfile();
getClinicNames();
}
@override @override
void dispose() { void dispose() {
if (subscription != null) subscription.cancel(); if (subscription != null) subscription.cancel();

@ -61,6 +61,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
} }
_isInit = false; _isInit = false;
} }
BuildContext myContext; BuildContext myContext;
GlobalKey _one = GlobalKey(); GlobalKey _one = GlobalKey();
@ -101,7 +102,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 2.5, fontSize: SizeConfig.textMultiplier * 2.5,
), ),
alignment: Alignment.centerLeft, alignment: projectsProvider.isArabic
? Alignment.topRight
: Alignment.topLeft,
), ),
), ),
Row( Row(
@ -112,6 +115,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
InkWell( InkWell(
onTap: () { onTap: () {
showCupertinoPicker( showCupertinoPicker(
decKey: '',
context: context, context: context,
actionList: projectsProvider.clinicList); actionList: projectsProvider.clinicList);
}, },
@ -310,7 +314,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
TranslationBase.of(context).patientServices, TranslationBase.of(context).patientServices,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
alignment: Alignment.centerLeft, alignment: projectsProvider.isArabic
? Alignment.topRight
: Alignment.topLeft,
), ),
), ),
Expanded( Expanded(
@ -538,19 +544,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
CupertinoButton( CupertinoButton(
child: Text( child: Text(TranslationBase.of(context).cancel
'Cancel'.toUpperCase(), // style: TextStyle(context)
// style: TextStyle(context) ),
),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
CupertinoButton( CupertinoButton(
child: Text( child: Text(TranslationBase.of(context).done
'Done'.toUpperCase(), // style: textStyle(context),
// style: textStyle(context), ),
),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
// onSelectFun(cupertinoPickerIndex); // onSelectFun(cupertinoPickerIndex);
@ -564,14 +568,19 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Color(0xfff7f7f7), color: Color(0xfff7f7f7),
child: Column( child: Column(
children: actionList children: actionList
.map((e) => Container( .map((e) => Flexible(
child: InkWell( child: Container(
onTap: () => child: InkWell(
changeClinic(e.clinicID, context), onTap: () =>
child: Text( changeClinic(e.clinicID, context),
e.clinicName, child: Text(
style: TextStyle(fontSize: 15), e.clinicName ?? 'asd',
)), style: TextStyle(
fontSize:
SizeConfig.textMultiplier *
1.9),
)),
),
)) ))
.toList(), .toList(),
)) ))

@ -11,6 +11,7 @@ import '../util/dr_app_toast_msg.dart';
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
import 'dr_app_shared_pref.dart'; import 'dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
@ -51,7 +52,7 @@ class Helpers {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
CupertinoButton( CupertinoButton(
child: Text('Cancel'.toUpperCase(), child: Text(TranslationBase.of(context).cancel,
style: textStyle(context)), style: textStyle(context)),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
@ -59,7 +60,7 @@ class Helpers {
), ),
CupertinoButton( CupertinoButton(
child: Text( child: Text(
'Done'.toUpperCase(), TranslationBase.of(context).done,
style: textStyle(context), style: textStyle(context),
), ),
onPressed: () { onPressed: () {

@ -233,6 +233,8 @@ class TranslationBase {
String get livecare => localizedValues['livecare'][locale.languageCode]; String get livecare => localizedValues['livecare'][locale.languageCode];
String get beingBad => localizedValues['beingBad'][locale.languageCode]; String get beingBad => localizedValues['beingBad'][locale.languageCode];
String get beingGreat => localizedValues['beingGreat'][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<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save