Flutter-漸變色按鈕

Posted ssjf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flutter-漸變色按鈕相关的知识,希望对你有一定的参考价值。

設置外部容器漸變色,按鈕顏色透明

Container(
                    margin: EdgeInsets.only(bottom: 10),
                    width: 160,
                    height: 40,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(50),
                      //漸變色
                      gradient: LinearGradient(colors: [
                          Color(0xff82b518),
                          Color(0xff3e73b7)
                        ]),
                    ),
                      child: RaisedButton(
                      onPressed: (){},
                   
                      child: Text(
                        ‘確 認‘,
                        style: TextStyle(fontWeight: FontWeight.bold,fontSize: 18),
                        ),
                        textColor: Colors.white,
                        // 设为透明色
                        color: Colors.transparent,
                        //disabledColor: Colors.black54, //按鈕被禁用時候的顏色
                        shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(15),
                      ),
                    ),
                  ),

 

以上是关于Flutter-漸變色按鈕的主要内容,如果未能解决你的问题,请参考以下文章