diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 27fcb103..c5ef0ced 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -41,7 +41,7 @@ class BaseAppClient { body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID; body['ProjectID'] = doctorProfile?.projectID; - // if (!body.containsKey('ClinicID')) + if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile?.clinicID; } body['TokenID'] = token ?? ''; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 26b296ad..4e46ebf8 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -16,7 +16,6 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; -import 'package:platform_action_sheet/platform_action_sheet.dart'; import 'package:provider/provider.dart'; import '../routes.dart'; @@ -433,21 +432,7 @@ class _DashboardScreenState extends State { } - List buildActionSheetAction( - {List actionList, List defaultActionList}) { - List AList = []; - - actionList.forEach((element) { - print(element.clinicID); - AList.add(ActionSheetAction( - text: element.clinicName, - onPressed: () => Navigator.pop(context), - isCancel: true, - defaultAction: true, - )); - }); - return AList; - } + showCupertinoPicker( {context, List actionList, decKey, onSelectFun}) { @@ -497,7 +482,7 @@ class _DashboardScreenState extends State { children: actionList .map((e) => Container( child: InkWell( - onTap: changeClinic(e.clinicID), + onTap: ()=>changeClinic(e.clinicID,context), child: Text( e.clinicName, style: TextStyle(fontSize: 15), @@ -511,7 +496,7 @@ class _DashboardScreenState extends State { }); } - changeClinic(clinicId) async{ + changeClinic(clinicId , BuildContext context) async{ Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); @@ -526,15 +511,9 @@ class _DashboardScreenState extends State { // authProvider.getDocProfiles(docInfo) authProvider.getDocProfiles(docInfo.toJson()).then((res)async { - if (res['MessageStatus'] == 1) { sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); - Map profile1 = await sharedPref.getObj(DOCTOR_PROFILE); - print(1); - - } else { - // changeLoadingStata(false); - // helpers.showErrorToast(res['ErrorEndUserMessage']); - } + Navigator.pop(context); + }).catchError((err) { // changeLoadingStata(false);