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