体征传感器

This commit is contained in:
czz
2025-07-19 17:52:39 +08:00
parent 594b1f31e0
commit 1480b2e708
17 changed files with 1130 additions and 795 deletions

View File

@@ -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 秒