showBottomSheet<T> method

PersistentBottomSheetController<T> showBottomSheet <T>(WidgetBuilder builder)

Shows a persistent material design bottom sheet.

A persistent bottom sheet shows information that supplements the primary content of the app. A persistent bottom sheet remains visible even when the user interacts with other parts of the app.

A closely related widget is a modal bottom sheet, which is an alternative to a menu or a dialog and prevents the user from interacting with the rest of the app. Modal bottom sheets can be created and displayed with the showModalBottomSheet function.

Returns a controller that can be used to close and otherwise manipulate the bottom sheet.

To rebuild the bottom sheet (e.g. if it is stateful), call PersistentBottomSheetController.setState on the value returned from this method.

See also:


PersistentBottomSheetController<T> showBottomSheet<T>(WidgetBuilder builder) {
  if (_currentBottomSheet != null) {
    assert(_currentBottomSheet == null);
  final Completer<T> completer = new Completer<T>();
  final GlobalKey<_PersistentBottomSheetState> bottomSheetKey = new GlobalKey<_PersistentBottomSheetState>();
  final AnimationController controller = BottomSheet.createAnimationController(this)
  _PersistentBottomSheet bottomSheet;
  final LocalHistoryEntry entry = new LocalHistoryEntry(
    onRemove: () {
      assert(_currentBottomSheet._widget == bottomSheet);
      assert(bottomSheetKey.currentState != null);
      if (controller.status != AnimationStatus.dismissed)
      setState(() {
        _currentBottomSheet = null;
  bottomSheet = new _PersistentBottomSheet(
    key: bottomSheetKey,
    animationController: controller,
    onClosing: () {
      assert(_currentBottomSheet._widget == bottomSheet);
    onDismissed: () {
      if (_dismissedBottomSheets.contains(bottomSheet)) {
        setState(() {
    builder: builder
  setState(() {
    _currentBottomSheet = new PersistentBottomSheetController<T>._(
      (VoidCallback fn) { bottomSheetKey.currentState?.setState(fn); }
  return _currentBottomSheet;