Booking appointment 1.2
parent
ba0c0beef6
commit
ad025f3d8e
@ -0,0 +1,220 @@
|
||||
import 'package:auto_size_text/auto_size_text.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/CalendarUtils.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/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 'BookSuccess.dart';
|
||||
|
||||
class BookReminderPage extends StatelessWidget {
|
||||
PatientShareResponse patientShareResponse;
|
||||
DoctorList docObject;
|
||||
|
||||
MyInAppBrowser browser;
|
||||
final ChromeSafariBrowser chromeBrowser = new MyChromeSafariBrowser(new MyInAppBrowser());
|
||||
String selectedTime;
|
||||
String appoDateFormatted;
|
||||
String appoTimeFormatted;
|
||||
DateTime dateTime;
|
||||
|
||||
BookReminderPage({@required this.patientShareResponse, @required this.docObject, @required this.appoDateFormatted, @required this.appoTimeFormatted,this.dateTime});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// print("selectedTime "+selectedTime??"");
|
||||
print("appoDateFormatted "+appoDateFormatted??"");
|
||||
print("appoTimeFormatted "+appoDateFormatted??"");
|
||||
return AppScaffold(
|
||||
appBarTitle: docObject.doctorTitle + " " + docObject.name,
|
||||
isShowDecPage: false,
|
||||
isShowAppBar: true,
|
||||
showNewAppBarTitle: true,
|
||||
showNewAppBar: true,
|
||||
backgroundColor: CustomColors.appBackgroudGreyColor,
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
DoctorHeader(
|
||||
headerModel: HeaderModel(
|
||||
docObject.name,
|
||||
docObject.doctorImageURL,
|
||||
docObject.speciality,
|
||||
"",
|
||||
docObject.projectName,
|
||||
null,
|
||||
null,
|
||||
docObject.nationalityFlagURL,
|
||||
docObject.doctorRate,
|
||||
null,
|
||||
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(
|
||||
"Would you like to set a reminder for this appointment in your calendar?",
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.48,
|
||||
),
|
||||
),
|
||||
mFlex(1),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Card(
|
||||
shape: 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(
|
||||
"Appointment is successfully booked",
|
||||
maxLines: 1,
|
||||
minFontSize: 6,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.65,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomSheet: Container(
|
||||
color: CustomColors.appBackgroudGreyColor,
|
||||
child: Container(
|
||||
color: CustomColors.appBackgroudGreyColor,
|
||||
margin: EdgeInsets.all(14),
|
||||
height: 45.0,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
height: 45.0,
|
||||
child: RaisedButton(
|
||||
color: new Color(0xFF60686b),
|
||||
textColor: Colors.white,
|
||||
disabledTextColor: Colors.white,
|
||||
disabledColor: new Color(0xFFEAEAEA),
|
||||
onPressed: () {
|
||||
navigateToBookSuccess(context);
|
||||
},
|
||||
child: Text(TranslationBase.of(context).no, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)),
|
||||
),
|
||||
),
|
||||
),
|
||||
mWidth(7),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
height: 45.0,
|
||||
child: RaisedButton(
|
||||
color: new Color(0xffc5272d),
|
||||
textColor: Colors.white,
|
||||
disabledTextColor: Colors.white,
|
||||
disabledColor: CustomColors.green,
|
||||
onPressed: () {
|
||||
_showReminderDialog(context);
|
||||
},
|
||||
child: Text(TranslationBase.of(context).yes, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future navigateToBookSuccess(BuildContext context) async {
|
||||
Navigator.push(context, FadePage(page: BookSuccess(docObject: docObject, patientShareResponse: patientShareResponse, appoDateFormatted: appoDateFormatted, appoTimeFormatted: appoTimeFormatted)));
|
||||
}
|
||||
|
||||
Future<void> _showReminderDialog(BuildContext context) async {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true, // user must tap button!
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), //this right here
|
||||
child: ReminderDialog(
|
||||
onClick: (int i) async {
|
||||
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
|
||||
calendarUtils.createOrUpdateEvent(title: "title",description: "descriptipn",scheduleDateTime:dateTime).then((value) {
|
||||
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
|
||||
});
|
||||
if (i == 0) {
|
||||
// Before 30 mints
|
||||
|
||||
} else if (i == 1) {
|
||||
// Before 1 hour
|
||||
|
||||
} else if (i == 2) {
|
||||
// Before 1 hour and 30 mints
|
||||
|
||||
} else if (i == 3) {
|
||||
// Before 2 hours
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
import 'package:diplomaticquarterapp/theme/colors.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ReminderDialog extends StatefulWidget {
|
||||
Function onClick;
|
||||
|
||||
ReminderDialog({this.onClick});
|
||||
|
||||
@override
|
||||
_ReminderDialogState createState() => _ReminderDialogState();
|
||||
}
|
||||
|
||||
class _ReminderDialogState extends State<ReminderDialog> {
|
||||
int i = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width / 0.8,
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.notifications_active,
|
||||
size: 50,
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.clear),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
mHeight(20),
|
||||
Text(
|
||||
"When would you like to set a reminder for this appointment?",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.48,
|
||||
),
|
||||
),
|
||||
mHeight(20),
|
||||
Text(
|
||||
"Please select from below options:",
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.48,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const Text('Before 30 Mins'),
|
||||
leading: Radio<int>(
|
||||
value: 0,
|
||||
groupValue: i,
|
||||
onChanged: (int value) {
|
||||
setState(() {
|
||||
i = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const Text('Before 1 Hour'),
|
||||
leading: Radio<int>(
|
||||
value: 1,
|
||||
groupValue: i,
|
||||
onChanged: (int value) {
|
||||
setState(() {
|
||||
i = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const Text('Before 1 Hour and 30 Mins'),
|
||||
leading: Radio<int>(
|
||||
value: 2,
|
||||
groupValue: i,
|
||||
onChanged: (int value) {
|
||||
setState(() {
|
||||
i = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const Text('Before 2 Hours'),
|
||||
leading: Radio<int>(
|
||||
value: 3,
|
||||
groupValue: i,
|
||||
onChanged: (int value) {
|
||||
setState(() {
|
||||
i = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
mHeight(12),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
widget.onClick(i);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 45,
|
||||
decoration: containerRadius(CustomColors.green, 12),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"Save",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
letterSpacing: -0.48,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue