flutter Material风格-按钮
  sX9JkgY3DY86 2023年11月13日 18 0

1.MaterialButton

MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("测试"),
),
body: Center(
child: MaterialButton(
color: Colors.blue,
textColor: Colors.white,
child: Text('按钮'),
onPressed: () {},
))),
);

flutter Material风格-按钮_Text

2.RaisedButton

MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("测试"),
),
body: Center(
child: RaisedButton(
color: Colors.blue,
textColor: Colors.white,
child: Text('按钮'),
onPressed: () {},
))),
);

flutter Material风格-按钮_Text_02

 

3.FlatButton 

MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("测试"),
),
body: Center(
child: FlatButton(
color: Colors.blue,
textColor: Colors.white,
child: Text('按钮'),
onPressed: () {},
))),
);

flutter Material风格-按钮_Text_03

 

4.IconButton

MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("测试"),
),
body: Center(
child: IconButton(
color: Colors.green,
icon: Icon(Icons.pets),
//长按提示
tooltip: "ok",
onPressed: () {},
))),
);

flutter Material风格-按钮_Text_04

5.FloatingActionButton

MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("测试"),
),
body: Center(
child: FloatingActionButton(
backgroundColor: Colors.red,
child: Icon(Icons.arrow_upward),
onPressed: () {},
))),
);

flutter Material风格-按钮_Text_05

 

6.OutlineButton

MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("测试"),
),
body: Center(
child: OutlineButton(
child: Icon(Icons.pets),
onPressed: () {},
))),
);

flutter Material风格-按钮_sed_06

 

7.DropdownButton

下拉按钮

MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("测试"),
),
body: Center(
child: DropdownButton(
value: value,
icon: Icon(Icons.arrow_upward),
onChanged: (String newValue) {
setState(() {
value = newValue;
});
},
items: <String>['a', 'b', 'c', 'd']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
))),
);

flutter Material风格-按钮_sed_07

 

flutter Material风格-按钮_Text_08

 

8.PopupMenuButton

 



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

上一篇: flutter 按键监听 下一篇: flutter 下载文件
  1. 分享:
最后一次编辑于 2023年11月13日 0

暂无评论

推荐阅读
  sX9JkgY3DY86   2023年11月13日   29   0   0 idesedImage
  sX9JkgY3DY86   2023年11月13日   13   0   0 分割线ideText
  sX9JkgY3DY86   2023年11月13日   25   0   0 ci控件Text
  sX9JkgY3DY86   2023年11月13日   17   0   0 ideTextflutter
  sX9JkgY3DY86   2023年11月13日   19   0   0 Textsed
sX9JkgY3DY86