feat:合并待办和提醒功能
This commit is contained in:
@@ -61,14 +61,6 @@ class AppDrawer extends StatelessWidget {
|
||||
Provider.of<AppProvider>(context, listen: false).changeTab(1);
|
||||
},
|
||||
),
|
||||
_buildDrawerItem(
|
||||
icon: Icons.notifications,
|
||||
title: '提醒任务',
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Provider.of<AppProvider>(context, listen: false).changeTab(2);
|
||||
},
|
||||
),
|
||||
|
||||
const Divider(),
|
||||
|
||||
|
||||
@@ -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/reminders_page.dart';
|
||||
import 'package:flisp_app/pages/todo_page.dart';
|
||||
import 'package:flisp_app/provider/app_provider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -15,12 +14,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.checklist), label: '待办'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.notifications), label: '提醒'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.checklist), label: '待办')
|
||||
];
|
||||
|
||||
@override
|
||||
@@ -50,15 +47,10 @@ class _MainScreenState extends State<MainScreen> {
|
||||
}
|
||||
|
||||
void _onPressFloatingButton(int index) {
|
||||
print(index);
|
||||
if (index == 1) {
|
||||
if (_todoPageKey.currentState != null) {
|
||||
_todoPageKey.currentState!.showAddDialog();
|
||||
}
|
||||
} else if (index == 2) {
|
||||
if (_reminderPageKey.currentState != null) {
|
||||
_reminderPageKey.currentState!.showAddDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,15 +89,13 @@ class _MainScreenState extends State<MainScreen> {
|
||||
return const FlashPage();
|
||||
case 1:
|
||||
return TodoPage(key: _todoPageKey);
|
||||
case 2:
|
||||
return RemindersPage(key: _reminderPageKey);
|
||||
default:
|
||||
return const FlashPage();
|
||||
}
|
||||
}
|
||||
|
||||
String _getAppBarTitle(int index) {
|
||||
final titles = {0: '闪灵', 1: '待办', 2: '提醒'};
|
||||
final titles = {0: '闪灵', 1: '待办'};
|
||||
return titles[index] ?? '闪灵';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user