feat:增加提醒事项

This commit is contained in:
2025-11-08 22:06:16 +08:00
parent 27f0638c01
commit d5ff4c9b02
30 changed files with 1490 additions and 199 deletions

View File

@@ -1,6 +1,5 @@
import 'package:flisp_app/layout/app_drawer.dart';
import 'package:flisp_app/pages/flash_page.dart';
import 'package:flisp_app/pages/notes_Page.dart';
import 'package:flisp_app/pages/reminders_page.dart';
import 'package:flisp_app/pages/todo_page.dart';
import 'package:flisp_app/provider/app_provider.dart';
@@ -16,10 +15,10 @@ class MainScreen extends StatefulWidget {
class _MainScreenState extends State<MainScreen> {
final GlobalKey<TodoPageState> _todoPageKey = GlobalKey();
final GlobalKey<ReminderPageState> _reminderPageKey = GlobalKey();
List<BottomNavigationBarItem> navItems = [
BottomNavigationBarItem(icon: Icon(Icons.flash_on), label: '闪灵'),
BottomNavigationBarItem(icon: Icon(Icons.note), label: '笔记'),
BottomNavigationBarItem(icon: Icon(Icons.checklist), label: '待办'),
BottomNavigationBarItem(icon: Icon(Icons.notifications), label: '提醒'),
];
@@ -51,9 +50,14 @@ class _MainScreenState extends State<MainScreen> {
}
void _onPressFloatingButton(int index) {
if (index == 2) {
print(index);
if (index == 1) {
if (_todoPageKey.currentState != null) {
_todoPageKey.currentState!.showAddTodoDialog();
_todoPageKey.currentState!.showAddDialog();
}
} else if (index == 2) {
if (_reminderPageKey.currentState != null) {
_reminderPageKey.currentState!.showAddDialog();
}
}
}
@@ -92,18 +96,16 @@ class _MainScreenState extends State<MainScreen> {
case 0:
return const FlashPage();
case 1:
return const NotesPage();
return TodoPage(key: _todoPageKey);
case 2:
return TodoPage(key: _todoPageKey); // 传递 key
case 3:
return const RemindersPage();
return RemindersPage(key: _reminderPageKey);
default:
return const FlashPage();
}
}
String _getAppBarTitle(int index) {
final titles = {0: '闪灵', 1: '笔记', 2: '待办', 3: '提醒'};
final titles = {0: '闪灵', 1: '待办', 2: '提醒'};
return titles[index] ?? '闪灵';
}
}