Flutter中常用的按钮效果

本文整理一些实际开发中常用但是写法比较复杂的按钮效果

本文整理一些实际开发中常用但是写法比较复杂的按钮效果

一、渐变色的按钮效果

效果如下:
在这里插入图片描述

代码如下:

       Container(
                margin: const EdgeInsets.symmetric(horizontal: 10,vertical: 10),
                width: 90,
                height: 37,
                decoration: new BoxDecoration(
                  gradient: new LinearGradient(
                    colors: [ColorStore.c_fff7ca92,ColorStore.c_fff39825],
                    begin: FractionalOffset.centerLeft,
                    end: FractionalOffset.centerRight,
                  ),
                  borderRadius: BorderRadius.circular(3),
                ),
                child: FlatButton(
                  child: Text('返回',
                    style:TextStyle(
                        color: Colors.white,
                        fontSize: 16
                    ),
                  ),
                  onPressed: () {
                  },
                ),
              ),

二、带边框的按钮

效果如下:
在这里插入图片描述

代码如下:

OutlineButton(
  onPressed:(){

  },
  child: Text("交易记录"),
  highlightColor: Colors.transparent,//
  hoverColor: Colors.transparent,//触摸时候的颜色
  highlightedBorderColor: Colors.red,//高亮时候的边框颜色
  borderSide: BorderSide(color: Colors.blue),//修改边框样式
),

参考链接:

https://blog.csdn.net/yuzhiqiang_1993/article/details/85004313

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值