2

I have an app that has a bottomNavigationBar() wrapped in a clipRRect() but the content doesn't show behind it. The same behaviour also happens with transparent SliverAppBar()s in NestedScrollView()s. How can I achieve this?

Edit: Here is an example of the SliverAppBar() problem. The shadow is being hidden by the app bar.

enter image description here

  • plz check this https://stackoverflow.com/questions/54366982/transparent-bottom-navigation-bar-in-flutter – ghost deathrider Jun 09 '21 at 13:10
  • @ghostdeathrider it worked, thanks! Is there no way to do this other than this hacky workaround? –  Jun 09 '21 at 15:17
  • I don't know. Maybe it's there. I am also new to flutter and learning now, so I don't know exactly. Glad it worked. Please post the solution, so that if others have the problem they can refer to this. @Hady – ghost deathrider Jun 09 '21 at 15:22
  • @ghostdeathrider This solves the first problem. I still have the problem of a transparent SliverAppBar not showing the content below it when in a `NestedScrollView()`. Any way how to solve that? Thanks for the help –  Jun 09 '21 at 15:28
  • @Dude but this isn't a normal app bar, it is a SliverAppBar. The structure of this page is a `Scaffold()` widget with a body of `NestedScrollView()` I have the `SliverAppBar()` and the `ListView.builder()` in the `NestedScrollView()`. Would it still work? –  Jun 10 '21 at 09:29

1 Answers1

2

you can try this:

Scaffold(
            extendBody: true,
            extendBodyBehindAppBar: true,

and give a little padding to the top and bottom of you body content for overlapping at the very top and bottom.

Jim
  • 6,928
  • 1
  • 7
  • 18
  • Ok, i'll try it out and let you know how it goes. Thanks! –  Jun 10 '21 at 07:26
  • Will the extendBodyBehindAppBar work if I am using a `SliverAppBar()`? Because I don't have an `AppBar()` in the scaffold but a sliver app bar in a `NestedScrollView()`. –  Jun 10 '21 at 09:30
  • you cannot avoid the SliverAppBar clipping your SliverList/ListView, but you can add a little more padding to SliverList/ListView to give top more space for shadow – Jim Jun 10 '21 at 09:38