fixes and updates

pull/230/head
Sultan khan 2 days ago
parent 3d226c39d0
commit 8e8177e573

@ -117,7 +117,7 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
SizedBox(height: 24.h), SizedBox(height: 24.h),
getSelectedTabData(bookAppointmentsVM.selectedTabIndex), getSelectedTabData(bookAppointmentsVM.selectedTabIndex),
SizedBox(height: 24.h), SizedBox(height: 24.h),
if (appState.isAuthenticated) ...[ if (appState.isAuthenticated && bookAppointmentsVM.selectedTabIndex == 0) ...[
Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) { Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) {
return myAppointmentsVM.isPatientMyDoctorsLoading return myAppointmentsVM.isPatientMyDoctorsLoading
? SizedBox( ? SizedBox(

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:ui' as ui;
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -73,6 +74,8 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false); bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
authVM = Provider.of<AuthenticationViewModel>(context, listen: false); authVM = Provider.of<AuthenticationViewModel>(context, listen: false);
appState = getIt.get<AppState>(); appState = getIt.get<AppState>();
final isArabic = appState.isArabic();
return Padding( return Padding(
padding: EdgeInsets.symmetric(horizontal: 0.h), padding: EdgeInsets.symmetric(horizontal: 0.h),
child: Column( child: Column(
@ -90,9 +93,11 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
// ), // ),
SizedBox( SizedBox(
height: 350.h, height: 350.h,
child: Directionality(
textDirection: isArabic ? ui.TextDirection.rtl : ui.TextDirection.ltr,
child: Localizations.override( child: Localizations.override(
context: context, context: context,
locale: const Locale('en'), locale: isArabic ? const Locale('ar', 'SA') : const Locale('en'),
child: SfCalendar( child: SfCalendar(
controller: _calendarController, controller: _calendarController,
minDate: DateTime.now(), minDate: DateTime.now(),
@ -100,16 +105,16 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
headerHeight: 60.h, headerHeight: 60.h,
headerStyle: CalendarHeaderStyle( headerStyle: CalendarHeaderStyle(
backgroundColor: AppColors.transparent, backgroundColor: AppColors.transparent,
textAlign: TextAlign.start, textAlign: isArabic ? TextAlign.end : TextAlign.start,
textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor, fontFamily: "Poppins"), textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor),
), ),
viewHeaderStyle: ViewHeaderStyle( viewHeaderStyle: ViewHeaderStyle(
// backgroundColor: AppColors.scaffoldBgColor, // backgroundColor: AppColors.scaffoldBgColor,
dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor, fontFamily: "Poppins"), dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor),
), ),
view: CalendarView.month, view: CalendarView.month,
todayHighlightColor: Colors.transparent, todayHighlightColor: Colors.transparent,
todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold, fontFamily: "Poppins"), todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold),
selectionDecoration: ShapeDecoration( selectionDecoration: ShapeDecoration(
color: AppColors.transparent, color: AppColors.transparent,
shape: SmoothRectangleBorder( shape: SmoothRectangleBorder(
@ -144,15 +149,18 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
), ),
), ),
), ),
),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Transform.translate( Transform.translate(
offset: const Offset(0.0, -10.0), offset: const Offset(0.0, -10.0),
child: selectedDateDisplay.toText16(isBold: true, isEnglishOnly: true), child: selectedDateDisplay.toText16(isBold: true, isEnglishOnly: !isArabic),
), ),
//TODO: Add Next Day Span here //TODO: Add Next Day Span here
dayEvents.isNotEmpty dayEvents.isNotEmpty
? SizedBox( ? SizedBox(
height: 100.h, height: 100.h,
child: Directionality(
textDirection: isArabic ? ui.TextDirection.rtl : ui.TextDirection.ltr,
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
child: Wrap( child: Wrap(
@ -175,6 +183,7 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
), ),
), ),
), ),
),
) )
: Utils.getNoDataWidget(context, noDataText: LocaleKeys.noFreeSlot.tr(context: context)), : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noFreeSlot.tr(context: context)),
@ -322,9 +331,12 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
void _onDaySelected(DateTime day) { void _onDaySelected(DateTime day) {
final DateFormat formatter = DateFormat('yyyy-MM-dd', "en-US"); final DateFormat formatter = DateFormat('yyyy-MM-dd', "en-US");
final isArabic = appState.isArabic();
setState(() { setState(() {
selectedDateDisplay = DateUtil.getMonthDayYearDateFormatted(day); selectedDateDisplay = isArabic
selectedNextDate = DateUtil.getWeekDayMonthDayYearDateFormatted(day.add(Duration(days: 1)), "en"); ? DateUtil.getMonthDayYearDateFormattedAr(day)
: DateUtil.getMonthDayYearDateFormatted(day);
selectedNextDate = DateUtil.getWeekDayMonthDayYearDateFormatted(day.add(Duration(days: 1)), isArabic ? "ar" : "en");
_calendarController.selectedDate = day; _calendarController.selectedDate = day;
openTimeSlotsPickerForDate(day, bookAppointmentsViewModel.docFreeSlots); openTimeSlotsPickerForDate(day, bookAppointmentsViewModel.docFreeSlots);
selectedDate = formatter.format(day); selectedDate = formatter.format(day);

Loading…
Cancel
Save