From c9662c74515189317a8089ca32af32b35bb2926f Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 11 Oct 2021 16:36:30 +0300 Subject: [PATCH 1/2] schedule appointment navigation fix. --- .../components/SearchByDoctor.dart | 61 ++++--------------- 1 file changed, 13 insertions(+), 48 deletions(-) diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 7ce9e2b7..e7f47d6c 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); } - Future navigateToSearchResults( - context, - List docList, - List - patientDoctorAppointmentListHospital) async { - Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: docList, - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital))); + Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } } From b5cd6afa4ba74d52715ef4e9a80aa8a5c0f01757 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 11 Oct 2021 16:38:22 +0300 Subject: [PATCH 2/2] family file fixs --- lib/pages/DrawerPages/family/my-family.dart | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 1d0478d1..b6ce36bf 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);