feat:初始化工程
This commit is contained in:
105
lib/main.dart
Normal file
105
lib/main.dart
Normal file
@@ -0,0 +1,105 @@
|
||||
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(
|
||||
pane: NavigationPane(
|
||||
selected: _currentIndex,
|
||||
onChanged: (index) => setState(() => _currentIndex = index),
|
||||
size: NavigationPaneSize(
|
||||
openWidth: 150
|
||||
),
|
||||
header: const Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Text(
|
||||
'TaskHub',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
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: () {
|
||||
// 添加任务的逻辑
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user