|
|
|
@ -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);
|
|
|
|
|