繁体   English   中英

Flutter - 线性渐变不将颜色作为颜色数组

[英]Flutter - Linear Gradient not taking colors as a array of colors

我实际上正在准备一个登录屏幕并决定使用线性渐变作为背景。 我实际上在稳定频道中将我的 Flutter SDK 从 1.20 升级到 1.22。 请点击以下链接查看问题

编码

显示的错误

显示我该怎么做。

谢谢你。

在命令行中使用flutter cleanflutter pub cache repair ,然后重新启动ide

你可以试试这个,可能有一些版本不匹配。


Container(
        decoration: BoxDecoration(
            gradient: LinearGradient(
              begin: Alignment.topRight,
              end: Alignment.bottomLeft,
              colors: [Colors.blue, Colors.red])),
        child: Center(
          child: Text(
            'Hello Gradient!',
            style: TextStyle(
              fontSize: 48.0,
              fontWeight: FontWeight.bold,
              color: Colors.white),
          ),
        ),
      )

暂无
暂无

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

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