Add touch fallback to open admin for phone testing
This commit is contained in:
@@ -45,7 +45,9 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||
Timer? _comboResetTimer;
|
||||
Timer? _simulationShortcutTimer;
|
||||
Timer? _autoRefreshTimer;
|
||||
Timer? _touchUnlockTimer;
|
||||
bool _isAutoRefreshRunning = false;
|
||||
int _touchUnlockTapCount = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -64,6 +66,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||
_comboResetTimer?.cancel();
|
||||
_simulationShortcutTimer?.cancel();
|
||||
_autoRefreshTimer?.cancel();
|
||||
_touchUnlockTimer?.cancel();
|
||||
_homeFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -213,6 +216,30 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||
_simulationShortcutKeys.clear();
|
||||
}
|
||||
|
||||
void _resetTouchUnlock() {
|
||||
_touchUnlockTimer?.cancel();
|
||||
_touchUnlockTapCount = 0;
|
||||
}
|
||||
|
||||
void _registerTouchUnlockTap() {
|
||||
_touchUnlockTimer?.cancel();
|
||||
_touchUnlockTimer = Timer(const Duration(seconds: 3), _resetTouchUnlock);
|
||||
_touchUnlockTapCount += 1;
|
||||
|
||||
if (_touchUnlockTapCount < 5) return;
|
||||
|
||||
_resetTouchUnlock();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
if (!mounted) return;
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (_) => const AdminScreen()),
|
||||
);
|
||||
if (mounted) {
|
||||
_homeFocusNode.requestFocus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Audio trigger listener
|
||||
@@ -282,6 +309,17 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||
},
|
||||
child: screen,
|
||||
),
|
||||
// Hidden touch fallback for phones/tablets during testing:
|
||||
// tap top-left area 5x quickly to open admin.
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: _registerTouchUnlockTap,
|
||||
child: const SizedBox(width: 110, height: 110),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user