Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove SliverAppBar bottom border - Flutter

enter image description here

I wanna remove the border that I highlighted in the above picture. I couldn't find any solution to fix this :(

here is my SliverAppBar Code :

NestedScrollView(
        headerSliverBuilder: (BuildContext ctx, isScrolled) {
            return <Widget>[
               SliverAppBar(
                  title: Text('Applying to this job opportunity'),
                  pinned: true,
                  titleSpacing: 0,
                  floating: true,
                  expandedHeight: 180,
                  flexibleSpace: //some widgets
             )
        ]
    }
)
like image 457
Mahdi Tohidloo Avatar asked Mar 12 '26 12:03

Mahdi Tohidloo


2 Answers

Just set the elevation property to 0.

 SliverAppBar(
                  title: Text('Applying to this job opportunity'),
                  pinned: true,
                  elevation: 0,
                  titleSpacing: 0,
                  floating: true,
                  expandedHeight: 180,
                  flexibleSpace: //some widgets
             )

More info : https://api.flutter.dev/flutter/material/SliverAppBar/elevation.html

like image 134
diegoveloper Avatar answered Mar 16 '26 08:03

diegoveloper


It is a long lasting and annoying issue for flutter for ages if you have two slivers are in same color.

The current best walkaround is here (https://github.com/flutter/flutter/issues/37578#issuecomment-640302364) by adding a shadow box around your slivers.

You have to try which sliver is best to add the box shadow and how the shadow is added.

Mine is in this way such that it fills the line both on top and at the bottom of the sliver.

boxShadow: [
  BoxShadow(
    color: myColor,
    blurRadius: 0.0,
    spreadRadius: 1.0,
    offset: Offset(0, 0),
   ),
],
like image 40
ltk Avatar answered Mar 16 '26 08:03

ltk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!