3

i'd like to know if you know a fix for this problem. If you have an SliverAppBar witch looks somewhat like this (just an example)

class CostumeSliverAppBar extends StatelessWidget {

  static const totalHeight = 225;

  @override
  Widget build(BuildContext context) {
    return SliverAppBar(
      
      //pinned: true,
      expandedHeight: totalHeight,
      flexibleSpace: FlexibleSpaceBar(
        background: Container(

          color:Theme.of(context).scaffoldBackgroundColor,
        ),
      ),
    );
  }
  
}

there will appear a buggy 1 pixel thin line in the primary color at the bottom of the SliverAppBar if you place it inside a CostumeScollView.

Image of the bug

After testing a lot an losing a bit of my mind, i found out that this depends on the screen resoution and the height of the SliverAppBar. F.x. an SliverAppbarHeight of 200 or 300 Pixel doesnt produce this effect. Is there save way to avoid this glitch? Im new to Flutter so maybe you can help me out.

Dont know if it matters, but im using GetX.

Thanks in advance :)

Donat
  • 63
  • 1
  • 3
  • I have the exact same issue inside a NestedScrollView with the headerSliverBuilder. I see that little padding just at the end of the SliverAppBar. It's annoying... If i find a solution i'll get back to you but you actually might have to use another widget if no solution exists for now. Did you find a solution in 1 year maybe ? – julien Dupont Jun 05 '23 at 21:37

1 Answers1

-1

Add background color to SliverAppBar and boom it's gone

SliverAppBar(
              //TODO: Add background color
              backgroundColor: Colors.white, //TODO: Add background color
              expandedHeight: 225,
              flexibleSpace: FlexibleSpaceBar(
                background: Container(
                  color: Theme.of(context).scaffoldBackgroundColor,
                ),
              ),
            )
Prashant
  • 650
  • 5
  • 13
  • 1
    this doesnt solve the issue, because then my appbars color becomes white (but it should stay in the primary color). What i mean is if i scroll down the app bar fades then into white, instead of blue. – Donat May 25 '22 at 13:19