diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f9f7d6b6..882de2e4 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -738,4 +738,5 @@ const Map> localizedValues = { 'en': "A Sick leave is on Hold status for this patient", 'ar': "الإجازة المرضية في حالة الانتظار لهذا المريض" }, + 'no-clinic': {'en': "No Clinic", 'ar': "لا عيادة"} }; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index d2369e9d..fbbe6d53 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -62,7 +62,7 @@ class _DashboardScreenState extends State { bool isExpanded = false; String isInpatient = ""; var clinicName = []; - var clinicId = 1; + var clinicId; void didChangeDependencies() async { super.didChangeDependencies(); if (_isInit) { @@ -144,43 +144,50 @@ class _DashboardScreenState extends State { Container( width: MediaQuery.of(context).size.width * .6, // height: 100, - child: DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.white, - isExpanded: true, - value: clinicId, - iconSize: 25, - elevation: 16, - selectedItemBuilder: (BuildContext context) { - return projectsProvider.doctorClinicsList - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item.clinicName, - fontSize: SizeConfig.textMultiplier * 2.1, - color: Colors.white, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) { - clinicId = newValue; - changeClinic(newValue, context); - }, - items: projectsProvider.doctorClinicsList.map((item) { - return DropdownMenuItem( - child: Text( - item.clinicName, - textAlign: TextAlign.end, - ), - value: item.clinicID, - ); - }).toList(), - )), + child: projectsProvider.doctorClinicsList.length > 0 + ? DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.white, + isExpanded: true, + value: clinicId == null + ? projectsProvider + .doctorClinicsList[0].clinicID + : clinicId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return projectsProvider.doctorClinicsList + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( + item.clinicName, + fontSize: + SizeConfig.textMultiplier * 2.1, + color: Colors.white, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) { + clinicId = newValue; + changeClinic(newValue, context); + }, + items: projectsProvider.doctorClinicsList + .map((item) { + return DropdownMenuItem( + child: Text( + item.clinicName, + textAlign: TextAlign.end, + ), + value: item.clinicID, + ); + }).toList(), + )) + : AppText(TranslationBase.of(context).noClinic), ), ), // InkWell( diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 99ae043a..3f672218 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1118,9 +1118,11 @@ class TranslationBase { String get admissionRequestSuccessMsg => localizedValues['admissionRequestSuccessMsg'][locale.languageCode]; String get infoStatus => localizedValues['infoStatus'][locale.languageCode]; - String get doctorResponse => localizedValues['doctorResponse'][locale.languageCode]; -String get sickleaveonhold => + String get doctorResponse => + localizedValues['doctorResponse'][locale.languageCode]; + String get sickleaveonhold => localizedValues['sickleaveonhold'][locale.languageCode]; + String get noClinic => localizedValues['no-clinic'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {