From 9b160958bb125916f25fb2795567cf332ffa6c7c Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Mon, 4 Oct 2021 12:11:33 +0300 Subject: [PATCH] Covid New Design 3 --- .../cloud/diplomaticquarterapp/Application.kt | 35 ++ .../FirebaseCloudMessagingPluginRegistrant.kt | 23 + .../Covid-DriveThru/Covid-TimeSlots.dart | 425 +++++++++--------- .../covid-dirvethru-questions.dart | 263 ++++++++--- .../covid-drivethru-location.dart | 1 + .../Covid-DriveThru/covid-payment-alert.dart | 422 +++++++---------- .../covid-payment-details.dart | 408 +++++++++++------ .../covid-payment-summary.dart | 153 +++++-- lib/pages/ToDoList/payment_method_select.dart | 11 +- .../medical/labs/passport_update_page.dart | 1 + 10 files changed, 1012 insertions(+), 730 deletions(-) create mode 100644 android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt create mode 100644 android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/FirebaseCloudMessagingPluginRegistrant.kt diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt new file mode 100644 index 00000000..0708653a --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt @@ -0,0 +1,35 @@ +//package com.cloud.diplomaticquarterapp +package com.ejada.hmg + +import io.flutter.app.FlutterApplication +import io.flutter.plugin.common.PluginRegistry +import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback +import io.flutter.plugins.GeneratedPluginRegistrant +import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService + +class Application : FlutterApplication(), PluginRegistrantCallback { + override fun onCreate() { + super.onCreate() + FlutterFirebaseMessagingService.setPluginRegistrant(this) + } + + override fun registerWith(registry: PluginRegistry) { + io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")); + } +} + +//import io.flutter.app.FlutterApplication +//import io.flutter.plugin.common.PluginRegistry +//import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback +//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService +// +//class Application : FlutterApplication(), PluginRegistrantCallback { +// override fun onCreate() { +// super.onCreate() +// FlutterFirebaseMessagingService.setPluginRegistrant(this) +// } +// +// override fun registerWith(registry: PluginRegistry?) { +// FirebaseCloudMessagingPluginRegistrant.registerWith(registry) +// } +//} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/FirebaseCloudMessagingPluginRegistrant.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/FirebaseCloudMessagingPluginRegistrant.kt new file mode 100644 index 00000000..9ac064cb --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/FirebaseCloudMessagingPluginRegistrant.kt @@ -0,0 +1,23 @@ +//package com.cloud.diplomaticquarterapp +package com.ejada.hmg + +import io.flutter.plugin.common.PluginRegistry +import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin + +object FirebaseCloudMessagingPluginRegistrant { + fun registerWith(registry: PluginRegistry?) { + if (alreadyRegisteredWith(registry)) { + return + } + FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")) + } + + private fun alreadyRegisteredWith(registry: PluginRegistry?): Boolean { + val key: String? = FirebaseCloudMessagingPluginRegistrant::class.java.canonicalName + if (registry?.hasPlugin(key)!!) { + return true + } + registry.registrarFor(key) + return false + } +} \ No newline at end of file diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index c5e41abe..ef90003c 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -15,7 +15,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -66,8 +65,6 @@ class _CovidTimeSlotsState extends State with TickerProviderStat ScrollController _scrollController; - ProjectViewModel projectViewModel; - @override void initState() { final _selectedDay = DateTime.now(); @@ -119,203 +116,210 @@ class _CovidTimeSlotsState extends State with TickerProviderStat @override Widget build(BuildContext context) { - projectViewModel = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, showNewAppBar: true, showNewAppBarTitle: true, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 150.0, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/new-design/covid-19-big-banner-bg.png"), - fit: BoxFit.fill, - ), - color: Colors.white.withOpacity(0.3), - borderRadius: BorderRadius.all(Radius.circular(10))), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0), - child: SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 90.0, height: 90.0), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), - child: Text(TranslationBase.of(context).covidTest, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 24.0)), - ), - Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 10.0), - child: Text(TranslationBase.of(context).driveThru, style: TextStyle(color: Colors.white, fontSize: 24.0)), - ), - ], - ), - ], - ), - ), - Container( + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, children: [ - _buildTableCalendarWithBuilders(projectViewModel), - Padding( - padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16), - child: Text(selectedDate, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600, letterSpacing: -0.64)), - ), Container( - height: 40, - child: ListView.builder( - controller: _scrollController, - scrollDirection: Axis.horizontal, - itemCount: dayEvents.length, - itemBuilder: (context, index) { - return Container( - margin: EdgeInsets.only(right: (index == dayEvents.length - 1) ? 16 : 5.0, left: index == 0 ? 16 : 5), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5.0), - side: BorderSide( - color: index == selectedButtonIndex ? CustomColors.green : Colors.black, //Color of the border - style: BorderStyle.solid, //Style of the border - width: 1.5, //width of the border - ), - ), - minWidth: MediaQuery.of(context).size.width * 0.18, - child: index == selectedButtonIndex ? getSelectedButton(index) : getNormalButton(index)), - ); - }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + TranslationBase.of(context).selectAppo, + style: TextStyle( + color: Colors.black, + fontSize: 16.0, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + Card( + shape: cardRadius(12), + child: _buildTableCalendarWithBuilders(projectViewModel), + ), + mHeight(12), + Text( + selectedDate, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + letterSpacing: -0.64, + ), + ), + mHeight(8), + Container( + height: 40, + child: ListView.builder( + controller: _scrollController, + scrollDirection: Axis.horizontal, + itemCount: dayEvents.length, + itemBuilder: (context, index) { + return Container( + margin: EdgeInsets.only(right: (index == dayEvents.length - 1) ? 0 : 5.0, left: index == 0 ? 0 : 5), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + side: BorderSide( + color: index == selectedButtonIndex ? CustomColors.green : Colors.black, //Color of the border + style: BorderStyle.solid, //Style of the border + width: 1.5, //width of the border + ), + ), + minWidth: MediaQuery.of(context).size.width * 0.2, + child: index == selectedButtonIndex ? getSelectedButton(index) : getNormalButton(index)), + ); + }, + ), + ), + ], ), ), + SizedBox( + height: 100.0, + ), ], ), ), - SizedBox( - height: 10.0, - ), - if (CovidTimeSlots.areSlotsAvailable) - Container( - color: Colors.grey[100], - margin: EdgeInsets.all(10.0), - child: DefaultButton( - TranslationBase.of(context).bookNow, - () { - bookCovidTestAppointment(); - }, + ), + ), + Card( + elevation: 20, + margin: EdgeInsets.zero, + shape: cardRadius(0), + child: Container( + width: double.infinity, + padding: EdgeInsets.all(12), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.green, + textColor: Colors.white, + disabledTextColor: Colors.white, + elevation: 0, + disabledColor: Colors.grey[500], + onPressed: () { + bookCovidTestAppointment(); + }, + child: Text( + TranslationBase.of(context).bookAppo, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.64, + ), ), ), - ], - ), - ), + ), + ), + ) + ], ), ); } Widget _buildTableCalendarWithBuilders(ProjectViewModel projectViewModel) { - return Card( - shape: cardRadius(12), - margin: EdgeInsets.all(16), - clipBehavior: Clip.antiAlias, - child: Padding( - padding: const EdgeInsets.only(bottom: 12), - child: TableCalendar( - locale: projectViewModel.isArabic ? 'ar_SA' : 'en_US', - calendarController: _calendarController, - events: _events, - initialCalendarFormat: CalendarFormat.month, - startDay: DateTime.now(), - formatAnimation: FormatAnimation.slide, - startingDayOfWeek: StartingDayOfWeek.sunday, - weekendDays: [DateTime.friday, DateTime.saturday], - availableGestures: AvailableGestures.horizontalSwipe, - availableCalendarFormats: const { - CalendarFormat.month: '', - CalendarFormat.week: '', - }, - calendarStyle: CalendarStyle( - outsideDaysVisible: false, - weekendStyle: TextStyle().copyWith(color: Colors.blue[800]), - holidayStyle: TextStyle().copyWith(color: Colors.blue[800]), - ), - daysOfWeekStyle: DaysOfWeekStyle( - weekendStyle: TextStyle().copyWith(color: Colors.black, fontSize: 11.0, fontWeight: FontWeight.w600), - weekdayStyle: TextStyle().copyWith(color: Colors.black, fontSize: 11.0, fontWeight: FontWeight.w600), - ), - headerStyle: HeaderStyle(centerHeaderTitle: true, formatButtonVisible: false, titleTextStyle: TextStyle(fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600)), - builders: CalendarBuilders( - selectedDayBuilder: (context, date, _) { - return FadeTransition( - opacity: Tween(begin: 0.0, end: 1.0).animate(_animationController), - child: Container( - margin: const EdgeInsets.all(4.0), - padding: const EdgeInsets.only(top: 5.0, left: 5.0), - color: Colors.transparent, - width: 0, - height: 0, - child: Text( - '${date.day}', - style: TextStyle().copyWith(fontSize: 14.0), - ), - ), - ); - }, - todayDayBuilder: (context, date, _) { - return Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: _calendarController.isSelected(date) - ? Colors.green[400] - : _calendarController.isToday(date) - ? Colors.transparent - : Color(0xff76cfb7), - ), - width: 40.0, - height: 40.0, - child: Center( - child: Text( - '${date.day}', - style: TextStyle().copyWith( - color: Colors.white, - fontSize: 14.0, - ), - ), + return TableCalendar( + locale: projectViewModel.isArabic ? 'ar_SA' : 'en_US', + calendarController: _calendarController, + events: _events, + initialCalendarFormat: CalendarFormat.month, + startDay: DateTime.now(), + formatAnimation: FormatAnimation.slide, + startingDayOfWeek: StartingDayOfWeek.sunday, + weekendDays: [DateTime.friday, DateTime.saturday], + availableGestures: AvailableGestures.horizontalSwipe, + availableCalendarFormats: const { + CalendarFormat.month: '', + CalendarFormat.week: '', + }, + calendarStyle: CalendarStyle( + outsideDaysVisible: false, + weekendStyle: TextStyle().copyWith(color: Colors.blue[800]), + holidayStyle: TextStyle().copyWith(color: Colors.blue[800]), + ), + daysOfWeekStyle: DaysOfWeekStyle( + weekendStyle: TextStyle().copyWith(color: Colors.black, fontSize: 11.0, fontWeight: FontWeight.w600), + weekdayStyle: TextStyle().copyWith(color: Colors.black, fontSize: 11.0, fontWeight: FontWeight.w600), + ), + headerStyle: HeaderStyle(centerHeaderTitle: true, formatButtonVisible: false, titleTextStyle: TextStyle(fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600)), + builders: CalendarBuilders( + selectedDayBuilder: (context, date, _) { + return FadeTransition( + opacity: Tween(begin: 0.0, end: 1.0).animate(_animationController), + child: Container( + margin: const EdgeInsets.all(4.0), + padding: const EdgeInsets.only(top: 5.0, left: 6.0), + color: Colors.transparent, + width: 0, + height: 0, + child: Text( + '${date.day}', + style: TextStyle().copyWith(fontSize: 14.0), + ), + ), + ); + }, + todayDayBuilder: (context, date, _) { + return Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _calendarController.isSelected(date) + ? Colors.green[400] + : _calendarController.isToday(date) + ? Colors.transparent + : Color(0xff76cfb7), + ), + width: 40.0, + height: 40.0, + child: Center( + child: Text( + '${date.day}', + style: TextStyle().copyWith( + color: Colors.white, + fontSize: 14.0, ), - ); - }, - markersBuilder: (context, date, events, holidays) { - final children = []; - - if (events.isNotEmpty) { - children.add( - Positioned( - right: 4, - bottom: 4, - child: _buildEventsMarker(date, events), - ), - ); - } + ), + ), + ); + }, + markersBuilder: (context, date, events, holidays) { + final children = []; + + if (events.isNotEmpty) { + children.add( + Positioned( + right: 4, + bottom: 4, + child: _buildEventsMarker(date, events), + ), + ); + } - return children; - }, - ), - onDaySelected: (date, event, _) { - _onDaySelected(date, event, projectViewModel); - _animationController.forward(from: 0.0); - }, - onVisibleDaysChanged: _onVisibleDaysChanged, - onCalendarCreated: _onCalendarCreated, - ), + return children; + }, ), + onDaySelected: (date, event, _) { + _onDaySelected(date, event, projectViewModel); + _animationController.forward(from: 0.0); + }, + onVisibleDaysChanged: _onVisibleDaysChanged, + onCalendarCreated: _onCalendarCreated, ); } @@ -353,7 +357,7 @@ class _CovidTimeSlotsState extends State with TickerProviderStat _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); setState(() { CovidTimeSlots.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); - selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots']), projectViewModel.isArabic ? "ar" : "en"); + selectedDate = DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); selectedDateJSON = freeSlotsResponse[0]['FreeTimeSlots']; }); openTimeSlotsPickerForDate(DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); @@ -363,12 +367,21 @@ class _CovidTimeSlotsState extends State with TickerProviderStat Widget _buildEventsMarker(DateTime date, List events) { return Container( + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // color: _calendarController.isSelected(date) + // ? Colors.green[400] + // : _calendarController.isToday(date) + // ? Colors.brown[300] + // : Colors.blue[400], + // ), + decoration: containerColorRadiusBorderWidth( _calendarController.isSelected(date) ? CustomColors.green : _calendarController.isToday(date) - ? CustomColors.green.withOpacity(0.5) - : Colors.white, + ? CustomColors.green.withOpacity(0.5) + : Colors.white, 200, _calendarController.isSelected(date) ? CustomColors.green : Colors.black, 2), @@ -379,7 +392,7 @@ class _CovidTimeSlotsState extends State with TickerProviderStat '${date.day}', style: TextStyle().copyWith( color: _calendarController.isSelected(date) ? Colors.white : Colors.black, - fontSize: 14.0, + fontSize: 13.0, ), ), ), @@ -395,53 +408,35 @@ class _CovidTimeSlotsState extends State with TickerProviderStat setState(() { selectedButtonIndex = index; CovidTimeSlots.selectedTime = dayEvents[index].isoTime; + print(CovidTimeSlots.selectedTime); }); }, - child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0)), + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold)), ); } Widget getSelectedButton(int index) { return RaisedButton( - color: CustomColors.green, - //Color of the border + color: CustomColors.green, //Color of the border textColor: Colors.white, - elevation: 0, onPressed: () { setState(() { selectedButtonIndex = index; CovidTimeSlots.selectedTime = dayEvents[index].isoTime; + print(CovidTimeSlots.selectedTime); }); }, - child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0)), + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold)), ); } bookCovidTestAppointment() { - var messageEn = "This Appointment is being booked for patient " + - projectViewModel.user.firstName + - " " + - projectViewModel.user.lastName + - ", Having file number " + - projectViewModel.user.patientID.toString() + - ". Please confirm!"; - var messageAr = - "يتم حجز هذا الموعد المراجع " + projectViewModel.user.firstName + " " + projectViewModel.user.lastName + ", وجود رقم الملف " + projectViewModel.user.patientID.toString() + ". يرجى تأكيد!"; - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: projectViewModel.isArabic ? messageAr : messageEn, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () { - GifLoaderDialogUtils.showMyDialog(context); - DoctorList docObject = new DoctorList(); - docObject.doctorID = widget.selectedDoctorID; - docObject.clinicID = widget.selectedClinicID; - docObject.projectID = widget.projectID; - insertAppointmentCovidTest(context, docObject); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); + GifLoaderDialogUtils.showMyDialog(context); + DoctorList docObject = new DoctorList(); + docObject.doctorID = widget.selectedDoctorID; + docObject.clinicID = widget.selectedClinicID; + docObject.projectID = widget.projectID; + insertAppointmentCovidTest(context, docObject); } insertAppointmentCovidTest(context, DoctorList docObject) { @@ -489,7 +484,9 @@ class _CovidTimeSlotsState extends State with TickerProviderStat DoctorsListService service = new DoctorsListService(); service.cancelAppointment(appo, context).then((res) { if (res['MessageStatus'] == 1) { + // Future.delayed(new Duration(milliseconds: 1500), () { insertAppointmentCovidTest(context, docObject); + // }); } else { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -522,21 +519,17 @@ class _CovidTimeSlotsState extends State with TickerProviderStat } getCovidFreeSlots(BuildContext context, int projectID) { - CovidTimeSlots.areSlotsAvailable = false; CovidDriveThruService service = new CovidDriveThruService(); GifLoaderDialogUtils.showMyDialog(context); service.getCovidFreeSlots(context, projectID).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['COVID19_FreeTimeSlots'].length != 0) { - CovidTimeSlots.areSlotsAvailable = true; freeSlotsResponse = res['COVID19_FreeTimeSlots']; _getJSONSlots().then((value) => { - setState(() => {widget.selectedClinicID = freeSlotsResponse[0]['ClinicID'], widget.selectedDoctorID = freeSlotsResponse[0]['DoctorID'], _events.clear(), _events = value}) - }); - } else { - CovidTimeSlots.areSlotsAvailable = false; - } + setState(() => {widget.selectedClinicID = freeSlotsResponse[0]['ClinicID'], widget.selectedDoctorID = freeSlotsResponse[0]['DoctorID'], _events.clear(), _events = value}) + }); + } else {} } else { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); diff --git a/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart b/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart index 050331cf..32341603 100644 --- a/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart +++ b/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart @@ -5,10 +5,11 @@ import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoRespo import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidTestProceduresResponse.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/passport_update_page.dart'; import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -29,7 +30,6 @@ class CovidDirveThruQuestions extends StatefulWidget { class CovidDirveThruQuestionsState extends State { List qa; - ProjectViewModel projectViewModel; @override void initState() { @@ -37,91 +37,212 @@ class CovidDirveThruQuestionsState extends State { qa = getQuestionsFromJson(); } + TranslationBase localize; + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { + localize = TranslationBase.of(context); + var isArabic = localize.isArabic(); projectViewModel = Provider.of(context); - var isArabic = projectViewModel.isArabic; return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, showNewAppBar: true, showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15.0), - ), - margin: EdgeInsets.fromLTRB(18.0, 10.0, 18.0, 10.0), - padding: EdgeInsets.fromLTRB(8.0, 10.0, 8.0, 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(TranslationBase.of(context).covidBookAppo, style: TextStyle(fontSize: 18, letterSpacing: 1, fontWeight: FontWeight.bold)), - Text(TranslationBase.of(context).patientName.toString() + ": " + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, style: TextStyle(fontSize: 14, letterSpacing: 1)), - Text(TranslationBase.of(context).fileNo.toString() + ": " + projectViewModel.user.patientID.toString(), style: TextStyle(fontSize: 14, letterSpacing: 1)), - ], - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - child: Text(TranslationBase.of(context).covidQuestionnaire, style: TextStyle(fontSize: 17, letterSpacing: 1, fontWeight: FontWeight.bold)), - ), Expanded( - child: ListView.separated( - padding: EdgeInsets.symmetric(horizontal: 20), - itemCount: qa.length, - itemBuilder: (ctx, idx) { - var obj = qa[idx]; - var qtext = isArabic ? obj["questionAR"] : obj["questionEN"]; - return Padding( - padding: const EdgeInsets.symmetric(vertical: 10), + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(qtext, style: TextStyle(fontSize: 15, letterSpacing: 1.5)), - Row( - children: [ - Radio( - value: 1, - groupValue: obj["ans"], - onChanged: (newValue) { - setState(() { - obj["ans"] = newValue; - }); - }), - Text(TranslationBase.of(context).yes), - ], + Container( + width: double.infinity, + child: Card( + shape: cardRadius(12), + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Booking appointment for:", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + letterSpacing: -0.64, + ), + ), + mHeight(6), + Row( + children: [ + Text( + TranslationBase.of(context).patientName + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).fileNo + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + projectViewModel.user.patientIdentificationNo, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ], + ), + ), + ), + ), + mHeight(12), + Text( + "Please answer below questionnaire", + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.bold, + ), + ), + mHeight(12), + ListView.separated( + itemCount: qa.length, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (ctx, idx) { + var obj = qa[idx]; + var qtext = isArabic ? obj["questionAR"] : obj["questionEN"]; + + return Padding( + padding: const EdgeInsets.symmetric(vertical: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + qtext, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + Row( + children: [ + Expanded( + child: Row( + children: [ + Radio( + value: 1, + groupValue: obj["ans"], + onChanged: (newValue) { + setState(() { + obj["ans"] = newValue; + }); + }), + Text( + localize.yes, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + Radio( + value: 0, + groupValue: obj["ans"], + onChanged: (newValue) { + setState(() { + obj["ans"] = newValue; + }); + }), + Text( + localize.no, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ) + ], + ), + ], + ), + ); + }, + separatorBuilder: (ctx, idx) => Container(), ), - Row( - children: [ - Radio( - value: 0, - groupValue: obj["ans"], - onChanged: (newValue) { - setState(() { - obj["ans"] = newValue; - }); - }), - Text(TranslationBase.of(context).no), - ], - ) ], ), - ); - }, - separatorBuilder: (ctx, idx) => Divider(height: 0.25, color: Colors.grey.withOpacity(0.5)), - )), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), - child: FractionallySizedBox( - widthFactor: 1, - child: DefaultButton(TranslationBase.of(context).next, () { - next(); - }), + ), + ), + ), + Card( + margin: EdgeInsets.zero, + elevation: 20, + child: Container( + padding: EdgeInsets.all(12), + child: FractionallySizedBox( + widthFactor: 1, + child: MaterialButton( + height: 50, + elevation: 0, + color: CustomColors.accentColor, + disabledColor: Theme.of(context).appBarTheme.color.withOpacity(0.25), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), + child: Text( + localize.next, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + letterSpacing: -0.44, + color: Colors.white, + ), + ), + onPressed: next, + ), + ), ), ), ], @@ -139,7 +260,7 @@ class CovidDirveThruQuestionsState extends State { getPaymentInfo(context, widget.projectId); } else - AppToast.showErrorToast(message: TranslationBase.of(context).pleaseSelectAllQuestionToContinue); + AppToast.showErrorToast(message: localize.pleaseSelectAllQuestionToContinue); } openPassportUpdatePage() { diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart index 7c18eedb..b033e1f4 100644 --- a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart @@ -238,6 +238,7 @@ class _CovidDrivethruLocationState extends State { textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: CustomColors.accentColor, + elevation: 0, onPressed: () { next(); }, diff --git a/lib/pages/Covid-DriveThru/covid-payment-alert.dart b/lib/pages/Covid-DriveThru/covid-payment-alert.dart index b676aa42..9d2ac0a5 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-alert.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-alert.dart @@ -3,10 +3,11 @@ import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.da import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-summary.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -30,215 +31,135 @@ class _CovidPaymentAlertState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, - showNewAppBar: true, showNewAppBarTitle: true, - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 180.0, - color: new Color(0xFFc5272d), - child: Row( + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(left: 50.0), - child: SvgPicture.asset( - 'assets/images/new-design/alert_icon.svg', - width: 80.0, - height: 80.0), - ), - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, + color: new Color(0xFFc5272d), + padding: EdgeInsets.all(20), + child: Row( children: [ - Container( - margin: EdgeInsets.only(left: 30.0, right: 20.0), - child: Text(TranslationBase.of(context).covidAlert, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 24.0)), + Icon( + Icons.warning_outlined, + color: Colors.white, ), - Container( - width: MediaQuery.of(context).size.width * 0.55, - margin: EdgeInsets.only( - left: 30.0, right: 20.0, top: 5.0), + mWidth(12), + Expanded( child: Text( - TranslationBase.of(context).covidAlertHeader, - // "Pay With-in 15 mins to confirm the appointment", - overflow: TextOverflow.clip, - style: TextStyle( - color: Colors.white, fontSize: 20.0)), - ), + TranslationBase.of(context).covidAlertHeader, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + fontSize: 16.0, + letterSpacing: -0.64, + ), + ), + ) ], ), ), - ], - ), - ), - Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 15.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - alignment: Alignment.center, - child: Text(TranslationBase.of(context).covidAlertMins, - overflow: TextOverflow.clip, - style: TextStyle( - color: new Color(0xFFc5272d), - fontSize: 24.0, - fontWeight: FontWeight.bold)), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 5.0), - child: Text( - TranslationBase.of(context).covidAlertInfo, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.grey[700], - fontSize: 18.0, - letterSpacing: 0.8)), - ), Container( - margin: EdgeInsets.only( - top: 20.0, bottom: 10.0, left: 0.0, right: 20.0), - child: Text(TranslationBase.of(context).appoInfo, - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700], - fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.only(left: 0.0, bottom: 20.0), - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.grey[200], - boxShadow: [ - BoxShadow(color: Colors.grey, spreadRadius: 2), - ], - ), + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.only( - top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), - child: Text(TranslationBase.of(context).covidTest, - style: TextStyle( - fontSize: 18.0, - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Row( - children: [ - Container( - margin: - EdgeInsets.only(left: 20.0, right: 20.0), - child: Icon( - Icons.local_hospital, - size: 24, - color: Colors.grey[700], - )), - Container( - child: Text( - widget.patientShareResponse.projectName != - null - ? widget - .patientShareResponse.projectName - : "NULL", - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700])), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Row( - children: [ - Container( - margin: - EdgeInsets.only(left: 20.0, right: 20.0), - child: Icon( - Icons.date_range, - size: 24, - color: Colors.grey[700], - )), - Container( - child: Text( - widget.patientShareResponse - .appointmentDate != - null - ? getDate(widget.patientShareResponse - .appointmentDate) - .split(" ")[0] - : "NULL", - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700])), - ), - ], + Text( + TranslationBase.of(context).covidAlertMins, + style: TextStyle( + fontSize: 19.0, + letterSpacing: -1.6, + fontWeight: FontWeight.bold, ), ), - Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Row( - children: [ - Container( - margin: - EdgeInsets.only(left: 20.0, right: 20.0), - child: Icon( - Icons.access_time, - size: 24, - color: Colors.grey[700], - )), - Container( - child: Text( - widget.patientShareResponse - .appointmentDate != - null - ? getDate(widget.patientShareResponse - .appointmentDate) - .split(" ")[1] - : "NULL", - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700])), - ), - ], + Text( + TranslationBase.of(context).covidAlertInfo, + style: TextStyle( + color: Colors.grey[700], + fontSize: 14.0, + letterSpacing: -0.56, ), ), + mHeight(20), Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Row( - children: [ - Container( - margin: - EdgeInsets.only(left: 20.0, right: 20.0), - child: SvgPicture.asset( - "assets/images/new-design/track_icon.svg", - width: 20.0, - height: 20.0)), - Container( - child: Text( - widget.patientShareResponse.doctorNameObj != - null - ? widget - .patientShareResponse.doctorNameObj - : "NULL", + width: double.infinity, + child: Card( + margin: EdgeInsets.zero, + shape: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).appoInfo, style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700])), + fontSize: 16.0, + letterSpacing: -0.64, + fontWeight: FontWeight.bold, + ), + ), + mHeight(16), + Row( + children: [ + _getNormalText( + TranslationBase.of(context).hospital + ":", + ), + mWidth(6), + _getNormalText( + widget.patientShareResponse.projectName != null ? widget.patientShareResponse.projectName : "NULL", + isBold: true, + ), + ], + ), + mHeight(4), + Row( + children: [ + _getNormalText( + TranslationBase.of(context).date + ":", + ), + mWidth(6), + _getNormalText( + widget.patientShareResponse.appointmentDate != null ? getDate(widget.patientShareResponse.appointmentDate).split(" ")[0] : "NULL", + isBold: true, + ), + ], + ), + mHeight(4), + Row( + children: [ + _getNormalText( + TranslationBase.of(context).time + ":", + ), + mWidth(6), + _getNormalText( + widget.patientShareResponse.appointmentDate != null ? getDate(widget.patientShareResponse.appointmentDate).split(" ")[1] : "NULL", + isBold: true, + ), + ], + ), + mHeight(4), + Row( + children: [ + _getNormalText( + TranslationBase.of(context).route + ":", + ), + mWidth(6), + _getNormalText( + widget.patientShareResponse.doctorNameObj != null ? widget.patientShareResponse.doctorNameObj : "NULL", + isBold: true, + ), + ], + ), + ], ), - ], + ), ), ), ], @@ -247,49 +168,53 @@ class _CovidPaymentAlertState extends State { ], ), ), - Container( - margin: EdgeInsets.all(20.0), - child: DefaultButton( - TranslationBase.of(context).next, - () { - startPaymentProcess(); - }, + ), + Card( + margin: EdgeInsets.zero, + elevation: 20, + child: Container( + margin: EdgeInsets.all(12), + width: double.infinity, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + elevation: 0, + onPressed: () { + startPaymentProcess(); + }, + child: Text( + TranslationBase.of(context).next, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.48, + ), + ), + ), ), ), - ], - ), + ), + ], + ), + ); + } + + _getNormalText(text, {bool isBold = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold ? 12 : 10, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, ), - // bottomSheet: Container( - // margin: EdgeInsets.all(10.0), - // child: Flex( - // direction: Axis.horizontal, - // children: [ - // Expanded( - // flex: 1, - // child: Container( - // margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), - // child: ButtonTheme( - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10.0), - // ), - // minWidth: MediaQuery.of(context).size.width * 0.7, - // height: 45.0, - // child: RaisedButton( - // color: new Color(0xFF60686b), - // textColor: Colors.white, - // disabledTextColor: Colors.white, - // disabledColor: Colors.grey[500], - // onPressed: () { - // startPaymentProcess(); - // }, - // child: Text(TranslationBase.of(context).next, style: TextStyle(fontSize: 18.0)), - // ), - // ), - // ), - // ), - // ], - // ), - // ), ); } @@ -297,31 +222,32 @@ class _CovidPaymentAlertState extends State { navigateToPaymentMethod(context, widget.patientShareResponse); } - Future navigateToPaymentMethod( - context, PatientShareResponse patientShareResponse) async { + Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse) async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); } + Navigator.push( - context, FadePage(page: PaymentMethod())) - .then((value) { - print(value); - if (value != null) { - Navigator.push( - context, - FadePage( - page: CovidPaymentSummary( - patientShareResponse: widget.patientShareResponse, - selectedPaymentMethod: value.toString()), - ), - ); - } - }); + context, + FadePage( + page: CovidPaymentSummary(patientShareResponse: widget.patientShareResponse, selectedPaymentMethod: "MADA"), + ), + ); + // Navigator.push(context, FadePage(page: PaymentMethod())).then((value) { + // print(value); + // if (value != null) { + // Navigator.push( + // context, + // FadePage( + // page: CovidPaymentSummary(patientShareResponse: widget.patientShareResponse, selectedPaymentMethod: value.toString()), + // ), + // ); + // } + // }); } String getDate(String appoDate) { diff --git a/lib/pages/Covid-DriveThru/covid-payment-details.dart b/lib/pages/Covid-DriveThru/covid-payment-details.dart index f8beead2..ceb0219c 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-details.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-details.dart @@ -2,9 +2,10 @@ import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoRespo import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidTestProceduresResponse.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/Covid-TimeSlots.dart'; import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -37,57 +38,66 @@ class _CovidPaymentDetailsState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, - showNewAppBar: true, showNewAppBarTitle: true, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 100.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 150.0, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/new-design/covid-19-big-banner-bg.png"), - fit: BoxFit.fill, - ), - color: Colors.white.withOpacity(0.3), - borderRadius: BorderRadius.all(Radius.circular(10))), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0), - child: SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 90.0, height: 90.0), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), - child: Text(TranslationBase.of(context).covidTest, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 24.0)), - ), - Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 10.0), - child: Text(TranslationBase.of(context).driveThru, style: TextStyle(color: Colors.white, fontSize: 24.0)), - ), - ], - ), - ], - ), - ), - Container( - decoration: BoxDecoration(borderRadius: BorderRadius.circular(10.0), color: Colors.white), - margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 5.0), - padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 20.0), + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Container( + // margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 100.0), + + child: Column( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(16), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - alignment: Alignment.center, - margin: EdgeInsets.only(left: 0.0, right: 20.0, top: 10.0), - child: Text(TranslationBase.of(context).covidSelectProcedure, style: TextStyle(color: Colors.black, fontSize: 20.0, fontWeight: FontWeight.bold)), - ), + // Container( + // height: 150.0, + // decoration: BoxDecoration( + // image: DecorationImage( + // image: AssetImage( + // "assets/images/new-design/covid-19-big-banner-bg.png"), + // fit: BoxFit.fill, + // ), + // color: Colors.white.withOpacity(0.3), + // borderRadius: BorderRadius.all(Radius.circular(10))), + // child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Container( + // margin: + // EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0), + // child: SvgPicture.asset( + // 'assets/images/new-design/covid-19-car.svg', + // width: 90.0, + // height: 90.0), + // ), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Container( + // margin: EdgeInsets.only( + // left: 20.0, right: 20.0, top: 20.0), + // child: Text(TranslationBase.of(context).covidTest, + // style: TextStyle( + // color: Colors.white, + // fontWeight: FontWeight.bold, + // fontSize: 24.0)), + // ), + // Container( + // margin: EdgeInsets.only( + // left: 20.0, right: 20.0, top: 10.0), + // child: Text(TranslationBase.of(context).driveThru, + // style: TextStyle( + // color: Colors.white, fontSize: 24.0)), + // ), + // ], + // ), + // ], + // ), + // ), + Text(TranslationBase.of(context).covidSelectProcedure, style: TextStyle(color: Colors.black, fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.bold)), ...List.generate( widget.proceduresList.length, (index) => Column( @@ -107,7 +117,14 @@ class _CovidPaymentDetailsState extends State { }); }, child: ListTile( - title: Text(widget.proceduresList[index].procedureName, style: TextStyle(fontSize: 14.0)), + title: Text( + widget.proceduresList[index].procedureName, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), leading: Radio( value: widget.proceduresList[index], groupValue: widget.selectedProcedure, @@ -116,6 +133,7 @@ class _CovidPaymentDetailsState extends State { onChanged: (value) { setState(() { widget.selectedProcedure = value; + print(widget.selectedProcedure.procedureName); getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID); }); }, @@ -128,111 +146,200 @@ class _CovidPaymentDetailsState extends State { ], ), ), - Divider(), + + Card( + shape: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(TranslationBase.of(context).testFee, + style: TextStyle( + color: Colors.black, + fontSize: 16.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + )), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientShareToDo), + ), + Expanded( + child: _getNormalText(widget.covidPaymentInfoResponse.patientShareField.toString(), isBold: true), + ) + ], + ), + ), + mDivider(Colors.grey[200]), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 3, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientTaxToDo), + ), + Expanded( + child: _getNormalText(widget.covidPaymentInfoResponse.patientTaxAmountField.toString(), isBold: true), + ) + ], + ), + ), + mDivider(Colors.grey[200]), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 3, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo), + ), + Expanded( + child: _getNormalText(widget.covidPaymentInfoResponse.patientShareWithTaxField.toString(), isBold: true), + ) + ], + ), + ), + ], + ), + ), + ), + Container( - alignment: Alignment.center, - margin: EdgeInsets.only(left: 0.0, right: 20.0, top: 0.0), - child: Text(TranslationBase.of(context).testFee, style: TextStyle(color: Colors.black, fontSize: 22.0, fontWeight: FontWeight.bold)), + margin: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Checkbox( + value: isAgree, + onChanged: (value) { + setState(() { + isAgree = !isAgree; + }); + }, + activeColor: Color(0xffB8382C), + ), + Text( + TranslationBase.of(context).agreeTo, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + mWidth(3), + Text( + TranslationBase.of(context).termsConditoins, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + color: CustomColors.accentColor, + fontWeight: FontWeight.w600, + decoration: TextDecoration.underline, + ), + ), + ], + ), ), - Table( - children: [ - TableRow(children: [ - TableCell(child: _getNormalText(TranslationBase.of(context).patientShareToDo)), - TableCell(child: _getNormalText(widget.covidPaymentInfoResponse.patientShareField.toString())), - ]), - TableRow(children: [ - TableCell(child: _getNormalText(TranslationBase.of(context).patientTaxToDo)), - TableCell(child: _getNormalText(widget.covidPaymentInfoResponse.patientTaxAmountField.toString())), - ]), - TableRow(children: [ - TableCell(child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo)), - TableCell(child: _getNormalText(widget.covidPaymentInfoResponse.patientShareWithTaxField.toString())), - ]), - ], + mFlex(1), + + Text( + TranslationBase.of(context).payOptions, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), ), - ], - ), - ), - Container( - margin: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 5.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Checkbox( - value: isAgree, - onChanged: (value) { - setState(() { - isAgree = !isAgree; - }); - }, - activeColor: Color(0xffB8382C), + Container( + margin: EdgeInsets.only(top: 12, bottom: 12), + child: Image.asset("assets/images/new-design/payment_options_invoice_confirmation.png", width: 300), ), - Texts(TranslationBase.of(context).iAgreeToTheTermsAndConditions), ], ), ), - Divider( - color: Colors.grey, - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 5.0), - child: Text(TranslationBase.of(context).payOptions, textAlign: TextAlign.center, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, fontFamily: "Open-Sans")), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), - child: Image.asset("assets/images/new-design/payment_options_invoice_confirmation.png", width: 300), - ), - ], - ), - ), - ), - bottomSheet: Container( - color: Colors.grey[100], - padding: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 10.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: DefaultButton(TranslationBase.of(context).cancel, () { - cancel(); - }, color: Color(0xffEAEAEA), textColor: Color(0xff000000)), - ), - ), ), - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: DefaultButton( - TranslationBase.of(context).next, - isAgree - ? () { - next(); - } - : null, - disabledColor: Color(0x8ac5272d), + Container( + width: double.infinity, + child: Card( + elevation: 20, + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.only(top: 12, bottom: 12, left: 12, right: 12), + child: Row( + children: [ + Expanded( + flex: 1, + child: Container( + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.darkGreyColor, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: () { + cancel(); + }, + child: Text( + TranslationBase.of(context).cancel, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.48, + color: Colors.black, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ), + mWidth(12), + Expanded( + flex: 1, + child: Container( + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: isAgree ? next : null, + child: Text( + TranslationBase.of(context).next, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ), + ], ), ), ), - ), + ) ], ), ), @@ -268,10 +375,15 @@ class _CovidPaymentDetailsState extends State { }); } - _getNormalText(text) { - return Container( - margin: EdgeInsets.only(top: 20.0, right: 10.0), - child: Text(text, textAlign: TextAlign.end, style: TextStyle(fontSize: 15, fontFamily: 'Open-Sans', letterSpacing: 0.5, color: Colors.grey[700])), + _getNormalText(text, {bool isBold = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold ? 12 : 10, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, + ), ); } } diff --git a/lib/pages/Covid-DriveThru/covid-payment-summary.dart b/lib/pages/Covid-DriveThru/covid-payment-summary.dart index f6ed41a3..99301e98 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-summary.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-summary.dart @@ -4,14 +4,18 @@ import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.da import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/QRCode.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dragable_sheet.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -22,7 +26,7 @@ import 'package:provider/provider.dart'; class CovidPaymentSummary extends StatefulWidget { PatientShareResponse patientShareResponse; - final String selectedPaymentMethod; + String selectedPaymentMethod; MyInAppBrowser browser; AuthenticatedUser authenticatedUser; AppSharedPreferences sharedPref = AppSharedPreferences(); @@ -41,8 +45,9 @@ class _CovidPaymentSummaryState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, - showNewAppBarTitle: true, showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( @@ -50,28 +55,68 @@ class _CovidPaymentSummaryState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( + Text( TranslationBase.of(context).confirmThePayment, - textAlign: TextAlign.center, - fontWeight: FontWeight.w500, - fontSize: 24, + style: TextStyle( + fontSize: 19, + fontWeight: FontWeight.bold, + letterSpacing: -1.46, + ), + ), + SizedBox( + height: 12, + ), + Row( + + children: [ + Text( + TranslationBase.of(context).totalBalance + ": ", + style: TextStyle( + fontSize: 12, + letterSpacing: -0.60, + ), + ), + Text( + '${widget.patientShareResponse.patientShareWithTax} ' + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.60, + ), + ) + ], ), SizedBox( height: 12, ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - height: 100.0, + width: 20, + height: 20, + decoration: containerColorRadiusBorderWidth(CustomColors.accentColor, 200, Colors.white, 4), + ), + Container( + height: 60.0, padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width * 0.45, child: widget.selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(widget.selectedPaymentMethod)) : Image.asset(getImagePath(widget.selectedPaymentMethod)), ), - Texts( - '${widget.patientShareResponse.patientShareWithTax} ' + TranslationBase.of(context).sar, - fontSize: 26, - bold: true, + mFlex(1), + InkWell( + onTap: () { + showDraggableDialog(context, PaymentMethod( + onSelectedMethod: (String metohd){ + widget.selectedPaymentMethod=metohd; + setState(() { + + }); + }, + )); + }, + child: Text( + TranslationBase.of(context).changePayment, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: -0.48, decoration: TextDecoration.underline, color: CustomColors.accentColor), + ), ) ], ), @@ -81,53 +126,47 @@ class _CovidPaymentSummaryState extends State { Row( children: [ Expanded( - child: Container( - margin: EdgeInsets.all(3), - child: NewTextFields( - hintText: TranslationBase.of(context).fileNumber, - initialValue: projectViewModel.user.patientID.toString(), - isEnabled: false, - ), + flex: 1, + child: showDetail( + TranslationBase.of(context).fileNumber, + projectViewModel.user.patientID.toString(), ), ), + mWidth(6), Expanded( - child: Container( - margin: EdgeInsets.all(3), - child: NewTextFields( - hintText: TranslationBase.of(context).name, - initialValue: projectViewModel.user.firstName, - isEnabled: false, - ), + flex: 1, + child: showDetail( + TranslationBase.of(context).name, + projectViewModel.user.firstName.toString(), ), ), ], ), SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).mobileNumber, - initialValue: projectViewModel.user.mobileNumber, - isEnabled: false, + height: 6, ), + showDetail(TranslationBase.of(context).mobileNumber, projectViewModel.user.mobileNumber), SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).depositorName, - initialValue: projectViewModel.user.firstName + " " + projectViewModel.user.middleName + " " + projectViewModel.user.lastName, - isEnabled: false, + height: 6, ), + showDetail( + TranslationBase.of(context).depositorName, + projectViewModel.user.firstName + " " + projectViewModel.user.middleName + " " + projectViewModel.user.lastName, + ) ], ), ), ), bottomSheet: Container( - color: Colors.grey[100], + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, padding: EdgeInsets.all(12), - child: DefaultButton( - TranslationBase.of(context).confirm.toUpperCase(), - () { + child: SecondaryButton( + textColor: Colors.white, + color: CustomColors.green, + label: TranslationBase.of(context).confirm.toUpperCase(), + onTap: () { startPaymentProcess(projectViewModel.user); }, ), @@ -135,6 +174,32 @@ class _CovidPaymentSummaryState extends State { ); } + Widget showDetail(String title, String value) { + return Container( + width: double.infinity, + child: Card( + shape: cardRadius(12), + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, letterSpacing: -0.64), + ), + Text( + value, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.64, color: Colors.grey), + ), + ], + ), + ), + ), + ); + } + startPaymentProcess(AuthenticatedUser authenticatedUser) { AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.projectID = widget.patientShareResponse.projectID; diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index 39dc7624..7b53d15e 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -8,6 +8,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; class PaymentMethod extends StatefulWidget { + Function onSelectedMethod; + PaymentMethod({this.onSelectedMethod}); @override _PaymentMethodState createState() => _PaymentMethodState(); } @@ -22,7 +24,7 @@ class _PaymentMethodState extends State { isShowAppBar: true, showNewAppBar: true, showNewAppBarTitle: true, - backgroundColor: CustomColors.appBackgroudGreyColor, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: Container( margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), child: SingleChildScrollView( @@ -131,7 +133,7 @@ class _PaymentMethodState extends State { ), mWidth(12), Text( - "MATER CARD", + "MASTER CARD", style: TextStyle( color: Colors.black, fontSize: 14, @@ -224,7 +226,7 @@ class _PaymentMethodState extends State { ), ), bottomSheet: Container( - padding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0), + padding: EdgeInsets.all(16), color: Colors.white, child: Container( width: MediaQuery.of(context).size.width, @@ -242,7 +244,9 @@ class _PaymentMethodState extends State { textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), + elevation: 0, onPressed: () { + widget.onSelectedMethod(selectedPaymentMethod); Navigator.pop(context, selectedPaymentMethod); }, child: Text(TranslationBase.of(context).confirm.toUpperCase(), @@ -260,6 +264,7 @@ class _PaymentMethodState extends State { updateSelectedPaymentMethod(String selectedMethod) { setState(() { selectedPaymentMethod = selectedMethod; + }); } } diff --git a/lib/pages/medical/labs/passport_update_page.dart b/lib/pages/medical/labs/passport_update_page.dart index 06fdbd3a..767a950f 100644 --- a/lib/pages/medical/labs/passport_update_page.dart +++ b/lib/pages/medical/labs/passport_update_page.dart @@ -146,6 +146,7 @@ class _PassportUpdatePageState extends State { color: new Color(0xFFc5272d), textColor: Colors.white, disabledTextColor: Colors.white, + elevation: 0, disabledColor: Colors.red[300], onPressed: () { if (_isButtonDisabled == false)