Flutter组件之按钮(RaisedButton)

凸起按钮组件(RaisedButton)是Material Design中的button,一个凸起的材质矩形按钮,它可以响应按下事件,并且按下时会带一个触摸的效果。

常用属性如下:

属性名

类型

默认值

说明

color

Color

null

组件的颜色

disabledColor

Color

ThemeData.disabledColor

组件禁用的颜色,默认为主题里的禁用颜色,也可以设置为其他颜色值

onPressed

VoidCallback

null

当按钮按下时会触发此回调事件

child

Widget

 

按钮的child通常为一个Text文本组件,用来显示按钮的文本

enable

bool

TRUE

按钮是否为禁用状态

 

自定义按钮:图片+文字按钮

用InkWell + Stack来形成层级

 new InkWell(
          child: new Stack(
            alignment: Alignment.center,
            children: [
              new Image.asset("images/ic_launcher_round.png"),
              new Text("登录",
              style: new TextStyle(
                fontSize: 24,
                fontWeight: FontWeight.bold,
                color: Colors.red
              ),),
            ],
          ),
          onTap: () { },
        ),

 

你可能感兴趣的:(Flutter)