mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 16:44:55 +00:00
Refactor booking system: enhance parameter handling for improved clarity and maintainability
This commit is contained in:
@ -47,11 +47,8 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.only(left: 25.0, right: 25.0, top: 25),
|
padding: const EdgeInsets.only(left: 25.0, right: 25.0, top: 25),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
AbsorbPointer(
|
WeekView(
|
||||||
absorbing: false,
|
pageViewPhysics: const NeverScrollableScrollPhysics(),
|
||||||
ignoringSemantics: false,
|
|
||||||
child: WeekView(
|
|
||||||
scrollPhysics: const NeverScrollableScrollPhysics(),
|
|
||||||
key: ValueKey(weekStart),
|
key: ValueKey(weekStart),
|
||||||
controller: eventController,
|
controller: eventController,
|
||||||
initialDay: weekStart,
|
initialDay: weekStart,
|
||||||
@ -68,10 +65,9 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
weekDayBuilder: (date) {
|
weekDayBuilder: (date) {
|
||||||
final weekDays = _getWeekDays(weekStart);
|
final weekDays = _getWeekDays(weekStart);
|
||||||
final selectedDayIndex = weekDays
|
final selectedDayIndex =
|
||||||
.indexWhere((d) => isSameDay(d, selectedDate));
|
weekDays.indexWhere((d) => isSameDay(d, selectedDate));
|
||||||
final index =
|
final index = weekDays.indexWhere((d) => isSameDay(d, date));
|
||||||
weekDays.indexWhere((d) => isSameDay(d, date));
|
|
||||||
final isSelectedDay = index == selectedDayIndex;
|
final isSelectedDay = index == selectedDayIndex;
|
||||||
final isToday = isSameDay(date, DateTime.now());
|
final isToday = isSameDay(date, DateTime.now());
|
||||||
|
|
||||||
@ -119,8 +115,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding: const EdgeInsets.only(left: 2, top: 6),
|
||||||
const EdgeInsets.only(left: 2, top: 6),
|
|
||||||
child: Text(
|
child: Text(
|
||||||
period,
|
period,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@ -153,10 +148,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
firstDayOfWeek.timeZoneName.replaceAll(':00', ''),
|
firstDayOfWeek.timeZoneName.replaceAll(':00', ''),
|
||||||
style: Theme.of(context)
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
.textTheme
|
|
||||||
.bodyMedium
|
|
||||||
?.copyWith(
|
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: ColorsManager.blackColor,
|
color: ColorsManager.blackColor,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
@ -167,8 +159,8 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
eventTileBuilder: (date, events, boundary, start, end) {
|
eventTileBuilder: (date, events, boundary, start, end) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.symmetric(
|
margin:
|
||||||
vertical: 2, horizontal: 2),
|
const EdgeInsets.symmetric(vertical: 2, horizontal: 2),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: events.map((event) {
|
children: events.map((event) {
|
||||||
@ -188,8 +180,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
DateFormat('h:mm a')
|
DateFormat('h:mm a').format(event.startTime!),
|
||||||
.format(event.startTime!),
|
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@ -212,7 +203,7 @@ class WeeklyCalendarPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)),
|
),
|
||||||
if (selectedDayIndex >= 0)
|
if (selectedDayIndex >= 0)
|
||||||
Positioned(
|
Positioned(
|
||||||
left: (timeLineWidth + 3) +
|
left: (timeLineWidth + 3) +
|
||||||
|
|||||||
Reference in New Issue
Block a user