05. 按钮组件
属性说明类型
onPressed 触发时间 Fun
child 子组件 widget
style 按钮的样式
foregroundColor 文本颜色 Color
backgroundColor 背景颜色 Color
shadowColor 阴影颜色 Color
padding 内边距
shape 按钮的形状 MaterialStateProperty.all()
side 设置边框 MaterialStateProperty.all()

普通按钮 ElevatedButton

ElevatedButton(
onPressed:(){},
   child:Text("普通按钮")
)

文本按钮 TextButton

TextButton(
onPressed:(){},
   child:Text("文本按钮")
)

边框按钮 OutlinedButton

OutilnedButton(
onPressed:(){},
   child:Text("镂空按钮")
)

图标按钮 IconButton

IconBotton(
onPressed:(){},
   child:Icon(Icons.add)
)

带图标的按钮

ElevatedButton.icon(
icon:Icon(Icons.send),
   label:Text("发送"),
   onPressed:(){}
)
// 与一反三其他按钮组件同样

浮动的按钮 floatingActionButton

全屏浮动按钮,和 body 属性同级别

属性说明类型
chlid 子组件
tooltipFAB 长按时显示
backgroundColor 背景颜色 Color
elevation 未点击的时候阴影
hignligheElevation 点击时阴影值,默认时 12.0dobule
onPressed 点击事件回调
shape 定义 FAB 的形状
mini 是否 mini 类型 默认时 false
Scaffold(
floatingActionButton:floatingActionButton()
)
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