hideNavigation method

Future<bool> hideNavigation(
  1. bool hide
)

The function hideNavigation in Dart is used to hide or show the system navigation bar.

Args: hide (bool): The hide parameter is a boolean value that determines whether to hide or show the navigation bar. If hide is true, the navigation bar will be hidden. If hide is false, the navigation bar will be shown.

Returns: a Future<bool>.

Implementation

Future<bool> hideNavigation(bool hide) async {
  if (hide) {
    await SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky)
        .whenComplete(() {});
    return true;
  } else {
    await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
        overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]);
    return false;
  }
}