gpt4 book ai didi

flutter - Flutter中的LinearGradient?

转载 作者:行者123 更新时间:2023-12-03 03:30:31 27 4
gpt4 key购买 nike

我正在尝试在我的应用中使用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

in your pubspec.yml

change this to :

environment: sdk: ">=2.8.0 <3.0.0" and flutter pub get

i'm using android studio, then i invalidate cache and restart, done!

关于flutter - Flutter中的LinearGradient?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64095998/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com