As I am having sliver app bar in my screen, I am not using AppBar() widget. So by default the status bar color is white.
Is there a way to change the color of status bar from sliver.
Below code works for Android as expected, but not for iOS.
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: kPrimaryColor,
));
If using app bar to change the color, then sliver breaks
CodePudding user response:
can you please try this.
SliverAppBar(
pinned: true,
expandedHeight: 100,
collapsedHeight: 100,
flexibleSpace: Stack(
alignment: Alignment.center,
children: [
Positioned(
right: 0,
bottom: 0,
child: Container(
height: 100,
width: double.infinity,
color:Colors.blue
),
// Add back button and title
],
),
)
CodePudding user response:
add color
what you need and set pinned
to false
SliverAppBar(
backgroundColor: Colors.blue,
expandedHeight: 160.0,
pinned: false,
stretch: false,
)