refactor(apps): 主题系统迁移至 ColorScheme + 扩展架构并支持 Dark Mode
This commit is contained in:
@@ -6,14 +6,14 @@ import 'package:social_app/core/l10n/l10n.dart';
|
||||
import '../../../../app/di/injection.dart';
|
||||
import '../../../../app/router/app_routes.dart';
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
import '../../../../data/repositories/calendar_repository.dart';
|
||||
import '../../../../shared/widgets/app_pressable.dart';
|
||||
import '../../../home/presentation/navigation/home_return_policy.dart';
|
||||
import '../calendar_state_manager.dart';
|
||||
import '../../../../shared/widgets/bottom_dock.dart';
|
||||
import '../../../../shared/state/calendar_state_manager.dart';
|
||||
import '../../../../app/router/home_return_policy.dart';
|
||||
import '../calendar_time_utils.dart';
|
||||
import '../utils/event_color_resolver.dart';
|
||||
import '../widgets/bottom_dock.dart';
|
||||
import '../../data/models/schedule_item_model.dart';
|
||||
import '../../data/services/calendar_repository.dart';
|
||||
import '../../../../data/repositories/models/schedule_item_model.dart';
|
||||
|
||||
class CalendarMonthScreen extends StatefulWidget {
|
||||
final bool resetToToday;
|
||||
@@ -31,6 +31,8 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
late DateTime _selectedDate;
|
||||
final Map<String, List<ScheduleItemModel>> _eventsByDay = {};
|
||||
|
||||
ColorScheme get _colorScheme => Theme.of(context).colorScheme;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -79,7 +81,7 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.todoBg,
|
||||
backgroundColor: _colorScheme.surface,
|
||||
body: PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
@@ -136,18 +138,18 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
child: Text(
|
||||
l10n.calendarMonthHeader(_currentMonth.month),
|
||||
key: ValueKey(_currentMonth.month),
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.slate900,
|
||||
color: _colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
const Icon(
|
||||
Icon(
|
||||
LucideIcons.chevronDown,
|
||||
size: 16,
|
||||
color: AppColors.slate900,
|
||||
color: _colorScheme.onSurface,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -161,9 +163,11 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
height: 36,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.messageBtnWrap,
|
||||
color: _colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(AppRadius.xl),
|
||||
border: Border.all(color: AppColors.messageBtnBorder),
|
||||
border: Border.all(
|
||||
color: _colorScheme.outlineVariant,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
@@ -171,7 +175,7 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.slate700,
|
||||
color: _colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -192,13 +196,13 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.blue600,
|
||||
color: _colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(AppRadius.full),
|
||||
),
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
LucideIcons.plus,
|
||||
size: 20,
|
||||
color: AppColors.white,
|
||||
color: _colorScheme.onPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -229,7 +233,7 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
return Column(
|
||||
children: [
|
||||
_buildWeekdayHeader(),
|
||||
Container(height: 1, color: AppColors.border),
|
||||
Container(height: 1, color: _colorScheme.outlineVariant),
|
||||
..._buildWeeks(),
|
||||
],
|
||||
);
|
||||
@@ -259,10 +263,10 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
child: Center(
|
||||
child: Text(
|
||||
day,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.slate400,
|
||||
color: _colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -294,7 +298,7 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
for (var weekStart = 0; weekStart < totalCells; weekStart += 7) {
|
||||
weeks.add(_buildWeekRow(weekStart, startWeekday, daysInMonth));
|
||||
if (weekStart + 7 < totalCells) {
|
||||
weeks.add(Container(height: 1, color: AppColors.border));
|
||||
weeks.add(Container(height: 1, color: _colorScheme.outlineVariant));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +341,9 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AppColors.blue100 : Colors.transparent,
|
||||
color: isSelected
|
||||
? _colorScheme.primaryContainer
|
||||
: _colorScheme.surface.withValues(alpha: 0),
|
||||
borderRadius: BorderRadius.circular(AppRadius.full),
|
||||
),
|
||||
child: Center(
|
||||
@@ -349,8 +355,8 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
? FontWeight.w600
|
||||
: FontWeight.normal,
|
||||
color: isSelected
|
||||
? AppColors.blue600
|
||||
: AppColors.slate900,
|
||||
? _colorScheme.primary
|
||||
: _colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -447,9 +453,9 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
},
|
||||
child: Text(
|
||||
'+$remainingCount',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 9,
|
||||
color: AppColors.slate500,
|
||||
color: _colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -469,7 +475,7 @@ class _CalendarMonthScreenState extends State<CalendarMonthScreen>
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: AppColors.white,
|
||||
backgroundColor: _colorScheme.surface,
|
||||
builder: (context) {
|
||||
return StatefulBuilder(
|
||||
builder: (context, setSheetState) {
|
||||
|
||||
Reference in New Issue
Block a user