Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permanent Persistent Bottom sheet flutter

I want my bottom sheet to stay on the screen till I close it from a code. Normally the bottom sheet can be closed by pressing back button(device or appbar) or even just by a downward gesture. How can I disable that?

_scaffoldKey.currentState
        .showBottomSheet<Null>((BuildContext context) {
      final ThemeData themeData = Theme.of(context);
      return new ControlBottom(
        songName: songName,
        url: url,
        play: play,
        pause: pause,
        state: test,
        themeData: themeData,
      );
    }).closed.whenComplete((){

    });

Control botton is a different widget.

like image 502
Ayush Singh Avatar asked Aug 22 '18 17:08

Ayush Singh


People also ask

How do you keep the bottom sheet in place flutter?

If you wish to show a persistent bottom sheet, use Scaffold. bottomSheet. To make a persistent bottom sheet that isn't a LocalHistoryEntry and doesn't add a back button to the encasing Scaffold's application bar, utilize the Scaffold. bottomSheetconstructor parameter.


1 Answers

Scaffold now has a bottom sheet argument and this bottom sheet cannot be dismissed by swiping down the screen.

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(....),
        bottomSheet: Container(
            child: Text('Hello World'),
        ),
    );
  }
like image 67
Ayush Singh Avatar answered Sep 18 '22 07:09

Ayush Singh