美文网首页
【Flutter】RaisedButton,FlatButton

【Flutter】RaisedButton,FlatButton

作者: diva_dance | 来源:发表于2019-03-20 11:42 被阅读0次

RaisedButton

参数:

  • onPressed 点击时候触发,如果不传默认是不可用状态。

  • padding padding


    image
    image
  • onHighlightChanged 高亮变化时回调,参数:是否高亮。

  • textTheme 字体主题,取 ButtonTextTheme 提供的三种主题。
    在不设置 textColor 的情况下:ButtonTextTheme.normal


    image

    ButtonTextTheme.accent:


    image.png
    ButtonTextTheme.primary:
    image
  • textColor 设置字体颜色

  • disabledTextColor 设置禁用状态下的字体颜色

  • color 背景颜色

  • disabledColor 设置禁用状态下的背景颜色

  • highlightColor 高亮颜色,按下时的颜色

  • splashColor 水波的颜色

  • colorBrightness 设置了 textColor 无效。但是 dark 是白色 light 是黑色,不理解为啥。

  • elevation 阴影值。正常应该小于 5。

  • highlightElevation 高亮时候的阴影值。

  • child 一般是文本

  • icon 可以设置一个 icon

  • shape 设置形状

    RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(10))
    ),
    
  • clipBehavior ????

  • materialTapTargetSize ????

  • animationDuration ????

FlatButton 和 RaisedButton 属性一样。

OutlineButton

color 设置无效。

new OutlineButton(
    onPressed: () {
        print(BorderStyle.values);
    },
    borderSide: BorderSide(
        color: Colors.blue,
        width: 2.0,
        style: BorderStyle.solid
    ),
    child: new Text('pressed'),
)
  • borderSide 边框样式。BorderStyle 里面枚举值只有两个,none 和 solid。
  • disabledBorderColor 禁用状态下边框颜色
  • highlightedBorderColor 高亮状态下边框颜色
image

相关文章

网友评论

      本文标题:【Flutter】RaisedButton,FlatButton

      本文链接:https://www.haomeiwen.com/subject/egonmqtx.html