我正在尝试在我的应用中使用Github的代码,但不确定为什么会显示一些错误。稍后使用的类。它说LinearGradient有一个问题(“颜色,未定义”),但只是检查了Flutter的源代码,并且具有此属性。
import 'package:flutter/material.dart';
class Palette {
static const Color scaffold = Color(0xFFF0F2F5);
static const Color facebookBlue = Color(0xFF1777F2);
static const Gradient createRoomGradient = LinearGradient(
colors: [Color(0xFF496AE1), Color(0xFFCE48B1)],
);
static const Color online = Color(0xFF4BCB1F);
static const LinearGradient storyGradient = LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.transparent, Colors.black26],
);
}
最佳答案
此解决方案为我工作:
https://github.com/flutter/flutter/issues/67084#issuecomment-702397222
关于flutter - Flutter中的LinearGradient?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/64095998/