99 lines
2.5 KiB
Dart
99 lines
2.5 KiB
Dart
import 'package:fluent_ui/fluent_ui.dart';
|
|
import 'package:task_hub/pages/home_page.dart';
|
|
import 'package:task_hub/pages/schedule_page.dart';
|
|
import 'package:task_hub/pages/settings_page.dart';
|
|
import 'package:task_hub/pages/task_page.dart';
|
|
|
|
void main() {
|
|
runApp(const TaskHubApp());
|
|
}
|
|
|
|
class TaskHubApp extends StatelessWidget {
|
|
const TaskHubApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FluentApp(
|
|
title: 'TaskHub',
|
|
themeMode: ThemeMode.system,
|
|
theme: FluentThemeData(
|
|
fontFamily: 'CustomFont',
|
|
),
|
|
debugShowCheckedModeBanner: false,
|
|
home: const MainLayout(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MainLayout extends StatefulWidget {
|
|
const MainLayout({super.key});
|
|
|
|
@override
|
|
State<MainLayout> createState() => _MainLayoutState();
|
|
}
|
|
|
|
class _MainLayoutState extends State<MainLayout> {
|
|
int _currentIndex = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return NavigationView(
|
|
titleBar: TitleBar(
|
|
icon: const FlutterLogo(),
|
|
title: const Text('TaskHub')
|
|
),
|
|
pane: NavigationPane(
|
|
selected: _currentIndex,
|
|
onChanged: (index) => setState(() => _currentIndex = index),
|
|
size: NavigationPaneSize(
|
|
openWidth: 150
|
|
),
|
|
items: [
|
|
PaneItem(
|
|
icon: const Icon(FluentIcons.home),
|
|
title: const Text('首页'),
|
|
body: Container(
|
|
color: Colors.white,
|
|
child: const HomePage(),
|
|
),
|
|
),
|
|
PaneItem(
|
|
icon: const Icon(FluentIcons.check_list),
|
|
title: const Text('待办'),
|
|
body: Container(
|
|
color: Colors.white,
|
|
child: const TaskPage(),
|
|
),
|
|
),
|
|
PaneItem(
|
|
icon: const Icon(FluentIcons.calendar),
|
|
title: const Text('日程'),
|
|
body: Container(
|
|
color: Colors.white,
|
|
child: const SchedulePage(),
|
|
),
|
|
),
|
|
PaneItemSeparator(),
|
|
PaneItem(
|
|
icon: const Icon(FluentIcons.settings),
|
|
title: const Text('设置'),
|
|
body: Container(
|
|
color: Colors.white,
|
|
child: const SettingsPage(),
|
|
),
|
|
),
|
|
],
|
|
footerItems: [
|
|
PaneItemSeparator(),
|
|
PaneItemAction(
|
|
icon: const Icon(FluentIcons.add),
|
|
title: const Text('添加任务'),
|
|
onTap: () {
|
|
// 添加任务的逻辑
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |