简体   繁体   中英

Sliver Appbar “eliminates” the primary color

I've a simple sliver app bar, and i set my primary color to this:

 theme: ThemeData(primary Color: Color. fromRGBO(50, 50, 205, 1)),

Before i added the sliver app bar all the screen was set to primary color, But after i added the sliver app bar suddenly the screen turn to white.

How do I set my primary color to fill the screen?

it's a really simple sliver app bar, if you need the code for this let me know

Still Don't know why this is happening, but i found a solution.

Just wrap your remaining screen with container and add color like this:

   SliverFillRemaining(
              child: Container(
                color: Color.fromRGBO(30, 30, 123, 1.0),
                child: ...your remaining screen

也许您需要使用一个Scaffold小部件,并在其中放置SliverAppBar并使用Scaffold的backgroundcolor属性来设置彩色屏幕。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM