簡體   English   中英

RaisedButton 的自定義顏色 Flutter

[英]custom color for RaisedButton Flutter

當我使用此庫為 RaisedButton 添加自定義顏色時https://pub.dev/packages/color


    return new Padding(
        padding: EdgeInsets.fromLTRB(10.0, 180.0, 10.0, 0.0),
        child: SizedBox(
          height: 60.0,
          child: new RaisedButton(
            elevation: 5.0,
            // color: Colors.greenAccent[100],
            color:rgbColor,
            // color: Color(0xffFF1744),
            child: new Text( 'Sign in',
                style: new TextStyle(fontSize: 20.0,color:Colors.black,fontWeight:FontWeight.w400)),
            onPressed: () => {

            },
          ) 

它給了我這個錯誤

The argument type 'Color (where Color is defined in /Users/abeer/flutter/.pub-cache/hosted/pub.dartlang.org/color-2.1.1/lib/color.dart)' can't be assigned to the parameter type 'Color (where Color is defined in /Users/abeer/flutter/bin/cache/pkg/sky_engine/lib/ui/painting.dart)

為什么要使用顏色庫中的 rbgColor,你可以簡單地使用

Color.fromRGBO(r, g, b, opacity)

從您想要的 rgb 定義顏色。

與括號一起使用

Colors. black[50]

檢查問題https://github.com/flutter/flutter/issues/15658

現在RaisedButton不再存在。 它不是

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM