I am developing a full screen app. To show it, I use this in `initState` method:
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
That way, bar is hidden, however, it get back when user swipe from the edge, what I don't want.
How can I disable that feature completely?
Jaime
You cannot completely disable that gesture in a normal Android app. SystemUiMode.immersiveSticky is designed to hide the system bars, but Android still allows the user to temporarily reveal them by swiping from the edge. This is expected system behavior and cannot be fully blocked by Flutter.
The closest you can do is listen for system UI changes and re-apply immersive mode when the bars become visible:
dart
import 'package:flutter/services.dart';
@override
void initState() {
super.initState();
_hideSystemBars();
SystemChrome.setSystemUIChangeCallback((bool systemOverlaysAreVisible) async {
if (systemOverlaysAreVisible) {
await Future.delayed(const Duration(milliseconds: 300));
_hideSystemBars();
}
});
}
Future<void> _hideSystemBars() {
return SystemChrome.setEnabledSystemUIMode(
SystemUiMode.immersiveSticky,
);
}
@override
void dispose() {
SystemChrome.setSystemUIChangeCallback(null);
super.dispose();
}
Whenever the user swipes and the navigation bar appears, the callback is triggered and immersive mode is applied again.
However, this does not truly disable the swipe gesture. It only hides the system bars again after they appear. Android does not allow regular apps to permanently block system navigation gestures for accessibility and system-control reasons.
If you need to fully restrict navigation, that usually requires a kiosk / dedicated-device setup, not just SystemUiMode.immersiveSticky.