我的视图有一个带有文本标签覆盖的背景图像什么是基于背景图像确定文本颜色的最好/最好的动态方式,因此它可以读取(现在,我只对确定文本颜色应该是暗的还是感兴趣光)
谢谢 :)
我正在Flutter中使用带有背景小部件的SliverAppBar。
问题是,展开后,标题和图标(引导和动作)应为白色,以便正确看到;折叠时,应将其更改为黑色。
我如何能得到任何想法布尔出来的吗?或其他解决此问题的方法。
谢谢。
class SliverExample extends StatefulWidget {
final Widget backgroundWidget;
final Widget bodyWidgets;
SliverExample({
this.backgroundWidget,
this.body,
});
@override
_SliverExampleState createState() => _SliverExampleState();
}
class _SliverExampleState extends State<SliverExample> {
// I need something like this
// To determine if SliverAppBar is expanded or not.
bool isAppBarExpanded = false;
@override
Widget build(BuildContext context) {
// To change the item's color accordingly
// To be used in multiple places …Run Code Online (Sandbox Code Playgroud)