| 属性 | 说明 | 类型 |
|---|
| onPressed | 触发时间 | Fun |
| child | 子组件 | widget |
| style | 按钮的样式 | |
| foregroundColor | 文本颜色 | Color |
| backgroundColor | 背景颜色 | Color |
| shadowColor | 阴影颜色 | Color |
| padding | 内边距 | |
| shape | 按钮的形状 | MaterialStateProperty.all() |
| side | 设置边框 | MaterialStateProperty.all() |
ElevatedButton(
onPressed:(){},
child:Text("普通按钮")
)
文本按钮 TextButton
TextButton(
onPressed:(){},
child:Text("文本按钮")
)
OutilnedButton(
onPressed:(){},
child:Text("镂空按钮")
)
IconBotton(
onPressed:(){},
child:Icon(Icons.add)
)
带图标的按钮
ElevatedButton.icon(
icon:Icon(Icons.send),
label:Text("发送"),
onPressed:(){}
)
// 与一反三其他按钮组件同样
全屏浮动按钮,和 body 属性同级别
| 属性 | 说明 | 类型 |
|---|
| chlid | 子组件 | |
| tooltip | FAB长按时显示 | |
| backgroundColor | 背景颜色 | Color |
| elevation | 未点击的时候阴影 | |
| hignligheElevation | 点击时阴影值,默认时12.0 | dobule |
| onPressed | 点击事件回调 | |
| shape | 定义FAB的形状 | |
| mini | 是否mini类型 默认时 false | |
Scaffold(
floatingActionButton:floatingActionButton()
)