You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			237 lines
		
	
	
		
			8.8 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			237 lines
		
	
	
		
			8.8 KiB
		
	
	
	
		
			Dart
		
	
import 'package:auto_size_text/auto_size_text.dart';
 | 
						|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
 | 
						|
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
 | 
						|
import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart';
 | 
						|
import 'package:diplomaticquarterapp/models/header_model.dart';
 | 
						|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart';
 | 
						|
import 'package:diplomaticquarterapp/theme/colors.dart';
 | 
						|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
 | 
						|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
 | 
						|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
 | 
						|
import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart';
 | 
						|
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
 | 
						|
import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart';
 | 
						|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
 | 
						|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
 | 
						|
import 'package:flutter/material.dart';
 | 
						|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
 | 
						|
import 'package:permission_handler/permission_handler.dart';
 | 
						|
import 'package:provider/provider.dart';
 | 
						|
 | 
						|
import 'BookSuccess.dart';
 | 
						|
 | 
						|
class BookReminderPage extends StatefulWidget {
 | 
						|
  PatientShareResponse patientShareResponse;
 | 
						|
  DoctorList docObject;
 | 
						|
 | 
						|
  String appoDateFormatted;
 | 
						|
  String appoTimeFormatted;
 | 
						|
  DateTime dateTime;
 | 
						|
  bool isCash;
 | 
						|
 | 
						|
  BookReminderPage({@required this.patientShareResponse, @required this.docObject, @required this.appoDateFormatted, @required this.appoTimeFormatted, this.dateTime, this.isCash = false});
 | 
						|
 | 
						|
  @override
 | 
						|
  _BookReminderPageState createState() => _BookReminderPageState();
 | 
						|
}
 | 
						|
 | 
						|
