How to make flutter app draw behind android navigation bar and make navigation bar fully transparent?

后端 未结 4 1485
心在旅途
心在旅途 2021-02-01 13:24

I would like to make my Flutter app take up the entire screen in Android while still showing both the status bar and the navigation bar, with both of them transparent, to achiev

相关标签:
4条回答
  • 2021-02-01 13:50

    So if you are using Flutter the procedure is:

    1. Set AppBar() color to transparent.
    2. Set extendBeyondAppBar to true.
    3. Set elevation to 0.

    As an example:

        return Scaffold(
            extendBodyBehindAppBar: true,
            appBar: AppBar(
               elevation: 0,
               )

    0 讨论(0)
  • 2021-02-01 13:53

    This might be late, but the latest version for flutter, 1.12 provides a feature to draw the app behind the NavigationBar, so the following code will have the transparent navigation bar with app fully extended behind the navigation bar,

    Scaffold(
      extendBodyBehindAppBar: true, //this ensures that the body is drawn behind the navigation bar as well
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        title: Text('Transparent Bar'),
      ),
      body: Container(
        color: Colors.blue,
      ),
    );
    
    0 讨论(0)
  • 2021-02-01 13:54
    return Scaffold(
       body: AnnotatedRegion<SystemUiOverlayStyle>(
        value: SystemUiOverlayStyle(
          statusBarColor: Colors.transparent,
          systemNavigationBarColor: Colors.transparent
        ),
        sized: false,
        child: Container(color: Colors.red)
      )
    );
    
    0 讨论(0)
  • 2021-02-01 13:56

    Have you tried the below method

    // to hide only bottom bar:
    SystemChrome.setEnabledSystemUIOverlays ([SystemUiOverlay.top]);
    
    // to hide only status bar: 
    SystemChrome.setEnabledSystemUIOverlays ([SystemUiOverlay.bottom]);
    
    // to hide both:
    SystemChrome.setEnabledSystemUIOverlays ([]);
    
    0 讨论(0)
提交回复
热议问题