diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5c6b0fea..0b5b9b3f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1101,7 +1101,7 @@ const Map localizedValues = { "en": "\nThis service Displays nearest branch\n among all the branches of All Habib \n medical Group based on your current Location", "ar": "\nتعرض هذه الخدمة أقرب فرع\n من بين جميع فروع مجموعة \nالحبيب الطبية بناءً على موقعك الحالي." }, - "NearestEr": {"en": "Nearest ER", "ar": "أقرب ER"}, + "NearestEr": {"en": "Nearest ER", "ar":"اقرب طوارئ"}, "infoCMC": { "en": "Through this service, you can request a set of tests that help you and your doctor to understand the current health condition and then identify potential risks.", "ar": "من خلال هذه الخدمة يمكنك طلب مجموعة من الفحوصات التي تساعدك وتساعد طبيبك في فهم حالتك الصحية الحالية ومن ثم تحديد المخاطر المحتملة" @@ -1481,5 +1481,6 @@ const Map localizedValues = { "firstTri": { "en": "First Trimester Ends (12 weeks):", "ar": "تاريخ انتهاء الثلث الأول 12 اسبوع: " }, "secondTri": { "en": "Second Trimester Ends (27 weeks):", "ar": "تاريخ انتهاء الثلث الثاني 27 اسبوع: " }, "thirdTri": { "en": "Third Trimester, Estimated Due Date (40 weeks):", "ar": "تاريخ احتمال الولادة 40 اسبوع:" }, - "seeDoctorsList": { "en": "See List Of Doctors", "ar": "اعرض قائمة الأطباء" } + "seeDoctorsList": { "en": "See List Of Doctors", "ar": "اعرض قائمة الأطباء" }, + "covidQuestionnaire": { "en": "Please answer below questionnaire:", "ar": "الرجاء الإجابة على الاستبيان أدناه:" }, }; diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index ff407053..1dc66d5f 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -378,8 +378,6 @@ class _DocAvailableAppointmentsState extends State wit if (res['PatientER_DoctorFreeSlots'].length != 0) { DocAvailableAppointments.areAppointmentsAvailable = true; freeSlotsResponse = res['PatientER_DoctorFreeSlots']; - print("res['PatientER_DoctorFreeSlots']"); - print(res['PatientER_DoctorFreeSlots'].length); _getJSONSlots().then((value) => { setState(() => {_events.clear(), _events = value}) }); @@ -405,14 +403,6 @@ class _DocAvailableAppointmentsState extends State wit Widget _buildEventsMarker(DateTime date, List events) { return Container( - // decoration: BoxDecoration( - // shape: BoxShape.circle, - // color: _calendarController.isSelected(date) - // ? Color(0xffB8382C) - // : _calendarController.isToday(date) - // ? Colors.brown[300] - // : Color(0xff359846), - // ), decoration: containerColorRadiusBorderWidth( _calendarController.isSelected(date) ? CustomColors.green diff --git a/lib/pages/ContactUs/widgets/card_common_contat.dart b/lib/pages/ContactUs/widgets/card_common_contat.dart index 877d8b37..d6de807a 100644 --- a/lib/pages/ContactUs/widgets/card_common_contat.dart +++ b/lib/pages/ContactUs/widgets/card_common_contat.dart @@ -1,28 +1,35 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/advance_payment_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/my_balance_page.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/Weight/WeightHomePage.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -import '../../../Constants.dart'; class CardCommonContact extends StatelessWidget { final image; final text; final subText; final type; - const CardCommonContact({@required this.image, @required this.text, @required this.subText, @required this.type}); + final width; + final height; + final ProjectViewModel projectViewModel; + final ToDoCountProviderModel model; + + const CardCommonContact({@required this.image, @required this.text, @required this.subText, @required this.type, this.width, this.height, this.projectViewModel, this.model}); @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + // ProjectViewModel projectViewModel = Provider.of(context); + // ToDoCountProviderModel model = Provider.of(context); return GestureDetector( onTap: () { navigateToSearch(context, this.type); @@ -43,9 +50,8 @@ class CardCommonContact extends StatelessWidget { children: [ Image.asset( this.image, - width: 42.0, - height: 42.0, - color: Color(0xff2E303A), + width: width != null ? width : 42.0, + height: height != null ? height : 42.0, ), Text( text + "${subText.isEmpty ? "" : "\n$subText"}", @@ -63,17 +69,31 @@ class CardCommonContact extends StatelessWidget { } else if (type == 1) { Navigator.push(context, FadePage(page: FeedbackHomePage())); } else if (type == 2) { - //LiveChatPage Navigator.push(context, FadePage(page: LiveChatPage())); } else if (type == 3) { - //LiveChatPage Navigator.push(context, FadePage(page: BloodSugarHomePage())); } else if (type == 4) { - //LiveChatPage Navigator.push(context, FadePage(page: BloodPressureHomePage())); } else if (type == 5) { - //LiveChatPage Navigator.push(context, FadePage(page: WeightHomePage())); + } else if (type == 6) { + Navigator.push(context, FadePage(page: AdvancePaymentPage())); + } else if (type == 7) { + navigateToToDoPage(context); + } else if (type == 8) { + Navigator.push(context, FadePage(page: MyBalancePage())); + } + } + + navigateToToDoPage(BuildContext context) { + if (projectViewModel.isLogin) { + if (model.count != 0) { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); + } + } else { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); } } } diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index c12dd877..5ccd204e 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -8,11 +8,14 @@ import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidTestProceduresRe import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-alert.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.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/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'; @@ -43,8 +46,7 @@ class CovidTimeSlots extends StatefulWidget { _CovidTimeSlotsState createState() => _CovidTimeSlotsState(); } -class _CovidTimeSlotsState extends State - with TickerProviderStateMixin { +class _CovidTimeSlotsState extends State with TickerProviderStateMixin { Map _events; AnimationController _animationController; CalendarController _calendarController; @@ -64,6 +66,8 @@ class _CovidTimeSlotsState extends State ScrollController _scrollController; + ProjectViewModel projectViewModel; + @override void initState() { final _selectedDay = DateTime.now(); @@ -76,8 +80,7 @@ class _CovidTimeSlotsState extends State _selectedDay: ['Event A0'] }; - WidgetsBinding.instance.addPostFrameCallback( - (_) => getCovidFreeSlots(context, widget.projectID)); + WidgetsBinding.instance.addPostFrameCallback((_) => getCovidFreeSlots(context, widget.projectID)); _calendarController = CalendarController(); _animationController = AnimationController( @@ -96,34 +99,32 @@ class _CovidTimeSlotsState extends State super.dispose(); } - void _onDaySelected( - DateTime day, List events, ProjectViewModel projectViewModel) { + void _onDaySelected(DateTime day, List events, ProjectViewModel projectViewModel) { final DateFormat formatter = DateFormat('yyyy-MM-dd'); setState(() { - this.selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted( - day, projectViewModel.isArabic ? "ar" : "en"); + this.selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(day, projectViewModel.isArabic ? "ar" : "en"); openTimeSlotsPickerForDate(day, docFreeSlots); CovidTimeSlots.selectedDate = formatter.format(day); print(CovidTimeSlots.selectedDate); }); } - void _onVisibleDaysChanged( - DateTime first, DateTime last, CalendarFormat format) { + void _onVisibleDaysChanged(DateTime first, DateTime last, CalendarFormat format) { print('CALLBACK: _onVisibleDaysChanged'); } - void _onCalendarCreated( - DateTime first, DateTime last, CalendarFormat format) { + void _onCalendarCreated(DateTime first, DateTime last, CalendarFormat format) { print('CALLBACK: _onCalendarCreated'); } @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + 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), @@ -134,8 +135,7 @@ class _CovidTimeSlotsState extends State height: 150.0, decoration: BoxDecoration( image: DecorationImage( - image: AssetImage( - "assets/images/new-design/covid-19-big-banner-bg.png"), + image: AssetImage("assets/images/new-design/covid-19-big-banner-bg.png"), fit: BoxFit.fill, ), color: Colors.white.withOpacity(0.3), @@ -144,31 +144,19 @@ class _CovidTimeSlotsState extends State 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), + 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)), + 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)), + 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)), ), ], ), @@ -176,202 +164,164 @@ class _CovidTimeSlotsState extends State ), ), Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.0), - color: Colors.white), - margin: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 5.0), - padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 20.0), - width: MediaQuery.of(context).size.width, - // height: MediaQuery.of(context).size.height * 0.65, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).selectAppo, - style: - TextStyle(color: Colors.black, fontSize: 16.0)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - alignment: Alignment.center, - child: Text(selectedDate, - style: TextStyle( - fontSize: 18.0, fontWeight: FontWeight.bold)), + _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: 50, - margin: EdgeInsets.all(20.0), + height: 40, child: ListView.builder( controller: _scrollController, scrollDirection: Axis.horizontal, itemCount: dayEvents.length, itemBuilder: (context, index) { return Container( - margin: EdgeInsets.only(right: 10.0), + 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: Colors.blue[400], - //Color of the border - style: BorderStyle.solid, - //Style of the border + 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)), + minWidth: MediaQuery.of(context).size.width * 0.18, + child: index == selectedButtonIndex ? getSelectedButton(index) : getNormalButton(index)), ); }, ), ), - _buildTableCalendarWithBuilders(projectViewModel), ], ), ), SizedBox( - height: 100.0, + height: 10.0, ), - ], - ), - ), - ), - 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: () { + if (CovidTimeSlots.areSlotsAvailable) + Container( + color: Colors.grey[100], + margin: EdgeInsets.all(10.0), + child: DefaultButton( + TranslationBase.of(context).bookNow, + () { bookCovidTestAppointment(); }, - child: Text(TranslationBase.of(context).bookNow, - style: TextStyle(fontSize: 18.0)), ), ), - ), - ), - ], + ], + ), ), ), ); } Widget _buildTableCalendarWithBuilders(ProjectViewModel projectViewModel) { - 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.blue[600]), - ), - headerStyle: HeaderStyle( - centerHeaderTitle: true, - formatButtonVisible: false, - ), - 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: 16.0), - ), - ), - ); - }, - todayDayBuilder: (context, date, _) { - return Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: _calendarController.isSelected(date) - ? Colors.green[400] - : _calendarController.isToday(date) - ? Colors.brown[300] - : Colors.blue[400], - ), - width: 40.0, - height: 40.0, - child: Center( - child: Text( - '${date.day}', - style: TextStyle().copyWith( - color: Colors.white, - fontSize: 14.0, + 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), + ), ), - ), - ), - ); - }, - markersBuilder: (context, date, events, holidays) { - final children = []; - - if (events.isNotEmpty) { - children.add( - Positioned( - right: 4, - bottom: 4, - child: _buildEventsMarker(date, events), - ), - ); - } + ); + }, + 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), + ), + ); + } - return children; - }, + return children; + }, + ), + onDaySelected: (date, event, _) { + _onDaySelected(date, event, projectViewModel); + _animationController.forward(from: 0.0); + }, + onVisibleDaysChanged: _onVisibleDaysChanged, + onCalendarCreated: _onCalendarCreated, + ), ), - onDaySelected: (date, event, _) { - _onDaySelected(date, event, projectViewModel); - _animationController.forward(from: 0.0); - }, - onVisibleDaysChanged: _onVisibleDaysChanged, - onCalendarCreated: _onCalendarCreated, ); } openTimeSlotsPickerForDate(DateTime dateStart, List freeSlots) { dayEvents.clear(); - DateTime dateStartObj = new DateTime( - dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); + DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); freeSlots.forEach((v) { if (v.start == dateStartObj) dayEvents.add(v); @@ -396,47 +346,39 @@ class _CovidTimeSlotsState extends State final DateFormat formatter = DateFormat('HH:mm'); final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); for (var i = 0; i < freeSlotsResponse.length; i++) { - date = - DateUtil.convertStringToDate(freeSlotsResponse[i]['FreeTimeSlots']); + date = DateUtil.convertStringToDate(freeSlotsResponse[i]['FreeTimeSlots']); slotsList.add(FreeSlot(date, ['slot'])); - docFreeSlots.add(TimeSlot( - isoTime: formatter.format(date), - start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), - end: date)); + docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date)); } - _eventsParsed = - Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); + _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); setState(() { - CovidTimeSlots.selectedDate = dateFormatter.format( - DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); - selectedDate = DateUtil.getMonthDayYearDateFormatted( - DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); + CovidTimeSlots.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); + selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots']), projectViewModel.isArabic ? "ar" : "en"); selectedDateJSON = freeSlotsResponse[0]['FreeTimeSlots']; }); - openTimeSlotsPickerForDate( - DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); - _calendarController - .setFocusedDay(DateUtil.convertStringToDate(selectedDateJSON)); + openTimeSlotsPickerForDate(DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); + _calendarController.setFocusedDay(DateUtil.convertStringToDate(selectedDateJSON)); return _eventsParsed; } 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, + 200, + _calendarController.isSelected(date) ? CustomColors.green : Colors.black, + 2), width: 40.0, height: 40.0, child: Center( child: Text( '${date.day}', style: TextStyle().copyWith( - color: Colors.white, + color: _calendarController.isSelected(date) ? Colors.white : Colors.black, fontSize: 14.0, ), ), @@ -447,32 +389,31 @@ class _CovidTimeSlotsState extends State Widget getNormalButton(int index) { return RaisedButton( color: Colors.white, + elevation: 0, textColor: new Color(0xFF60686b), onPressed: () { setState(() { selectedButtonIndex = index; CovidTimeSlots.selectedTime = dayEvents[index].isoTime; - print(CovidTimeSlots.selectedTime); }); }, - child: Text(dayEvents[index].isoTime, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0)), ); } Widget getSelectedButton(int index) { return RaisedButton( - color: Colors.blue[400], + 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: 16.0, fontWeight: FontWeight.bold)), + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0)), ); } @@ -489,19 +430,11 @@ class _CovidTimeSlotsState extends State DoctorsListService service = new DoctorsListService(); AppoitmentAllHistoryResultList appo; service - .insertAppointment( - docObject.doctorID, - docObject.clinicID, - docObject.projectID, - CovidTimeSlots.selectedTime, - CovidTimeSlots.selectedDate, - context, - widget.selectedProcedure.procedureID) + .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, CovidTimeSlots.selectedTime, CovidTimeSlots.selectedDate, context, widget.selectedProcedure.procedureID) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Appointment Booked Successfully"); - getPatientShare(context, res['AppointmentNo'], docObject.clinicID, - docObject.projectID, docObject); + getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); } else { GifLoaderDialogUtils.hideDialog(context); appo = new AppoitmentAllHistoryResultList(); @@ -532,16 +465,13 @@ class _CovidTimeSlotsState extends State }); } - cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, - BuildContext context) { + cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { ConfirmDialog.closeAlertDialog(context); GifLoaderDialogUtils.showMyDialog(context); 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']); @@ -551,12 +481,9 @@ class _CovidTimeSlotsState extends State }); } - getPatientShare(context, String appointmentNo, int clinicID, int projectID, - DoctorList docObject) { + getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { DoctorsListService service = new DoctorsListService(); - service - .getPatientShare(appointmentNo, clinicID, projectID, context) - .then((res) { + service.getPatientShare(appointmentNo, clinicID, projectID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); @@ -571,31 +498,27 @@ class _CovidTimeSlotsState extends State Navigator.push( context, FadePage( - page: CovidPaymentAlert( - patientShareResponse: widget.patientShareResponse), + page: CovidPaymentAlert(patientShareResponse: widget.patientShareResponse), ), ); } 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 - }) + setState(() => {widget.selectedClinicID = freeSlotsResponse[0]['ClinicID'], widget.selectedDoctorID = freeSlotsResponse[0]['DoctorID'], _events.clear(), _events = value}) }); - } else {} + } else { + CovidTimeSlots.areSlotsAvailable = false; + } } 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 0f07081f..4cfa1aea 100644 --- a/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart +++ b/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.da 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/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -42,12 +43,14 @@ class CovidDirveThruQuestionsState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.all(20), - child: Text(localize.covidSelectProcedure, style: TextStyle(fontSize: 17, letterSpacing: 1, fontWeight: FontWeight.bold)), + padding: const EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + child: Text(localize.covidQuestionnaire, style: TextStyle(fontSize: 17, letterSpacing: 1, fontWeight: FontWeight.bold)), ), Expanded( child: ListView.separated( @@ -56,7 +59,6 @@ class CovidDirveThruQuestionsState extends State { itemBuilder: (ctx, idx) { var obj = qa[idx]; var qtext = isArabic ? obj["questionAR"] : obj["questionEN"]; - return Padding( padding: const EdgeInsets.symmetric(vertical: 10), child: Column( @@ -99,16 +101,9 @@ class CovidDirveThruQuestionsState extends State { padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), child: FractionallySizedBox( widthFactor: 1, - child: MaterialButton( - height: 50, - color: Theme.of(context).appBarTheme.color, - disabledColor: Theme.of(context).appBarTheme.color.withOpacity(0.25), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), - child: Text( - localize.next, - style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1), - ), - onPressed: next), + child: DefaultButton(localize.next, () { + next(); + }), ), ), ], @@ -132,7 +127,7 @@ class CovidDirveThruQuestionsState extends State { openPassportUpdatePage() { Navigator.push(context, FadePage(page: PassportUpdatePage())).then((value) { print(value); - if(value != null && value == true) { + if (value != null && value == true) { getPaymentInfo(context, widget.projectId); } }); diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart index 4040abf5..18269595 100644 --- a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart @@ -58,27 +58,28 @@ class _CovidDrivethruLocationState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, imagesInfo: imagesInfo, description: TranslationBase.of(context).covidInfo, isShowDecPage: true, body: SingleChildScrollView( child: Container( - margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), + margin: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 0.0), child: Column( mainAxisSize: MainAxisSize.max, children: [ Container( alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft, - child: Text(TranslationBase.of(context).resultHeader, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 22.0, color: Colors.black)), + child: Text(TranslationBase.of(context).resultHeader, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, color: Colors.black, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), ), Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).covidInfo, style: TextStyle(fontSize: 16.0, color: Colors.black)), + child: Text(TranslationBase.of(context).covidInfo, style: TextStyle(fontSize: 14.0, color: Colors.black)), ), Container( - margin: EdgeInsets.only(top: 20.0), + margin: EdgeInsets.only(top: 5.0), alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft, - child: Text(TranslationBase.of(context).selectLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0, letterSpacing: 0.8, color: Colors.grey[700])), + child: Text(TranslationBase.of(context).selectLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0, letterSpacing: 0.8, color: Colors.grey[700], fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), ), Container( height: 60.0, @@ -92,7 +93,7 @@ class _CovidDrivethruLocationState extends State { ), padding: EdgeInsets.all(8.0), width: MediaQuery.of(context).size.width, - margin: EdgeInsets.only(top: 15.0), + margin: EdgeInsets.only(top: 5.0), child: DropdownButtonHideUnderline( child: DropdownButton( hint: new Text(TranslationBase.of(context).selectAddress), @@ -111,16 +112,16 @@ class _CovidDrivethruLocationState extends State { }, ), )), + // isLocationSelected + // ? Container( + // margin: EdgeInsets.only(top: 15.0), + // alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft, + // child: Text(TranslationBase.of(context).selectLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0, letterSpacing: 0.8, color: Colors.black)), + // ) + // : Container(), isLocationSelected ? Container( - margin: EdgeInsets.only(top: 15.0), - alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft, - child: Text(TranslationBase.of(context).selectLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0, letterSpacing: 0.8, color: Colors.black)), - ) - : Container(), - isLocationSelected - ? Container( - margin: EdgeInsets.only(top: 5.0), + margin: EdgeInsets.only(top: 10.0), decoration: BoxDecoration( border: Border.all(color: Colors.grey[400], width: 1.0), ), diff --git a/lib/pages/Covid-DriveThru/covid-payment-alert.dart b/lib/pages/Covid-DriveThru/covid-payment-alert.dart index ca6640c0..b676aa42 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-alert.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-alert.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.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/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -29,12 +30,14 @@ 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: 200.0, + height: 180.0, color: new Color(0xFFc5272d), child: Row( children: [ @@ -76,7 +79,7 @@ class _CovidPaymentAlertState extends State { ), ), Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0), + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 15.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -91,7 +94,7 @@ class _CovidPaymentAlertState extends State { ), Container( alignment: Alignment.center, - margin: EdgeInsets.only(top: 15.0), + margin: EdgeInsets.only(top: 5.0), child: Text( TranslationBase.of(context).covidAlertInfo, textAlign: TextAlign.center, @@ -102,7 +105,7 @@ class _CovidPaymentAlertState extends State { ), Container( margin: EdgeInsets.only( - top: 40.0, bottom: 10.0, left: 0.0, right: 20.0), + top: 20.0, bottom: 10.0, left: 0.0, right: 20.0), child: Text(TranslationBase.of(context).appoInfo, style: TextStyle( fontSize: 18.0, @@ -244,40 +247,49 @@ class _CovidPaymentAlertState extends State { ], ), ), - ], - ), - ), - 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: () { + Container( + margin: EdgeInsets.all(20.0), + child: DefaultButton( + TranslationBase.of(context).next, + () { startPaymentProcess(); - }, - child: Text(TranslationBase.of(context).next, style: TextStyle(fontSize: 18.0)), - ), - ), + }, ), ), ], ), ), + // 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)), + // ), + // ), + // ), + // ), + // ], + // ), + // ), ); } diff --git a/lib/pages/Covid-DriveThru/covid-payment-details.dart b/lib/pages/Covid-DriveThru/covid-payment-details.dart index 67b973fe..a4176348 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-details.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-details.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/Covid-DriveThru/Covid-TimeSlots.dart' import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.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/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -16,10 +17,7 @@ class CovidPaymentDetails extends StatefulWidget { List proceduresList; CovidTestProceduresResponse selectedProcedure; - CovidPaymentDetails( - {@required this.covidPaymentInfoResponse, - @required this.projectID, - @required this.proceduresList}); + CovidPaymentDetails({@required this.covidPaymentInfoResponse, @required this.projectID, @required this.proceduresList}); @override _CovidPaymentDetailsState createState() => _CovidPaymentDetailsState(); @@ -39,6 +37,8 @@ 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), @@ -49,8 +49,7 @@ class _CovidPaymentDetailsState extends State { height: 150.0, decoration: BoxDecoration( image: DecorationImage( - image: AssetImage( - "assets/images/new-design/covid-19-big-banner-bg.png"), + image: AssetImage("assets/images/new-design/covid-19-big-banner-bg.png"), fit: BoxFit.fill, ), color: Colors.white.withOpacity(0.3), @@ -59,31 +58,19 @@ class _CovidPaymentDetailsState extends State { 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), + 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)), + 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)), + 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)), ), ], ), @@ -91,23 +78,15 @@ class _CovidPaymentDetailsState extends State { ), ), Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.0), - color: Colors.white), - margin: EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 5.0), + 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), child: Column( 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)), + 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)), ), ...List.generate( widget.proceduresList.length, @@ -124,15 +103,11 @@ class _CovidPaymentDetailsState extends State { child: InkWell( onTap: () { setState(() { - widget.selectedProcedure = - widget.proceduresList[index]; + widget.selectedProcedure = widget.proceduresList[index]; }); }, child: ListTile( - title: Text( - widget.proceduresList[index] - .procedureName, - style: TextStyle(fontSize: 14.0)), + title: Text(widget.proceduresList[index].procedureName, style: TextStyle(fontSize: 14.0)), leading: Radio( value: widget.proceduresList[index], groupValue: widget.selectedProcedure, @@ -141,13 +116,8 @@ class _CovidPaymentDetailsState extends State { onChanged: (value) { setState(() { widget.selectedProcedure = value; - print(widget - .selectedProcedure.procedureName); - getPaymentInfo( - context, - widget.projectID.toString(), - widget.selectedProcedure - .procedureID); + print(widget.selectedProcedure.procedureName); + getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID); }); }, ), @@ -162,44 +132,22 @@ class _CovidPaymentDetailsState extends State { Divider(), Container( alignment: Alignment.center, - margin: - EdgeInsets.only(left: 0.0, right: 20.0, top: 10.0), - child: Text(TranslationBase.of(context).testFee, - style: TextStyle( - color: Colors.black, - fontSize: 22.0, - fontWeight: FontWeight.bold)), + 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)), ), Table( children: [ TableRow(children: [ - TableCell( - child: _getNormalText(TranslationBase.of(context) - .patientShareToDo)), - TableCell( - child: _getNormalText(widget - .covidPaymentInfoResponse.patientShareField - .toString())), + 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())), + 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())), + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo)), + TableCell(child: _getNormalText(widget.covidPaymentInfoResponse.patientShareWithTaxField.toString())), ]), ], ), @@ -221,8 +169,7 @@ class _CovidPaymentDetailsState extends State { }, activeColor: Color(0xffB8382C), ), - Texts(TranslationBase.of(context) - .iAgreeToTheTermsAndConditions), + Texts(TranslationBase.of(context).iAgreeToTheTermsAndConditions), ], ), ), @@ -232,26 +179,20 @@ class _CovidPaymentDetailsState extends State { 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")), + 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), + child: Image.asset("assets/images/new-design/payment_options_invoice_confirmation.png", width: 300), ), ], ), ), ), bottomSheet: Container( - margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 20.0), + color: Colors.grey[100], + padding: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 10.0), child: Flex( direction: Axis.horizontal, children: [ @@ -265,17 +206,9 @@ class _CovidPaymentDetailsState extends State { ), 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: () { - cancel(); - }, - child: Text(TranslationBase.of(context).cancel, - style: TextStyle(fontSize: 18.0)), - ), + child: DefaultButton(TranslationBase.of(context).cancel, () { + cancel(); + }, color: Color(0xffEAEAEA), textColor: Color(0xff000000)), ), ), ), @@ -289,14 +222,14 @@ class _CovidPaymentDetailsState extends State { ), 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: isAgree ? next : null, - child: Text(TranslationBase.of(context).next, - style: TextStyle(fontSize: 18.0)), + child: DefaultButton( + TranslationBase.of(context).next, + isAgree + ? () { + next(); + } + : null, + disabledColor: Color(0x8ac5272d), ), ), ), @@ -321,19 +254,14 @@ class _CovidPaymentDetailsState extends State { Navigator.pop(context); } - getPaymentInfo( - BuildContext context, String projectID, String selectedProcedureID) { + getPaymentInfo(BuildContext context, String projectID, String selectedProcedureID) { CovidDriveThruService service = new CovidDriveThruService(); GifLoaderDialogUtils.showMyDialog(context); - service - .getCovidPaymentInformation( - context, int.parse(projectID), selectedProcedureID) - .then((res) { + service.getCovidPaymentInformation(context, int.parse(projectID), selectedProcedureID).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { - widget.covidPaymentInfoResponse = - CovidPaymentInfoResponse.fromJson(res['COVID19_PatientShare']); + widget.covidPaymentInfoResponse = CovidPaymentInfoResponse.fromJson(res['COVID19_PatientShare']); }); } else {} }).catchError((err) { @@ -344,13 +272,7 @@ 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])), + child: Text(text, textAlign: TextAlign.end, style: TextStyle(fontSize: 15, fontFamily: 'Open-Sans', letterSpacing: 0.5, color: Colors.grey[700])), ); } } diff --git a/lib/pages/Covid-DriveThru/covid-payment-summary.dart b/lib/pages/Covid-DriveThru/covid-payment-summary.dart index 2f403991..ba8dd493 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-summary.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-summary.dart @@ -10,6 +10,7 @@ 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/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; @@ -41,6 +42,8 @@ class _CovidPaymentSummaryState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( @@ -121,14 +124,11 @@ class _CovidPaymentSummaryState extends State { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, + color: Colors.grey[100], padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: Theme.of(context).primaryColor, - label: TranslationBase.of(context).confirm.toUpperCase(), - onTap: () { + child: DefaultButton( + TranslationBase.of(context).confirm.toUpperCase(), + () { startPaymentProcess(projectViewModel.user); }, ), diff --git a/lib/pages/ErService/NearestEr.dart b/lib/pages/ErService/NearestEr.dart index 57a3a8ae..e41100fc 100644 --- a/lib/pages/ErService/NearestEr.dart +++ b/lib/pages/ErService/NearestEr.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; import 'package:diplomaticquarterapp/core/service/er/er_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -24,6 +25,8 @@ class NearestEr extends StatefulWidget { class _NearestErState extends State { List projectAvgERWaitingTimeModelList = List(); + bool isDataLoaded = false; + @override void initState() { WidgetsBinding.instance.addPostFrameCallback((_) => getERList()); @@ -39,12 +42,14 @@ class _NearestErState extends State { return AppScaffold( isShowAppBar: true, isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).NearestEr, - body: projectAvgERWaitingTimeModelList.length > 0 + body: isDataLoaded ? Container( child: ListView( children: [ - Text("${TranslationBase.of(context).NearestErDesc}", + Text(TranslationBase.of(context).NearestErDesc, textAlign: TextAlign.center, style: TextStyle(fontSize: 18.0, letterSpacing: 1.0, fontWeight: FontWeight.w900, color: new Color(0xFF60686b))), Container( margin: EdgeInsets.fromLTRB(2.0, 10.0, 0.0, 10.0), @@ -56,13 +61,13 @@ class _NearestErState extends State { controller: new ScrollController(keepScrollOffset: false), shrinkWrap: true, padding: const EdgeInsets.all(4.0), - children: List.generate(7, (index) { + children: List.generate(projectAvgERWaitingTimeModelList.length, (index) { return Container( child: CardPosition( waitingTime: projectAvgERWaitingTimeModelList[index].avgTimeInHHMM.toString(), text: projectAvgERWaitingTimeModelList[index].projectName.toString(), image: 'assets/images/new-design/find_us_icon.png', - subText: '${projectAvgERWaitingTimeModelList[index].distanceInKilometers ?? 0.0} ${TranslationBase.of(context).km_}', + subText: projectAvgERWaitingTimeModelList[index].distanceInKilometers.toString() + " " + TranslationBase.of(context).km, type: projectAvgERWaitingTimeModelList[index].iD.toString(), telephone: projectAvgERWaitingTimeModelList[index].phoneNumber.toString(), networkImage: projectAvgERWaitingTimeModelList[index].projectImageURL.toString(), @@ -94,11 +99,15 @@ class _NearestErState extends State { response['List_ProjectAvgERWaitingTime'].forEach((vital) { projectAvgERWaitingTimeModelList.add(ProjectAvgERWaitingTime.fromJson(vital)); }); + isDataLoaded = true; }); GifLoaderDialogUtils.hideDialog(context); - } else {} + } else { + isDataLoaded = false; + } }).catchError((err) { print(err); + AppToast.showErrorToast(message: err); GifLoaderDialogUtils.hideDialog(context); }); } diff --git a/lib/pages/feedback/feedback-detail.dart b/lib/pages/feedback/feedback-detail.dart index 6135aee9..06cf0865 100644 --- a/lib/pages/feedback/feedback-detail.dart +++ b/lib/pages/feedback/feedback-detail.dart @@ -15,6 +15,8 @@ class FeedbackDetails extends StatelessWidget { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).feedbackTitle, body: Container( margin: EdgeInsets.all(5), diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index abfb3e9f..262ac473 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -28,7 +28,9 @@ class ServicesView extends StatelessWidget { return InkWell( onTap: () { if (index == 0) { - Navigator.push(context, FadePage(page: LiveCareHome())); + Navigator.push(context, FadePage(page: LiveCareHome())).then((value) { + LiveCareHome.isLiveCareTypeSelected = false; + }); } else if (index == 1) { Navigator.push(context, FadePage(page: CovidDrivethruLocation())); } else if (index == 2) { diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index fa0c1b75..a8eeab12 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; class LiveCareHome extends StatefulWidget { static bool showFooterButton = true; + static bool isLiveCareTypeSelected = false; @override _LiveCareHomeState createState() => _LiveCareHomeState(); @@ -52,11 +53,12 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt return AppScaffold( appBarTitle: TranslationBase.of(context).livecare, isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, imagesInfo: imagesInfo, description: TranslationBase.of(context).erConsultation, body: Container( child: Column(children: [ - /// this is will not colored with theme data TabBar( labelColor: Colors.black, tabs: [ @@ -65,10 +67,6 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt ], controller: _tabController, ), - Divider( - color: Colors.grey[600], - thickness: 0.5, - ), Expanded( child: TabBarView( physics: NeverScrollableScrollPhysics(), diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart index 00c2b717..2e22288d 100644 --- a/lib/pages/livecare/livecare_type_select.dart +++ b/lib/pages/livecare/livecare_type_select.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -21,20 +22,25 @@ class _LiveCareTypeSelectState extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - leading: InkWell( - onTap: () { - Navigator.pop(context, null); - }, - child: Icon( - Icons.close, - color: Colors.white, - ), - ), - title: Text(TranslationBase.of(context).bookAppo, - style: TextStyle(color: Colors.white)), - ), + return AppScaffold( + isShowDecPage: true, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).livecare.toUpperCase(), + // appBar: AppBar( + // leading: InkWell( + // onTap: () { + // Navigator.pop(context, null); + // }, + // child: Icon( + // Icons.close, + // color: Colors.white, + // ), + // ), + // title: Text(TranslationBase.of(context).bookAppo, + // style: TextStyle(color: Colors.white)), + // ), body: SingleChildScrollView( child: Container( margin: EdgeInsets.only(left: 20.0, right: 20.0), @@ -55,19 +61,19 @@ class _LiveCareTypeSelectState extends State { style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20.0))), Container( - margin: EdgeInsets.only(top: 10.0), + margin: EdgeInsets.only(top: 0.0), alignment: Alignment.center, child: Text( TranslationBase.of(context).livecareServiceDesc, textAlign: TextAlign.center, style: TextStyle(fontSize: 18.0))), Container( - margin: EdgeInsets.only(top: 15.0), + margin: EdgeInsets.only(top: 5.0), child: Text(TranslationBase.of(context).whyLivecare, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20.0))), Container( - margin: EdgeInsets.only(top: 20.0, left: 20.0), + margin: EdgeInsets.only(top: 0.0, left: 20.0), child: Row( children: [ SvgPicture.asset("assets/images/new-design/check_icon.svg", @@ -116,10 +122,10 @@ class _LiveCareTypeSelectState extends State { ), ), Container( - margin: EdgeInsets.only(top: 20.0), + margin: EdgeInsets.only(top: 10.0), child: Text( TranslationBase.of(context).livecareSummary, - style: TextStyle(fontSize: 16.0))), + style: TextStyle(fontSize: 12.0))), InkWell( onTap: (){ Navigator.pop(context, "immediate"); @@ -128,7 +134,7 @@ class _LiveCareTypeSelectState extends State { decoration: BoxDecoration( color: Colors.red[900], borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 120.0, + height: 100.0, margin: EdgeInsets.only(top: 20.0), child: Row( children: [ @@ -140,8 +146,9 @@ class _LiveCareTypeSelectState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.56, - margin: EdgeInsets.fromLTRB(30.0, 20.0, 0.0, 0.0), + margin: EdgeInsets.fromLTRB(30.0, 10.0, 0.0, 0.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(TranslationBase.of(context).livecareOption1, overflow: TextOverflow.clip, @@ -150,8 +157,8 @@ class _LiveCareTypeSelectState extends State { fontSize: 18.0, color: Colors.white)), Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).livecareOption2, + margin: EdgeInsets.only(top: 0.0), + child: Text(TranslationBase.of(context).livecareOption2, textAlign: TextAlign.start, style: TextStyle( fontSize: 18.0, color: Colors.white)), ) @@ -169,7 +176,7 @@ class _LiveCareTypeSelectState extends State { decoration: BoxDecoration( color: Colors.grey[700], borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 120.0, + height: 100.0, margin: EdgeInsets.only(top: 20.0), child: Row( children: [ @@ -177,11 +184,11 @@ class _LiveCareTypeSelectState extends State { margin: EdgeInsets.only(left: 10.0, right: 10.0), child: Image.asset( "assets/images/new-design/calendar.png", - width: 70), + width: 60), ), Container( - width: MediaQuery.of(context).size.width * 0.58, - margin: EdgeInsets.fromLTRB(30.0, 20.0, 0.0, 0.0), + width: MediaQuery.of(context).size.width * 0.53, + margin: EdgeInsets.fromLTRB(30.0, 10.0, 0.0, 0.0), child: Column( children: [ Container( diff --git a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart index 4f203db2..30c273ae 100644 --- a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart +++ b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart @@ -36,7 +36,7 @@ class _LiveCarePaymentDialogState extends State { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( - height: MediaQuery.of(context).size.height * 0.691, + height: 600.0, margin: EdgeInsets.all(20.0), width: 450.0, child: SingleChildScrollView( diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index a310f4fd..b9a783b3 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart'; @@ -20,6 +21,7 @@ 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/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -58,8 +60,6 @@ class _clinic_listState extends State { MyInAppBrowser browser; - bool isLiveCareTypeSelected = false; - String liveCareClinicIDs; @override @@ -72,8 +72,13 @@ class _clinic_listState extends State { liveCareScheduleClinicsListResponse = new LiveCareScheduleClinicsListResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { - if (!isLiveCareTypeSelected) { + if (LiveCareHome.isLiveCareTypeSelected != true) { openLiveCareSelectionDialog(); + } else { + print("LiveCare Type Selected"); + setState(() { + currentSelectedLiveCareType = "immediate"; + }); } }); @@ -404,15 +409,16 @@ class _clinic_listState extends State { Navigator.pop(context); } else { print(value); - isLiveCareTypeSelected = true; if (value == "immediate") { setState(() { + LiveCareHome.isLiveCareTypeSelected = true; currentSelectedLiveCareType = "immediate"; }); getLiveCareClinicsList(); } if (value == "schedule") { setState(() { + LiveCareHome.isLiveCareTypeSelected = true; currentSelectedLiveCareType = "schedule"; }); getLiveCareScheduleClinicsList(); @@ -463,7 +469,7 @@ class _clinic_listState extends State { child: Container( width: MediaQuery.of(context).size.width, height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 0.0), child: ButtonTheme( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), @@ -491,7 +497,7 @@ class _clinic_listState extends State { children: [ isDataLoaded ? Container( - height: MediaQuery.of(context).size.height * 0.7, + height: MediaQuery.of(context).size.height * 0.8, child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -529,27 +535,17 @@ class _clinic_listState extends State { shrinkWrap: true, physics: ScrollPhysics(), padding: EdgeInsets.all(0.0), - // itemCount: liveCareClinicsListResponse.patientERGetClinicsList.length, itemCount: liveCareOfflineClinicsListResponse.length, itemBuilder: (context, index) { - return InkWell( - onTap: () { - // if (liveCareClinicsListResponse.patientERGetClinicsList[index].isOnline == 1) { - // updateSelectedIndex(liveCareOnlineClinicsListResponse[index]); - // } else { - // AppToast.showErrorToast(message: "Clinic is offline"); - // } - }, - child: ClinicCard( - isSelected: selectedClinicID == liveCareOfflineClinicsListResponse[index].serviceID ? true : false, - patientERGetClinicsList: liveCareOfflineClinicsListResponse[index], - languageID: languageID, - ), + return ClinicCard( + isSelected: selectedClinicID == liveCareOfflineClinicsListResponse[index].serviceID ? true : false, + patientERGetClinicsList: liveCareOfflineClinicsListResponse[index], + languageID: languageID, ); }, ), Container( - height: 10.0, + height: 50.0, ), ], )), @@ -559,23 +555,16 @@ class _clinic_listState extends State { ? Align( alignment: FractionalOffset.bottomCenter, child: Container( + color: Colors.grey[100], + transform: Matrix4.translationValues(0.0, -40.0, 0.0), width: MediaQuery.of(context).size.width, height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.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: new Color(0xFFbcc2c4), - onPressed: startLiveCare, - child: Text(TranslationBase.of(context).start, style: TextStyle(fontSize: 18.0)), - ), + margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 20.0), + child: Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + child: DefaultButton(TranslationBase.of(context).start, () { + startLiveCare(); + }), ), ), ) diff --git a/lib/pages/paymentService/payment_service.dart b/lib/pages/paymentService/payment_service.dart index 1b221454..4373fab8 100644 --- a/lib/pages/paymentService/payment_service.dart +++ b/lib/pages/paymentService/payment_service.dart @@ -1,16 +1,13 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/pages/ContactUs/widgets/card_common_contat.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/advance_payment_page.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/my_balance_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class PaymentService extends StatelessWidget { @@ -21,151 +18,31 @@ class PaymentService extends StatelessWidget { Widget build(BuildContext context) { projectViewModel = Provider.of(context); model = Provider.of(context); + List paymentServiceList = getPaymentServiceList(context); return AppScaffold( isShowAppBar: true, isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).paymentService, body: SingleChildScrollView( child: Container( - margin: EdgeInsets.all(12), + margin: EdgeInsets.all(20.0), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push( - context, FadePage(page: AdvancePaymentPage())), - child: Container( - margin: EdgeInsets.all(5.0), - padding: EdgeInsets.all(9), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.0), - shape: BoxShape.rectangle), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).payment, - color: HexColor('#B61422'), - bold: true, - ), - Texts( - TranslationBase.of(context).paymentOnline, - fontSize: 14, - fontWeight: FontWeight.normal, - ), - SizedBox( - height: 12, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10), - child: Image.asset( - 'assets/images/online_payment_icon.png', - fit: BoxFit.fill, - height: 55, - width: double.infinity, - ), - ), - ], - ), - ), - ), - ), - //if(!projectViewModel.havePrivilege(33)) - Expanded( - child: InkWell( - onTap: () => navigateToToDoPage(context), - child: Container( - margin: EdgeInsets.all(5.0), - padding: EdgeInsets.all(9), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.0), - shape: BoxShape.rectangle), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).onlineCheckIn, - color: HexColor('#B61422'), - bold: true, - ), - Texts( - TranslationBase.of(context).appointment, - fontSize: 14, - fontWeight: FontWeight.normal, - ), - SizedBox( - height: 12, - ), - Align( - alignment: !projectViewModel.isArabic - ? Alignment.centerRight - : Alignment.centerLeft, - child: Image.asset( - 'assets/images/device_icon.png', - height: 55, - ), - ), - ], - ), - ), - ), - ) - ], - ), - //if(!projectViewModel.havePrivilege(33)) - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push( - context, FadePage(page: MyBalancePage())), - child: Container( - margin: EdgeInsets.all(5.0), - padding: EdgeInsets.all(9), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.0), - shape: BoxShape.rectangle), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).hmg, - color: HexColor('#B61422'), - bold: true, - ), - Texts( - TranslationBase.of(context).wallet, - fontSize: 14, - fontWeight: FontWeight.normal, - ), - SizedBox( - height: 12, - ), - Align( - alignment: !projectViewModel.isArabic - ? Alignment.centerRight - : Alignment.centerLeft, - child: Image.asset( - 'assets/images/new-design/check-in.png', - height: 55, - ), - ), - ], - ), - ), - ), - ), - Expanded( - child: Container(), - ) - ], + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + padding: EdgeInsets.zero, + itemCount: paymentServiceList.length, + itemBuilder: (BuildContext context, int index) { + return paymentServiceList[index]; + }, + ), ), ], ), @@ -174,13 +51,57 @@ class PaymentService extends StatelessWidget { ); } + List getPaymentServiceList(BuildContext context) { + List medical = List(); + + medical.add( + CardCommonContact( + image: 'assets/images/online_payment_icon.png', + text: TranslationBase.of(context).payment, + subText: TranslationBase.of(context).paymentOnline, + type: 6, + width: double.infinity, + height: 55.0, + projectViewModel: projectViewModel, + model: model, + ), + ); + + medical.add( + CardCommonContact( + image: 'assets/images/device_icon.png', + text: TranslationBase.of(context).onlineCheckIn, + subText: TranslationBase.of(context).appointment, + type: 7, + width: 70.0, + height: 60.0, + projectViewModel: projectViewModel, + model: model, + ), + ); + + medical.add( + CardCommonContact( + image: 'assets/images/check-in.png', + text: TranslationBase.of(context).hmg, + subText: TranslationBase.of(context).wallet, + type: 8, + width: 60.0, + height: 55.0, + projectViewModel: projectViewModel, + model: model, + ), + ); + + return medical; + } + navigateToToDoPage(BuildContext context) { if (projectViewModel.isLogin) { if (model.count != 0) { Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); } else { - AppToast.showErrorToast( - message: TranslationBase.of(context).upcomingEmpty); + AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); } } else { Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index 8745c835..ae5a6dab 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -33,17 +33,21 @@ class LocationUtils { } else { Geolocator.isLocationServiceEnabled().then((value) { if (value) { - Geolocator.checkPermission().then((permission) { + Geolocator.checkPermission().then((permission) async { if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - Geolocator.getLastKnownPosition().then((value) { + Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 10)).then((value) { setLocation(value); if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); }); } if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) { - setZeroLocation(); - if (isShowConfirmDialog) showErrorLocationDialog(false); + if(await Permission.location.request().isGranted) { + getCurrentLocation(); + } else { + setZeroLocation(); + if (isShowConfirmDialog) showErrorLocationDialog(false); + } } }).catchError((err) { print(err); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 614e44b8..3f2af947 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2244,6 +2244,8 @@ class TranslationBase { String get seeDoctorsList => localizedValues["seeDoctorsList"][locale.languageCode]; + String get covidQuestionnaire => localizedValues["covidQuestionnaire"][locale.languageCode]; + }