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

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

@ -256,7 +256,7 @@ class _BookConfirmState extends State<BookConfirm> {
cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) async {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
DoctorsListService service = new DoctorsListService();
bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT);
service.cancelAppointment(appo, context, isReschedule: true).then((res) {
@ -326,7 +326,7 @@ class _BookConfirmState extends State<BookConfirm> {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
String logs = await sharedPref.getString('selectedLogSlots');
List<dynamic> decodedLogs = json.decode(logs);
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
AppoitmentAllHistoryResultList appo;
widget.service
.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;
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);
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
AppoitmentAllHistoryResultList appo;
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) {
@ -444,7 +444,7 @@ class _BookConfirmState extends State<BookConfirm> {
getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) {
int languageID = projectViewModel.isArabic ? 1 : 2;
String errorMsg = "";
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) {
projectViewModel.selectedBodyPartList.clear();
projectViewModel.laserSelectionDuration = 0;

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

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

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

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

Loading…
Cancel
Save