flutter - Flutter 项目不接受 BoxDecoration 颜色
问题描述
我是 Flutter 的新手,我对参数有疑问。
我从教程中获得了以下代码:
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [const Color(0xff3C8CE7), const Color(0xff00EAFF)])),
该项目在两个平台上都运行良好,但有一条警告:
colors: [const Color(0xff3C8CE7), const Color(0xff00EAFF)])),
这是 Dart Analysis 调试窗口中的警告输出:
我已经搜索了 BoxDecoration 和渐变颜色的正确实现,它说明了我正在这样做的方式。
代码有什么问题?
解决方案
请确保您使用的是颤振的stable
或beta
通道。为此,请运行以下命令:
flutter channel stable
flutter upgrade
flutter clean
重新启动 IDE 并尝试再次运行。
推荐阅读
- flutter - 列出 vs 代码中的参数
- react-native - 如何为 react-native-carousel 制作自定义点
- python - 控制流python
- python-3.x - 使用 Python 提取以任何字符开头但不以 Rs 或 SBC 等字符/单词开头的行的正则表达式
- terraform - 在不同账户中担任角色时创建 EKS 失败
- java - 实现控制器通知全局异常处理程序,拦截运行时异常
- azure - Azure NSG 专用 IP 配置(白名单)Vnet 到 Vnet 通信
- javascript - 为什么 document.getElementById.value = "XYZ" 不写入输入文本字段?
- lua - 如何让roblox中的NPC正常四处走动,然后当它看到玩家追赶他们时
- embedded-linux - `APPEND` 变量不更新内核命令行