feat:增加闪灵功能
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'package:flisp_app/layout/app_drawer.dart';
|
||||
import 'package:flisp_app/pages/flash_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';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -13,11 +13,12 @@ class MainScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MainScreenState extends State<MainScreen> {
|
||||
final GlobalKey<FlispPageState> _flispPageKey = GlobalKey();
|
||||
final GlobalKey<TodoPageState> _todoPageKey = GlobalKey();
|
||||
|
||||
List<BottomNavigationBarItem> navItems = [
|
||||
BottomNavigationBarItem(icon: Icon(Icons.flash_on), label: '闪灵'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.checklist), label: '待办')
|
||||
BottomNavigationBarItem(icon: Icon(Icons.checklist), label: '待办'),
|
||||
];
|
||||
|
||||
@override
|
||||
@@ -47,7 +48,11 @@ class _MainScreenState extends State<MainScreen> {
|
||||
}
|
||||
|
||||
void _onPressFloatingButton(int index) {
|
||||
if (index == 1) {
|
||||
if (index == 0) {
|
||||
if (_flispPageKey.currentState != null) {
|
||||
_flispPageKey.currentState!.showAddDialog();
|
||||
}
|
||||
} else if (index == 1) {
|
||||
if (_todoPageKey.currentState != null) {
|
||||
_todoPageKey.currentState!.showAddDialog();
|
||||
}
|
||||
@@ -86,11 +91,11 @@ class _MainScreenState extends State<MainScreen> {
|
||||
Widget _buildPage(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return const FlashPage();
|
||||
return FlispPage(key: _flispPageKey);
|
||||
case 1:
|
||||
return TodoPage(key: _todoPageKey);
|
||||
default:
|
||||
return const FlashPage();
|
||||
return FlispPage(key: _flispPageKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user