factor:布局颜色重构

This commit is contained in:
2025-11-20 11:04:29 +08:00
parent a582ebb3e4
commit 6e97d7f33f
16 changed files with 311 additions and 284 deletions

View File

@@ -128,50 +128,51 @@ class CalendarPageState extends State<CalendarPage> {
}
}
Widget _buildCalendarTabs() {
return buildTabs(
context: context,
currentTab: _currentTab,
onTabChanged: (value) {
setState(() {
_currentTab = value;
_calendarController.view = value.view;
});
},
);
}
@override
Widget build(BuildContext context) {
final provider = Provider.of<CalendarProvider>(context, listen: false);
return Padding(
padding: EdgeInsets.all(10),
child: Column(
children: [
buildTabs(
return Column(
children: [
_buildCalendarTabs(),
Expanded(
child: buildCalendar(
context: context,
currentTab: _currentTab,
onTabChanged: (value) {
setState(() {
_currentTab = value;
_calendarController.view = value.view;
});
controller: _calendarController,
dataSource: AppointmentDataSource(_appointments),
onAdd: () {
if (_calendarController.view == CalendarView.week) {
_showDialog(false, provider.formItem);
}
},
onEdit: (appointment) {
final calendar = calendarService.getCalendarById(
appointment.id as int,
);
_showDialog(true, calendar);
},
onDelete: (appointment) {
final calendar = calendarService.getCalendarById(
appointment.id as int,
);
_deleteCalendar(calendar);
},
),
Expanded(
child: buildCalendar(
context: context,
controller: _calendarController,
dataSource: AppointmentDataSource(_appointments),
onAdd: () {
if (_calendarController.view == CalendarView.week) {
_showDialog(false, provider.formItem);
}
},
onEdit: (appointment) {
final calendar = calendarService.getCalendarById(
appointment.id as int,
);
_showDialog(true, calendar);
},
onDelete: (appointment) {
final calendar = calendarService.getCalendarById(
appointment.id as int,
);
_deleteCalendar(calendar);
},
),
),
],
),
),
],
);
}
}

View File

@@ -40,23 +40,23 @@ class FlispPageState extends State<FlispPage> {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(10),
child: Column(
children: [
buildTabs(
context: context,
currentTab: _currentTab,
onTabChanged: (value) {
setState(() {
_currentTab = value;
});
},
),
// 待办事项列表
Expanded(child: _buildActiveFlispList(context)),
],
),
return Column(
children: [
_buildFlispTabs(),
Expanded(child: _buildActiveFlispList(context)),
],
);
}
Widget _buildFlispTabs() {
return buildTabs(
context: context,
currentTab: _currentTab,
onTabChanged: (value) {
setState(() {
_currentTab = value;
});
},
);
}

View File

@@ -224,52 +224,44 @@ class StatsPageState extends State<StatsPage> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: [
YearSelector(
initialYear: DateTime.now().year,
minYear: 2000,
maxYear: 2100,
onYearChanged: (year) => {
setState(() {
currentYear = year;
refreshStats();
})
},
),
SizedBox(
height: statsHeight,
child: _buildFlispStats(context),
),
SizedBox(height: 10),
SizedBox(
height: statsHeight,
child: _buildTodoStats(context),
),
SizedBox(height: 10),
SizedBox(
height: chartHeight,
child: BuildCard(child: _buildFlispMonthlyStats(context)),
),
SizedBox(height: 10),
SizedBox(
height: chartHeight,
child: BuildCard(child: _buildFlispCategoryStats(context)),
),
SizedBox(height: 10),
SizedBox(
height: chartHeight,
child: BuildCard(child: _buildTodoMonthlyStats(context)),
),
SizedBox(height: 10),
SizedBox(
height: chartHeight,
child: BuildCard(child: _buildTodoPriorityStats(context)),
),
],
),
child: Column(
children: [
YearSelector(
initialYear: DateTime.now().year,
minYear: 2000,
maxYear: 2100,
onYearChanged:
(year) => {
setState(() {
currentYear = year;
refreshStats();
}),
},
),
SizedBox(height: statsHeight, child: _buildFlispStats(context)),
SizedBox(height: 10),
SizedBox(height: statsHeight, child: _buildTodoStats(context)),
SizedBox(height: 10),
SizedBox(
height: chartHeight,
child: BuildCard(child: _buildFlispMonthlyStats(context)),
),
SizedBox(height: 10),
SizedBox(
height: chartHeight,
child: BuildCard(child: _buildFlispCategoryStats(context)),
),
SizedBox(height: 10),
SizedBox(
height: chartHeight,
child: BuildCard(child: _buildTodoMonthlyStats(context)),
),
SizedBox(height: 10),
SizedBox(
height: chartHeight,
child: BuildCard(child: _buildTodoPriorityStats(context)),
),
],
),
);
}

View File

@@ -42,23 +42,23 @@ class TodoPageState extends State<TodoPage> {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(10),
child: Column(
children: [
buildTabs(
context: context,
currentTab: _currentTab,
onTabChanged: (value) {
setState(() {
_currentTab = value;
});
},
),
// 待办事项列表
Expanded(child: _buildActiveTodoList(context)),
],
),
return Column(
children: [
_buildTodoTabs(),
Expanded(child: _buildActiveTodoList(context)),
],
);
}
Widget _buildTodoTabs() {
return buildTabs(
context: context,
currentTab: _currentTab,
onTabChanged: (value) {
setState(() {
_currentTab = value;
});
},
);
}