feat:增加日程模块

This commit is contained in:
2025-11-13 15:53:29 +08:00
parent 63719406d9
commit 54bed08b7b
15 changed files with 830 additions and 20 deletions

View File

@@ -1,4 +1,5 @@
import 'package:flisp_app/layout/app_drawer.dart';
import 'package:flisp_app/pages/calendar_page.dart';
import 'package:flisp_app/pages/flisp_page.dart';
import 'package:flisp_app/pages/todo_page.dart';
import 'package:flisp_app/provider/app_provider.dart';
@@ -15,10 +16,15 @@ class MainScreen extends StatefulWidget {
class _MainScreenState extends State<MainScreen> {
final GlobalKey<FlispPageState> _flispPageKey = GlobalKey();
final GlobalKey<TodoPageState> _todoPageKey = GlobalKey();
final GlobalKey<CalendarPageState> _calendarPageKey = GlobalKey();
List<BottomNavigationBarItem> navItems = [
BottomNavigationBarItem(icon: Icon(Icons.flash_on), label: '闪灵'),
BottomNavigationBarItem(icon: Icon(Icons.checklist), label: '待办'),
BottomNavigationBarItem(
icon: Icon(Icons.calendar_month_rounded),
label: '日程',
),
];
@override
@@ -50,7 +56,9 @@ class _MainScreenState extends State<MainScreen> {
type: BottomNavigationBarType.fixed,
backgroundColor: Theme.of(context).colorScheme.surface,
selectedItemColor: Theme.of(context).colorScheme.primary,
unselectedItemColor: Theme.of(context).colorScheme.onSurface.withAlpha(120),
unselectedItemColor: Theme.of(
context,
).colorScheme.onSurface.withAlpha(120),
showSelectedLabels: true,
showUnselectedLabels: true,
items: navItems,
@@ -74,6 +82,10 @@ class _MainScreenState extends State<MainScreen> {
if (_todoPageKey.currentState != null) {
_todoPageKey.currentState!.showAddDialog();
}
} else if (index == 2) {
if (_calendarPageKey.currentState != null) {
_calendarPageKey.currentState!.showAddDialog();
}
}
}
@@ -101,13 +113,15 @@ class _MainScreenState extends State<MainScreen> {
return FlispPage(key: _flispPageKey);
case 1:
return TodoPage(key: _todoPageKey);
case 2:
return CalendarPage(key: _calendarPageKey);
default:
return FlispPage(key: _flispPageKey);
}
}
String _getAppBarTitle(int index) {
final titles = {0: '闪灵', 1: '待办'};
final titles = {0: '闪灵', 1: '待办', 2: '日程'};
return titles[index] ?? '闪灵';
}
}