体征传感器
This commit is contained in:
@@ -110,34 +110,33 @@ class _HomePageState extends State<MainPageBBottomChange>
|
||||
return Center(child: Text('页面 ${titles[selectedIndex]}'));
|
||||
}
|
||||
|
||||
|
||||
DateTime? _lastBackPressedTime; // 记录上一次返回的时间
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (disposition, result) async {
|
||||
if (Platform.isAndroid) {
|
||||
var flag = await _handleBackPressed(context); // 自定义返回逻辑
|
||||
if (flag) {
|
||||
SystemNavigator.pop();
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (disposition, result) async {
|
||||
if (Platform.isAndroid) {
|
||||
var flag = await _handleBackPressed(context); // 自定义返回逻辑
|
||||
if (flag) {
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: const Color(0xFF011C33),
|
||||
body: IndexedStack(
|
||||
index: selectedIndex,
|
||||
children: pages,
|
||||
),
|
||||
bottomNavigationBar: BezierBottomNavigationBar(
|
||||
selectedIndex: selectedIndex,
|
||||
animatedPosition: _positionAnimation.value,
|
||||
onTap: _onTabTapped,
|
||||
path: path,
|
||||
titles: titles,
|
||||
),
|
||||
));
|
||||
backgroundColor: const Color(0xFF011C33),
|
||||
body: IndexedStack(
|
||||
index: selectedIndex,
|
||||
children: pages,
|
||||
),
|
||||
bottomNavigationBar: BezierBottomNavigationBar(
|
||||
selectedIndex: selectedIndex,
|
||||
animatedPosition: _positionAnimation.value,
|
||||
onTap: _onTabTapped,
|
||||
path: path,
|
||||
titles: titles,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
void switchTab(int index) {
|
||||
@@ -243,8 +242,8 @@ class _HomePageState extends State<MainPageBBottomChange>
|
||||
ef.log("[激活控制页面报错]:$e");
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> _handleBackPressed(BuildContext context) async {
|
||||
|
||||
Future<bool> _handleBackPressed(BuildContext context) async {
|
||||
final currentTime = DateTime.now();
|
||||
|
||||
// 如果上次点击返回键时间为空,或者间隔超过 1 秒
|
||||
|
||||
Reference in New Issue
Block a user