systemGestureInsets property

EdgeInsets systemGestureInsets
final

The areas along the edges of the display where the system consumes certain input events and blocks delivery of those events to the app.

Starting with Android Q, simple swipe gestures that start within the systemGestureInsets areas are used by the system for page navigation and may not be delivered to the app. Taps and swipe gestures that begin with a long-press are delivered to the app, but simple press-drag-release swipe gestures which begin within the area defined by systemGestureInsets may not be.

Apps should avoid locating gesture detectors within the system gesture insets area. Apps should feel free to put visual elements within this area.

This property is currently only expected to be set to a non-default value on Android starting with version Q.

For apps that might be deployed on Android Q devices with full gesture navigation enabled, use MediaQuery.systemGestureInsets with Padding to avoid having the left and right edges of the Slider from appearing within the area reserved for system gesture navigation.

By default, Sliders expand to fill the available width. So, we pad the left and right sides.

double _currentValue = 0.2;

@override
Widget build(BuildContext context) {
  EdgeInsets systemGestureInsets = MediaQuery.of(context).systemGestureInsets;
  return Scaffold(
    appBar: AppBar(title: Text('Pad Slider to avoid systemGestureInsets')),
    body: Padding(
      padding: EdgeInsets.only( // only left and right padding are needed here
        left: systemGestureInsets.left,
        right: systemGestureInsets.right,
      ),
      child: Slider(
        value: _currentValue.toDouble(),
        onChanged: (double newValue) {
          setState(() {
            _currentValue = newValue;
          });
        },
      ),
    ),
  );
}

Implementation

final EdgeInsets systemGestureInsets