Shrinking SliverAppBar to only cover the status bar?

Viewed 21

When using the SliverAppBar, I want to have it shrink down to cover only the status bar text (time, battery life, signal strength). The standard collapsedHeight seems to be around 60.0, if I try to shrink it to anything smaller then there are some horrible errors about it being smaller then the toolBarHeight.

So I went ahead and just shrunk the toolBarHeight down to 0.0 and then I am allowed to take collapsedHeight to 0.0 as well, and it gives the exact effect I was hoping for. The sliver will successfully shrink down to only cover the status bar.

However, the problem with this, is that by making the toolBarHeight = 0, then the back button and actions icons are similarly shrunk down to 0, effectively disappeared.

Is there any way to keep the Icons such as back button and action icons maintain there height while setting the toolBarHeight = 0, or any other strategy to try to achieve what I would think would be a common arrangement?

return
      SliverAppBar(
          expandedHeight: 80.0,
          collapsedHeight: 0.0,
          toolbarHeight: 0.0,
          stretch: false,
          floating: false,
          pinned: true,
          elevation: 0,
          automaticallyImplyLeading: true,
          forceElevated: true,
          shape: const RoundedRectangleBorder(
            borderRadius: BorderRadius.vertical(
              bottom: Radius.circular(28),
            )),
          backgroundColor: Colors.black,
          flexibleSpace: FlexibleSpaceBar(
           background:
              SafeArea(
                child: Padding(
                  padding: const EdgeInsets.fromLTRB(60,0,100,0),
                  child: MySliverTitle(
                    geaderText:'Testing',
                  ),
                ),
              ),
          ),
          actions: <Widget>[
            MyIcon1(),MyIcon2()

          ]
      );
0 Answers
Related