|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
import 'dart:ui' as ui;
|
|
|
|
|
|
|
|
|
|
import 'package:clarity_flutter/clarity_flutter.dart';
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
|
@ -59,6 +60,7 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
Clarity.setCurrentScreenName('Select Doctor Free Slot Page');
|
|
|
|
|
_calendarController = CalendarController();
|
|
|
|
|
scheduleMicrotask(() {
|
|
|
|
|
_events = {
|
|
|
|
|
@ -98,54 +100,56 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
|
|
|
|
|
child: Localizations.override(
|
|
|
|
|
context: context,
|
|
|
|
|
locale: isArabic ? const Locale('ar', 'SA') : const Locale('en'),
|
|
|
|
|
child: SfCalendar(
|
|
|
|
|
controller: _calendarController,
|
|
|
|
|
minDate: DateTime.now(),
|
|
|
|
|
showNavigationArrow: true,
|
|
|
|
|
// headerHeight: 60.h,
|
|
|
|
|
headerStyle: CalendarHeaderStyle(
|
|
|
|
|
backgroundColor: AppColors.transparent,
|
|
|
|
|
textAlign: isArabic ? TextAlign.end : TextAlign.start,
|
|
|
|
|
textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor),
|
|
|
|
|
),
|
|
|
|
|
viewHeaderStyle: ViewHeaderStyle(
|
|
|
|
|
// backgroundColor: AppColors.scaffoldBgColor,
|
|
|
|
|
dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor),
|
|
|
|
|
),
|
|
|
|
|
view: CalendarView.month,
|
|
|
|
|
todayHighlightColor: Colors.transparent,
|
|
|
|
|
todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold),
|
|
|
|
|
selectionDecoration: ShapeDecoration(
|
|
|
|
|
color: AppColors.transparent,
|
|
|
|
|
shape: SmoothRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10.r),
|
|
|
|
|
smoothness: 1,
|
|
|
|
|
side: BorderSide(color: AppColors.primaryRedColor, width: 1.5),
|
|
|
|
|
child: ClarityUnmask(
|
|
|
|
|
child: SfCalendar(
|
|
|
|
|
controller: _calendarController,
|
|
|
|
|
minDate: DateTime.now(),
|
|
|
|
|
showNavigationArrow: true,
|
|
|
|
|
// headerHeight: 60.h,
|
|
|
|
|
headerStyle: CalendarHeaderStyle(
|
|
|
|
|
backgroundColor: AppColors.transparent,
|
|
|
|
|
textAlign: isArabic ? TextAlign.end : TextAlign.start,
|
|
|
|
|
textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
cellBorderColor: AppColors.transparent,
|
|
|
|
|
dataSource: MeetingDataSource(_getDataSource()),
|
|
|
|
|
monthCellBuilder: (context, details) => Padding(
|
|
|
|
|
padding: EdgeInsets.all(12.h),
|
|
|
|
|
child: details.date.day.toString().toText14(
|
|
|
|
|
isCenter: true,
|
|
|
|
|
color: details.date == _calendarController.selectedDate ? AppColors.primaryRedColor : AppColors.textColor,
|
|
|
|
|
isEnglishOnly: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
monthViewSettings: MonthViewSettings(
|
|
|
|
|
dayFormat: "EEE",
|
|
|
|
|
appointmentDisplayMode: MonthAppointmentDisplayMode.indicator,
|
|
|
|
|
showTrailingAndLeadingDates: false,
|
|
|
|
|
appointmentDisplayCount: 1,
|
|
|
|
|
monthCellStyle: MonthCellStyle(
|
|
|
|
|
textStyle: TextStyle(fontSize: 19.f),
|
|
|
|
|
viewHeaderStyle: ViewHeaderStyle(
|
|
|
|
|
// backgroundColor: AppColors.scaffoldBgColor,
|
|
|
|
|
dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor),
|
|
|
|
|
),
|
|
|
|
|
view: CalendarView.month,
|
|
|
|
|
todayHighlightColor: Colors.transparent,
|
|
|
|
|
todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold),
|
|
|
|
|
selectionDecoration: ShapeDecoration(
|
|
|
|
|
color: AppColors.transparent,
|
|
|
|
|
shape: SmoothRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10.r),
|
|
|
|
|
smoothness: 1,
|
|
|
|
|
side: BorderSide(color: AppColors.primaryRedColor, width: 1.5),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
cellBorderColor: AppColors.transparent,
|
|
|
|
|
dataSource: MeetingDataSource(_getDataSource()),
|
|
|
|
|
monthCellBuilder: (context, details) => Padding(
|
|
|
|
|
padding: EdgeInsets.all(12.h),
|
|
|
|
|
child: details.date.day.toString().toText14(
|
|
|
|
|
isCenter: true,
|
|
|
|
|
color: details.date == _calendarController.selectedDate ? AppColors.primaryRedColor : AppColors.textColor,
|
|
|
|
|
isEnglishOnly: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
monthViewSettings: MonthViewSettings(
|
|
|
|
|
dayFormat: "EEE",
|
|
|
|
|
appointmentDisplayMode: MonthAppointmentDisplayMode.indicator,
|
|
|
|
|
showTrailingAndLeadingDates: false,
|
|
|
|
|
appointmentDisplayCount: 1,
|
|
|
|
|
monthCellStyle: MonthCellStyle(
|
|
|
|
|
textStyle: TextStyle(fontSize: 19.f),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onTap: (CalendarTapDetails details) {
|
|
|
|
|
_calendarController.selectedDate = details.date;
|
|
|
|
|
_onDaySelected(details.date!);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
onTap: (CalendarTapDetails details) {
|
|
|
|
|
_calendarController.selectedDate = details.date;
|
|
|
|
|
_onDaySelected(details.date!);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -153,35 +157,37 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
|
|
|
|
|
SizedBox(height: 10.h),
|
|
|
|
|
Transform.translate(
|
|
|
|
|
offset: const Offset(0.0, -10.0),
|
|
|
|
|
child: selectedDateDisplay.toText16(isBold: true, isEnglishOnly: !isArabic),
|
|
|
|
|
child: ClarityUnmask(child: selectedDateDisplay.toText16(isBold: true, isEnglishOnly: !isArabic)),
|
|
|
|
|
),
|
|
|
|
|
//TODO: Add Next Day Span here
|
|
|
|
|
dayEvents.isNotEmpty
|
|
|
|
|
? ConstrainedBox(
|
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
|
maxHeight: MediaQuery.of(context).size.height * 0.15,
|
|
|
|
|
minHeight: 0,
|
|
|
|
|
),
|
|
|
|
|
child: Directionality(
|
|
|
|
|
textDirection: isArabic ? ui.TextDirection.rtl : ui.TextDirection.ltr,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
child: Wrap(
|
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
|
alignment: WrapAlignment.start,
|
|
|
|
|
spacing: 6.h,
|
|
|
|
|
runSpacing: 6.h,
|
|
|
|
|
children: List.generate(
|
|
|
|
|
dayEvents.length,
|
|
|
|
|
(index) => TimeSlotChip(
|
|
|
|
|
label: dayEvents[index].isoTime!,
|
|
|
|
|
isSelected: index == selectedButtonIndex,
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedButtonIndex = index;
|
|
|
|
|
selectedTime = dayEvents[index].isoTime!;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
? ClarityUnmask(
|
|
|
|
|
child: ConstrainedBox(
|
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
|
maxHeight: MediaQuery.of(context).size.height * 0.15,
|
|
|
|
|
minHeight: 0,
|
|
|
|
|
),
|
|
|
|
|
child: Directionality(
|
|
|
|
|
textDirection: isArabic ? ui.TextDirection.rtl : ui.TextDirection.ltr,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
child: Wrap(
|
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
|
alignment: WrapAlignment.start,
|
|
|
|
|
spacing: 6.h,
|
|
|
|
|
runSpacing: 6.h,
|
|
|
|
|
children: List.generate(
|
|
|
|
|
dayEvents.length,
|
|
|
|
|
(index) => TimeSlotChip(
|
|
|
|
|
label: dayEvents[index].isoTime!,
|
|
|
|
|
isSelected: index == selectedButtonIndex,
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedButtonIndex = index;
|
|
|
|
|
selectedTime = dayEvents[index].isoTime!;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|