class _BookReminderPageState extends State<BookReminderPage> {
 | 
						|
  MyInAppBrowser browser;
 | 
						|
 | 
						|
  final ChromeSafariBrowser chromeBrowser = new MyChromeSafariBrowser(new MyInAppBrowser());
 | 
						|
 | 
						|
  String selectedTime;
 | 
						|
  bool isSuccessShow = true;
 | 
						|
 | 
						|
  @override
 | 
						|
  void initState() {
 | 
						|
    // TODO: implement initState
 | 
						|
    super.initState();
 | 
						|
    Future.delayed(const Duration(seconds: 2), () {
 | 
						|
// Here you can write your code
 | 
						|
 | 
						|
      setState(() {
 | 
						|
        isSuccessShow = false;
 | 
						|
      });
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  ProjectViewModel projectViewModel;
 | 
						|
 | 
						|
  @override
 | 
						|
  Widget build(BuildContext context) {
 | 
						|
    projectViewModel = Provider.of<ProjectViewModel>(context);
 | 
						|
    return AppScaffold(
 | 
						|
      appBarTitle: widget.docObject.doctorTitle + " " + widget.docObject.name,
 | 
						|
      isShowDecPage: false,
 | 
						|
      isShowAppBar: true,
 | 
						|
      showNewAppBarTitle: true,
 | 
						|
      showNewAppBar: true,
 | 
						|
      backgroundColor: CustomColors.appBackgroudGrey2Color,
 | 
						|
      body: Column(
 | 
						|
        crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
        mainAxisSize: MainAxisSize.max,
 | 
						|
        children: <Widget>[
 | 
						|
          DoctorHeader(
 | 
						|
            headerModel: HeaderModel(
 | 
						|
              widget.docObject.name,
 | 
						|
              widget.docObject.doctorID,
 | 
						|
              widget.docObject.doctorImageURL,
 | 
						|
              widget.docObject.speciality,
 | 
						|
              "",
 | 
						|
              widget.docObject.projectName,
 | 
						|
              null,
 | 
						|
              null,
 | 
						|
              widget.docObject.nationalityFlagURL,
 | 
						|
              widget.docObject.doctorRate,
 | 
						|
              null,
 | 
						|
              widget.docObject.noOfPatientsRate,
 | 
						|
              "",
 | 
						|
            ),
 | 
						|
            isNeedToShowButton: false,
 | 
						|
          ),
 | 
						|
          Expanded(
 | 
						|
            child: Container(
 | 
						|
              width: double.infinity,
 | 
						|
              height: double.infinity,
 | 
						|
              padding: EdgeInsets.only(bottom: 70),
 | 
						|
              child: Padding(
 | 
						|
                padding: const EdgeInsets.all(20.0),
 | 
						|
                child: Column(
 | 
						|
                  crossAxisAlignment: CrossAxisAlignment.start,
 | 
						|
                  children: [
 | 
						|
                    Icon(
 | 
						|
                      Icons.notifications_active,
 | 
						|
                      size: 60,
 | 
						|
                    ),
 | 
						|
                    Text(
 | 
						|
                      TranslationBase.of(context).appointmentCalendar,
 | 
						|
                      style: TextStyle(
 | 
						|
                        fontSize: 20,
 | 
						|
                        fontWeight: FontWeight.w600,
 | 
						|
                        letterSpacing: -0.48,
 | 
						|
                      ),
 | 
						|
                    ),
 | 
						|
                    mFlex(1),
 | 
						|
                    if (isSuccessShow)
 | 
						|
                      Container(
 | 
						|
                        width: double.infinity,
 | 
						|
                        child: Container(
 | 
						|
                          decoration: cardRadius(12),
 | 
						|
                          margin: EdgeInsets.all(10),
 | 
						|
                          child: Padding(
 | 
						|
                            padding: const EdgeInsets.all(16.0),
 | 
						|
                            child: Row(
 | 
						|
                              children: [
 | 
						|
                                circularAviator(
 | 
						|
                                  30,
 | 
						|
                                  icon: Icons.done_rounded,
 | 
						|
                                  iconColor: Colors.white,
 | 
						|
                                  bcColor: CustomColors.green,
 | 
						|
                                  brColor: CustomColors.green,
 | 
						|
                                ),
 | 
						|
                                mWidth(10),
 | 
						|
                                Expanded(
 | 
						|
                                  child: AutoSizeText(
 | 
						|
                                    TranslationBase.of(context).appointmentSuccess,
 | 
						|
                                    maxLines: 1,
 | 
						|
                                    minFontSize: 6,
 | 
						|
                                    style: TextStyle(
 | 
						|
                                      fontSize: 16,
 | 
						|
                                      fontWeight: FontWeight.w600,
 | 
						|
                                      letterSpacing: -0.65,
 | 
						|
                                    ),
 | 
						|
                                  ),
 | 
						|
                                )
 | 
						|
                              ],
 | 
						|
                            ),
 | 
						|
                          ),
 | 
						|
                        ),
 | 
						|
                      ),
 | 
						|
                  ],
 | 
						|
                ),
 | 
						|
              ),
 | 
						|
            ),
 | 
						|
          ),
 | 
						|
        ],
 | 
						|
      ),
 | 
						|
      bottomSheet: Container(
 | 
						|
        color: CustomColors.appBackgroudGreyColor,
 | 
						|
        child: Container(
 | 
						|
          color: CustomColors.white,
 | 
						|
          margin: EdgeInsets.all(14),
 | 
						|
          height: 45.0,
 | 
						|
          child: Row(
 | 
						|
            mainAxisAlignment: MainAxisAlignment.end,
 | 
						|
            children: <Widget>[
 | 
						|
              Expanded(
 | 
						|
                flex: 1,
 | 
						|
                child: CustomTextButton(
 | 
						|
                  backgroundColor: CustomColors.accentColor,
 | 
						|
                  elevation: 0,
 | 
						|
                  onPressed: () {
 | 
						|
                    navigateToBookSuccess(context);
 | 
						|
                    projectViewModel.analytics.appointment.appointment_reminder(false);
 | 
						|
                  },
 | 
						|
                  child: Text(TranslationBase.of(context).no, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, color: Colors.white)),
 | 
						|
                ),
 | 
						|
              ),
 | 
						|
              mWidth(7),
 | 
						|
              Expanded(
 | 
						|
                flex: 1,
 | 
						|
                child: ButtonTheme(
 | 
						|
                  shape: RoundedRectangleBorder(
 | 
						|
                    borderRadius: BorderRadius.circular(10.0),
 | 
						|
                  ),
 | 
						|
                  height: 45.0,
 | 
						|
                  child: CustomTextButton(
 | 
						|
                    backgroundColor: CustomColors.green,
 | 
						|
                    elevation: 0,
 | 
						|
                    onPressed: () async {
 | 
						|
                      print(widget.patientShareResponse.appointmentNo);
 | 
						|
                      showReminderDialog(
 | 
						|
                        context,
 | 
						|
                        widget.dateTime,
 | 
						|
                        widget.docObject.name,
 | 
						|
                        widget.patientShareResponse.appointmentNo.toString(),
 | 
						|
                        widget.appoDateFormatted,
 | 
						|
                        widget.appoTimeFormatted,
 | 
						|
                        onSuccess: () {
 | 
						|
                          AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
 | 
						|
                          navigateToBookSuccess(context);
 | 
						|
                        },
 | 
						|
                      );
 | 
						|
                      projectViewModel.analytics.appointment.appointment_reminder(true);
 | 
						|
                    },
 | 
						|
                    child: Text(TranslationBase.of(context).yes, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, color: Colors.white)),
 | 
						|
                  ),
 | 
						|
                ),
 | 
						|
              ),
 | 
						|
            ],
 | 
						|
          ),
 | 
						|
        ),
 | 
						|
      ),
 | 
						|
    );
 | 
						|
  }
 | 
						|
 | 
						|
  Future navigateToBookSuccess(BuildContext context) async {
 | 
						|
    Navigator.push(
 | 
						|
      context,
 | 
						|
      FadePage(
 | 
						|
        page: BookSuccess(
 | 
						|
          docObject: widget.docObject,
 | 
						|
          patientShareResponse: widget.patientShareResponse,
 | 
						|
          appoDateFormatted: widget.appoDateFormatted,
 | 
						|
          appoTimeFormatted: widget.appoTimeFormatted,
 | 
						|
          isCash: widget.isCash,
 | 
						|
        ),
 | 
						|
      ),
 | 
						|
    );
 | 
						|
  }
 | 
						|
 | 
						|
  Future<Map<Permission, PermissionStatus>> requestPermissions() async {
 | 
						|
    var permissionResults = [Permission.calendar].request();
 | 
						|
    return permissionResults;
 | 
						|
  }
 | 
						|
}
 |