diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 07d17db4..e0e0fa66 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -34,8 +34,7 @@ class _SearchByDoctorState extends State { children: [ Container( margin: EdgeInsets.only(top: 10.0, bottom: 15.0), - child: Text(TranslationBase.of(context).searchByDocText, - style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)), + child: Text(TranslationBase.of(context).searchByDocText, style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)), ), Container( decoration: BoxDecoration(color: Colors.white), @@ -44,11 +43,7 @@ class _SearchByDoctorState extends State { onChanged: (content) { _onDocTextChanged(content); }, - decoration: InputDecoration( - labelText: TranslationBase.of(context).enterDocName, - fillColor: Colors.white, - prefixIcon: Icon(Icons.search), - border: OutlineInputBorder())), + decoration: InputDecoration(labelText: TranslationBase.of(context).enterDocName, fillColor: Colors.white, prefixIcon: Icon(Icons.search), border: OutlineInputBorder())), ), Expanded( child: Align( @@ -78,8 +73,7 @@ class _SearchByDoctorState extends State { _searchDoctor(context); } }, - child: Text(TranslationBase.of(context).search, - style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).search, style: TextStyle(fontSize: 18.0)), ), ); } @@ -89,13 +83,10 @@ class _SearchByDoctorState extends State { List doctorsList = []; DoctorsListService service = new DoctorsListService(); - List _patientDoctorAppointmentListHospital = - List(); + List _patientDoctorAppointmentListHospital = List(); - service - .getDoctorsListByName(doctorNameController.text, context) - .then((res) { - GifLoaderDialogUtils.hideDialog(context); + service.getDoctorsListByName(doctorNameController.text, context).then((res) { + // GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { if (res['DoctorList'].length != 0) { @@ -104,27 +95,13 @@ class _SearchByDoctorState extends State { }); doctorsList.forEach((element) { - List doctorByHospital = - _patientDoctorAppointmentListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List doctorByHospital = _patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList(); if (doctorByHospital.length != 0) { - _patientDoctorAppointmentListHospital[ - _patientDoctorAppointmentListHospital - .indexOf(doctorByHospital[0])] - .patientDoctorAppointmentList - .add(element); + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - _patientDoctorAppointmentListHospital.add( - PatientDoctorAppointmentList( - filterName: element.projectName, - distanceInKMs: - element.projectDistanceInKiloMeters.toString(), - patientDoctorAppointment: element)); + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); } else { @@ -133,8 +110,7 @@ class _SearchByDoctorState extends State { } }); GifLoaderDialogUtils.hideDialog(context); - navigateToSearchResults( - context, doctorsList, _patientDoctorAppointmentListHospital); + navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); } else { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -164,18 +140,7 @@ class _SearchByDoctorState extends State { getDoctorsList(context); } - navigateToSearchResults( - context, - List docList, - List - patientDoctorAppointmentListHospital) { - Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: docList, - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital))); + navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) { + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } } diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index d78dccf7..12f7d46d 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -34,12 +34,13 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; class MyFamily extends StatefulWidget { final bool isAppbarVisible; Function onBackClick; - MyFamily({this.isAppbarVisible = true,this.onBackClick}); + MyFamily({this.isAppbarVisible = true, this.onBackClick}); @override _MyFamily createState() => _MyFamily(); @@ -526,7 +527,7 @@ class _MyFamily extends State with TickerProviderStateMixin { loginAfter(result, context) async { var currentLang = await sharedPref.getString(APP_LANGUAGE); - Provider.of(context, listen: false).setPrivilege(privilegeList: result, isLoginChild: true); + Provider.of(AppGlobal.context, listen: false).setPrivilege(privilegeList: result, isLoginChild: true); result = list.CheckActivationCode.fromJson(result); var familyFile = await sharedPref.getObject(FAMILY_FILE); @@ -547,8 +548,8 @@ class _MyFamily extends State with TickerProviderStateMixin { this.sharedPref.setString(TOKEN, result.authenticationTokenID); await authenticatedUserObject.getUser(getUser: true); - Provider.of(context, listen: false).user = authenticatedUserObject.user; - Provider.of(context, listen: false).setUser(authenticatedUserObject.user); + Provider.of(AppGlobal.context, listen: false).user = authenticatedUserObject.user; + Provider.of(AppGlobal.context, listen: false).setUser(authenticatedUserObject.user); appointmentRateViewModel .getIsLastAppointmentRatedList() @@ -565,14 +566,7 @@ class _MyFamily extends State with TickerProviderStateMixin { (r) => false) } else - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false) - } + {Navigator.pushAndRemoveUntil(AppGlobal.context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false)} }) .catchError((err) { print(err);