简体   繁体   English

Sliver Appbar“消除”了原色

[英]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属性来设置彩色屏幕。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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