Update: 2026-08-08 16:55:39
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../constant/finance_design_system.dart';
|
||||
import '../../../controller/home/journal/schedule_controller.dart';
|
||||
import '../../widgets/ui/siro_ui.dart';
|
||||
|
||||
class SchedulePage extends StatelessWidget {
|
||||
SchedulePage({super.key});
|
||||
@@ -9,71 +9,34 @@ class SchedulePage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: FinanceDesignSystem.backgroundColor,
|
||||
appBar: AppBar(
|
||||
title: Text('My Schedule'.tr,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: FinanceDesignSystem.primaryDark)),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios_new_rounded,
|
||||
color: FinanceDesignSystem.primaryDark, size: 20),
|
||||
onPressed: () => Get.back()),
|
||||
),
|
||||
return SiroPage(
|
||||
title: 'My Schedule'.tr,
|
||||
padding: SiroUi.pageInsets,
|
||||
body: GetBuilder<ScheduleController>(builder: (sc) {
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child:
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
// Summary Card
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: FinanceDesignSystem.balanceGradient,
|
||||
borderRadius:
|
||||
BorderRadius.circular(FinanceDesignSystem.cardRadius),
|
||||
),
|
||||
child: Row(children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Weekly Plan'.tr,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.7),
|
||||
fontSize: 14)),
|
||||
const SizedBox(height: 8),
|
||||
Text('${sc.totalWeeklyHours.toStringAsFixed(1)}h',
|
||||
style: const TextStyle(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: Colors.white)),
|
||||
Text('${sc.activeDays} ${'Days'.tr}',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.6),
|
||||
fontSize: 13)),
|
||||
])),
|
||||
Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SiroHeroHeader(
|
||||
label: 'Weekly Plan'.tr,
|
||||
value: '${sc.totalWeeklyHours.toStringAsFixed(1)}h',
|
||||
caption: '${sc.activeDays} ${'Days'.tr}',
|
||||
icon: Icons.calendar_today_rounded,
|
||||
trailing: Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(14)),
|
||||
child: const Icon(Icons.calendar_today_rounded,
|
||||
color: Colors.white, size: 28),
|
||||
color: Colors.white.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: const Icon(Icons.calendar_month_rounded,
|
||||
color: Colors.white, size: 26),
|
||||
),
|
||||
]),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
Text('Work Days'.tr, style: FinanceDesignSystem.headingStyle),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
...sc.schedule.map((slot) => _buildDayCard(context, slot, sc)),
|
||||
]),
|
||||
),
|
||||
SiroSectionTitle('Work Days'.tr),
|
||||
...sc.schedule.map((slot) => _buildDayCard(context, slot, sc)),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -82,76 +45,72 @@ class SchedulePage extends StatelessWidget {
|
||||
Widget _buildDayCard(
|
||||
BuildContext context, WorkSlot slot, ScheduleController sc) {
|
||||
final isAr = Get.locale?.languageCode == 'ar';
|
||||
return Container(
|
||||
final accent = SiroUi.interactive(context);
|
||||
final off = SiroUi.subtle(context);
|
||||
|
||||
return SiroCard(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: slot.isActive ? Colors.white : Colors.grey.shade50,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
boxShadow: slot.isActive
|
||||
? [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.03),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 3))
|
||||
]
|
||||
: null,
|
||||
),
|
||||
accent: slot.isActive ? accent : null,
|
||||
child: Row(children: [
|
||||
// Toggle
|
||||
GestureDetector(
|
||||
onTap: () => sc.toggleDay(slot.dayOfWeek),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
width: 44,
|
||||
height: 44,
|
||||
width: 42,
|
||||
height: 42,
|
||||
decoration: BoxDecoration(
|
||||
color: slot.isActive
|
||||
? FinanceDesignSystem.accentBlue.withValues(alpha: 0.1)
|
||||
: Colors.grey.shade200,
|
||||
? accent.withValues(alpha: 0.12)
|
||||
: off.withValues(alpha: 0.10),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
isAr ? slot.dayNameAr.substring(0, 2) : slot.dayName,
|
||||
style: TextStyle(
|
||||
child: Text(
|
||||
isAr ? slot.dayNameAr.substring(0, 2) : slot.dayName,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: slot.isActive
|
||||
? FinanceDesignSystem.accentBlue
|
||||
: Colors.grey.shade400),
|
||||
)),
|
||||
color: slot.isActive ? accent : off,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
const SizedBox(width: 12),
|
||||
// Day name
|
||||
Expanded(
|
||||
child:
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(isAr ? slot.dayNameAr : slot.dayName.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: slot.isActive
|
||||
? FinanceDesignSystem.primaryDark
|
||||
: Colors.grey.shade400)),
|
||||
if (slot.isActive)
|
||||
Text(slot.timeRange,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey.shade500)),
|
||||
if (!slot.isActive)
|
||||
Text('Day Off'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey.shade400,
|
||||
fontStyle: FontStyle.italic)),
|
||||
])),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
isAr ? slot.dayNameAr : slot.dayName.tr,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: slot.isActive ? null : off,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
slot.isActive ? slot.timeRange : 'Day Off'.tr,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontSize: 12,
|
||||
fontStyle:
|
||||
slot.isActive ? FontStyle.normal : FontStyle.italic,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Time pickers
|
||||
if (slot.isActive) ...[
|
||||
_timePicker(context, slot.startTime,
|
||||
(t) => sc.updateStartTime(slot.dayOfWeek, t)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text('-', style: TextStyle(color: Colors.grey.shade400))),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 3),
|
||||
child: Text('-', style: TextStyle(color: off)),
|
||||
),
|
||||
_timePicker(context, slot.endTime,
|
||||
(t) => sc.updateEndTime(slot.dayOfWeek, t)),
|
||||
],
|
||||
@@ -159,7 +118,7 @@ class SchedulePage extends StatelessWidget {
|
||||
Switch(
|
||||
value: slot.isActive,
|
||||
onChanged: (_) => sc.toggleDay(slot.dayOfWeek),
|
||||
activeThumbColor: FinanceDesignSystem.accentBlue,
|
||||
activeThumbColor: accent,
|
||||
),
|
||||
]),
|
||||
);
|
||||
@@ -174,16 +133,19 @@ class SchedulePage extends StatelessWidget {
|
||||
if (picked != null) onChanged(picked);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade100,
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
color: SiroUi.interactive(context).withValues(alpha: 0.10),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'${time.hour.toString().padLeft(2, '0')}:${time.minute.toString().padLeft(2, '0')}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: FinanceDesignSystem.primaryDark)),
|
||||
'${time.hour.toString().padLeft(2, '0')}:${time.minute.toString().padLeft(2, '0')}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: SiroUi.interactive(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user