refactored broad range of the application, split files, modularized calendar and file views, centralized bottom sheets and clipboard handling, and implemented unit test coverage
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
part of '../custom_workweek_calendar.dart';
|
||||
|
||||
class _DayHeaderStrip extends StatelessWidget {
|
||||
final DateTime weekStart;
|
||||
final DateTime today;
|
||||
final double rulerWidth;
|
||||
|
||||
const _DayHeaderStrip({
|
||||
super.key,
|
||||
required this.weekStart,
|
||||
required this.today,
|
||||
required this.rulerWidth,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Row(
|
||||
children: [
|
||||
SizedBox(width: rulerWidth),
|
||||
for (var d = 0; d < 5; d++)
|
||||
Expanded(
|
||||
child: _DayHeaderCell(
|
||||
date: weekStart.add(Duration(days: d)),
|
||||
today: today,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
class _DayHeaderCell extends StatelessWidget {
|
||||
final DateTime date;
|
||||
final DateTime today;
|
||||
|
||||
const _DayHeaderCell({required this.date, required this.today});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isToday = date.isSameDay(today);
|
||||
final dayName = DateFormat('EE', Localizations.localeOf(context).toString()).format(date).toUpperCase();
|
||||
|
||||
final accent = theme.colorScheme.primary;
|
||||
final onAccent = theme.colorScheme.onPrimary;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
dayName,
|
||||
style: theme.textTheme.labelSmall?.copyWith(
|
||||
color: isToday ? accent : theme.colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
height: 1.1,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 220),
|
||||
curve: Curves.easeOutCubic,
|
||||
width: 28,
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: isToday ? accent : Colors.transparent,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'${date.day}',
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
color: isToday ? onAccent : theme.colorScheme.onSurface,
|
||||
fontWeight: isToday ? FontWeight.bold : FontWeight.normal,
|
||||
height: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user