Loading dialog updates

dev_3.3_Floward
haroon amjad 2 years ago
parent 727a9f1363
commit fe37de9621

@ -11,7 +11,7 @@ class MedicalService extends BaseService {
List<AppoitmentAllHistoryResultList> appoitmentAllHistoryResultList = List(); List<AppoitmentAllHistoryResultList> appoitmentAllHistoryResultList = List();
List<DoctorScheduleResponse> doctorScheduleResponse = List(); List<DoctorScheduleResponse> doctorScheduleResponse = List();
List<String> freeSlots = []; List<String> freeSlots = [];
getAppointmentHistory({bool isActiveAppointment = false}) async { getAppointmentHistory({bool isActiveAppointment = false, bool isForTimeLine = false}) async {
hasError = false; hasError = false;
super.error = ""; super.error = "";
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
@ -19,6 +19,7 @@ class MedicalService extends BaseService {
body['IsActiveAppointment'] = true; body['IsActiveAppointment'] = true;
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
} }
body['IsForTimeLine'] = isForTimeLine;
var appoHistory = await sharedPref.getObject(APPOINTMENT_HISTORY_MEDICAL); var appoHistory = await sharedPref.getObject(APPOINTMENT_HISTORY_MEDICAL);
if (appoHistory != null) { if (appoHistory != null) {
appoitmentAllHistoryResultList.clear(); appoitmentAllHistoryResultList.clear();

@ -12,10 +12,10 @@ class MedicalViewModel extends BaseViewModel {
List<AppoitmentAllHistoryResultList> get appoitmentAllHistoryResultList => _medicalService.appoitmentAllHistoryResultList; List<AppoitmentAllHistoryResultList> get appoitmentAllHistoryResultList => _medicalService.appoitmentAllHistoryResultList;
List<DoctorScheduleResponse> get getDoctorScheduleList => _medicalService.doctorScheduleResponse; List<DoctorScheduleResponse> get getDoctorScheduleList => _medicalService.doctorScheduleResponse;
List<String> get freeSlots => _medicalService.freeSlots; List<String> get freeSlots => _medicalService.freeSlots;
getAppointmentHistory() async { getAppointmentHistory({bool isForTimeLine = false}) async {
if (authenticatedUserObject.isLogin) { if (authenticatedUserObject.isLogin) {
setState(ViewState.Busy); setState(ViewState.Busy);
await _medicalService.getAppointmentHistory(); await _medicalService.getAppointmentHistory(isForTimeLine: isForTimeLine);
if (_medicalService.hasError) { if (_medicalService.hasError) {
error = _medicalService.error; error = _medicalService.error;
setState(ViewState.Error); setState(ViewState.Error);

@ -256,7 +256,7 @@ class _BookConfirmState extends State<BookConfirm> {
cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) async { cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) async {
ConfirmDialog.closeAlertDialog(context); ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT);
service.cancelAppointment(appo, context, isReschedule: true).then((res) { service.cancelAppointment(appo, context, isReschedule: true).then((res) {
@ -326,7 +326,7 @@ class _BookConfirmState extends State<BookConfirm> {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime; final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
String logs = await sharedPref.getString('selectedLogSlots'); String logs = await sharedPref.getString('selectedLogSlots');
List<dynamic> decodedLogs = json.decode(logs); List<dynamic> decodedLogs = json.decode(logs);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
widget.service widget.service
.insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context, null, null, null, projectViewModel) .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context, null, null, null, projectViewModel)
@ -383,7 +383,7 @@ class _BookConfirmState extends State<BookConfirm> {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime; final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
widget.selectedDate = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[0]; widget.selectedDate = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[0];
widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5); widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, projectViewModel.isArabic ? 1 : 2, context).then((res) { widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, projectViewModel.isArabic ? 1 : 2, context).then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
@ -444,7 +444,7 @@ class _BookConfirmState extends State<BookConfirm> {
getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) {
int languageID = projectViewModel.isArabic ? 1 : 2; int languageID = projectViewModel.isArabic ? 1 : 2;
String errorMsg = ""; String errorMsg = "";
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) { widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) {
projectViewModel.selectedBodyPartList.clear(); projectViewModel.selectedBodyPartList.clear();
projectViewModel.laserSelectionDuration = 0; projectViewModel.laserSelectionDuration = 0;

@ -1174,9 +1174,9 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
addAdvancedNumberRequestTamara("Tamara-Advance-0000", tamaraOrderID, appo.appointmentNo.toString(), appo); addAdvancedNumberRequestTamara("Tamara-Advance-0000", tamaraOrderID, appo.appointmentNo.toString(), appo);
} }
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err); print(err);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
GifLoaderDialogUtils.hideDialog(context);
}); });
} catch (err) { } catch (err) {
print(err); print(err);

@ -31,7 +31,7 @@ class _MedicalProfilePageState extends State<MedicalProfilePageNew> {
var appoCountProvider = Provider.of<ToDoCountProviderModel>(context); var appoCountProvider = Provider.of<ToDoCountProviderModel>(context);
List<Widget> myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin); List<Widget> myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin);
return BaseView<MedicalViewModel>( return BaseView<MedicalViewModel>(
onModelReady: (model) => model.getAppointmentHistory(), onModelReady: (model) => model.getAppointmentHistory(isForTimeLine: true),
builder: (_, model, widget1) => AppScaffold( builder: (_, model, widget1) => AppScaffold(
isShowDecPage: false, isShowDecPage: false,
isShowAppBar: false, isShowAppBar: false,

@ -7,15 +7,16 @@ class GifLoaderDialogUtils {
static bool get isLoading => _isLoadingVisible; static bool get isLoading => _isLoadingVisible;
static showMyDialog(BuildContext context) { static showMyDialog(BuildContext context, {bool barrierDismissible = true}) {
// showDialog(context: context, builder: (cxt) => GifLoaderContainer()); // showDialog(context: context, builder: (cxt) => GifLoaderContainer());
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
_isLoadingVisible = true; _isLoadingVisible = true;
showDialog( showDialog(
barrierDismissible: barrierDismissible,
context: context, context: context,
barrierColor: Colors.black.withOpacity(0.5), barrierColor: Colors.black.withOpacity(0.5),
useRootNavigator: false, useRootNavigator: false,
builder: (BuildContext context) => GifLoaderContainer(), builder: (BuildContext context) => GifLoaderContainer(barrierDismissible: barrierDismissible,),
).then((value) { ).then((value) {
_isLoadingVisible = false; _isLoadingVisible = false;
}); });

@ -2,6 +2,10 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter_gifimage/flutter_gifimage.dart'; import 'package:flutter_gifimage/flutter_gifimage.dart';
class GifLoaderContainer extends StatefulWidget { class GifLoaderContainer extends StatefulWidget {
bool barrierDismissible;
GifLoaderContainer({this.barrierDismissible = true});
@override @override
_GifLoaderContainerState createState() => _GifLoaderContainerState(); _GifLoaderContainerState createState() => _GifLoaderContainerState();
} }
@ -29,14 +33,20 @@ class _GifLoaderContainerState extends State<GifLoaderContainer> with TickerProv
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return WillPopScope(
onWillPop: () async {
return widget.barrierDismissible;
},
child: Center(
//progress-loading.gif //progress-loading.gif
child: Container( child: Container(
// margin: EdgeInsets.only(bottom: 40), // margin: EdgeInsets.only(bottom: 40),
child: GifImage( child: GifImage(
controller: controller1, controller: controller1,
image: AssetImage("assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), image: AssetImage("assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"),
),
),
), ),
)); );
} }
} }

Loading…
Cancel
Save