前端学习-flutter学习-010-按钮

《Flutter实战·第二版》

ElevatedButton(
    child: Text("ElevatedButton 默认带有阴影和灰色背景。按下后,阴影会变大"),
    onPressed: () {},
  ),
  TextButton(
    child: Text("TextButton 默认背景透明并不带阴影。按下后,会有背景色"),
    onPressed: () {},
  ),
  OutlinedButton(
    child: Text("OutlinedButton 默认有一个边框,不带阴影且背景透明。按下后,边框颜色会变亮、同时出现背景和阴影(较弱)"),
    onPressed: () {},
  ),
  IconButton(
    icon: Icon(Icons.thumb_up),
    onPressed: () {},
  ), // IconButton是一个可点击的Icon,不包括文字,默认没有背景,点击后会出现背景
  // ElevatedButton、TextButton、OutlinedButton都有一个icon 构造函数,通过它可以轻松创建带图标的按钮,
  ElevatedButton.icon(
    icon: Icon(Icons.send),
    label: Text("发送"),
    onPressed: () {},
  ),
  OutlinedButton.icon(
    icon: Icon(Icons.add),
    label: Text("添加"),
    onPressed: () {},
  ),
  TextButton.icon(
    icon: Icon(Icons.info),
    label: Text("详情"),
    onPressed: () {},
  ),
posted @ 2024-07-14 10:46  ayubene  阅读(2)  评论(0编辑  收藏  举报