feat:更新主题颜色布局

This commit is contained in:
2026-04-30 17:25:52 +08:00
parent 43c4f4e6fa
commit 6838d84cec
5 changed files with 45 additions and 43 deletions

View File

@@ -1,3 +1,5 @@
import 'dart:ui';
import 'package:fluent_ui/fluent_ui.dart'; import 'package:fluent_ui/fluent_ui.dart';
import 'package:hive_flutter/adapters.dart'; import 'package:hive_flutter/adapters.dart';
import 'package:task_hub/models/task.dart'; import 'package:task_hub/models/task.dart';
@@ -56,32 +58,37 @@ class _MainLayoutState extends State<MainLayout> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final iconColor = FluentTheme.of(context).accentColor;
final paneColor = FluentTheme.of(context).accentColor.lightest;
return NavigationView( return NavigationView(
titleBar: TitleBar(title: const Text('拾光记')), titleBar: TitleBar(
title: const Text('拾光记', style: TextStyle(fontSize: 18)),
),
pane: NavigationPane( pane: NavigationPane(
selected: _currentIndex, selected: _currentIndex,
onChanged: (index) => setState(() => _currentIndex = index), onChanged: (index) => setState(() => _currentIndex = index),
size: NavigationPaneSize(openWidth: 150), size: NavigationPaneSize(openWidth: 150),
items: [ items: [
PaneItem( PaneItem(
icon: const Icon(FluentIcons.home), icon: Icon(FluentIcons.home, color: iconColor),
title: const Text('首页'), title: const Text('首页', style: TextStyle(fontSize: 16)),
body: Container(color: Colors.white, child: const HomePage()), body: Container(color: paneColor, child: const HomePage()),
), ),
PaneItem( PaneItem(
icon: const Icon(FluentIcons.check_list), icon: Icon(FluentIcons.check_list, color: iconColor),
title: const Text('待办'), title: const Text('待办', style: TextStyle(fontSize: 16)),
body: Container(color: Colors.white, child: const TaskPage()), body: Container(color: paneColor, child: const TaskPage()),
), ),
PaneItem( PaneItem(
icon: const Icon(FluentIcons.calendar), icon: Icon(FluentIcons.calendar, color: iconColor),
title: const Text('日程'), title: const Text('日程', style: TextStyle(fontSize: 16)),
body: Container(color: Colors.white, child: const SchedulePage()), body: Container(color: paneColor, child: const SchedulePage()),
), ),
PaneItemSeparator(), PaneItemSeparator(),
PaneItem( PaneItem(
icon: const Icon(FluentIcons.settings), icon: Icon(FluentIcons.settings, color: iconColor),
title: const Text('设置'), title: const Text('设置', style: TextStyle(fontSize: 16)),
body: Container(color: Colors.white, child: const SettingsPage()), body: Container(color: Colors.white, child: const SettingsPage()),
), ),
], ],

View File

@@ -7,23 +7,15 @@ class HomePage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ScaffoldPage.withPadding( return ScaffoldPage.withPadding(
header: const PageHeader( header: const PageHeader(
title: Text('首页'), title: Text('首页', style: TextStyle(color: Colors.white)),
), ),
content: Center( content: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Icon( Icon(FluentIcons.home, size: 64, color: Colors.white),
FluentIcons.home,
size: 64,
),
const SizedBox(height: 20), const SizedBox(height: 20),
Text( Text('首页', style: TextStyle(fontSize: 24, color: Colors.white)),
'首页',
style: TextStyle(
fontSize: 24,
),
),
], ],
), ),
), ),

View File

@@ -106,13 +106,13 @@ class _SchedulePageState extends State<SchedulePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ScaffoldPage.withPadding( return ScaffoldPage.withPadding(
header: PageHeader( header: PageHeader(
title: const Text('日程安排'), title: const Text('日程安排', style: TextStyle(color: Colors.white)),
commandBar: CommandBar( commandBar: CommandBar(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
primaryItems: [ primaryItems: [
CommandBarButton( CommandBarButton(
icon: const Icon(FluentIcons.add), icon: const Icon(FluentIcons.add, color: Colors.white),
label: const Text('添加日程'), label: const Text('添加日程', style: TextStyle(color: Colors.white)),
onPressed: () => _addSchedule(null), onPressed: () => _addSchedule(null),
), ),
], ],
@@ -146,27 +146,36 @@ class _SchedulePageState extends State<SchedulePage> {
value: 'week', value: 'week',
label: Text( label: Text(
'周视图', '周视图',
style: TextStyle(fontFamily: 'CustomFont'), style: TextStyle(
fontFamily: 'CustomFont',
color: Colors.white,
),
), ),
), ),
ButtonSegment( ButtonSegment(
value: 'month', value: 'month',
label: Text( label: Text(
'月视图', '月视图',
style: TextStyle(fontFamily: 'CustomFont'), style: TextStyle(
fontFamily: 'CustomFont',
color: Colors.white,
),
), ),
), ),
ButtonSegment( ButtonSegment(
value: 'schedule', value: 'schedule',
label: Text( label: Text(
'日程视图', '日程视图',
style: TextStyle(fontFamily: 'CustomFont'), style: TextStyle(
fontFamily: 'CustomFont',
color: Colors.white,
),
), ),
), ),
], ],
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Expanded(child: _buildSfCalendar()), Expanded(child: Card(child: _buildSfCalendar())),
], ],
), ),
), ),

View File

@@ -123,13 +123,13 @@ class _TaskPageState extends State<TaskPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ScaffoldPage.withPadding( return ScaffoldPage.withPadding(
header: PageHeader( header: PageHeader(
title: const Text('待办任务'), title: const Text('待办任务', style: TextStyle(color: Colors.white)),
commandBar: CommandBar( commandBar: CommandBar(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
primaryItems: [ primaryItems: [
CommandBarButton( CommandBarButton(
icon: const Icon(FluentIcons.add), icon: const Icon(FluentIcons.add, color: Colors.white),
label: const Text('添加任务'), label: const Text('添加任务', style: TextStyle(color: Colors.white)),
onPressed: _addTask, onPressed: _addTask,
), ),
], ],
@@ -155,7 +155,6 @@ class _TaskPageState extends State<TaskPage> {
final activeCount = _tasks.length - completedCount; final activeCount = _tasks.length - completedCount;
return Card( return Card(
backgroundColor: FluentTheme.of(context).accentColor.lighter,
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Row( child: Row(
@@ -175,21 +174,16 @@ class _TaskPageState extends State<TaskPage> {
children: [ children: [
Text( Text(
value, value,
style: TextStyle( style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text(label, style: TextStyle(color: Colors.white)), Text(label),
], ],
); );
} }
Widget _buildFilterWidget() { Widget _buildFilterWidget() {
return Card( return Card(
borderColor: Colors.white,
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Row( child: Row(

View File

@@ -1 +1 @@
name: task_hub name: task_hub