flutter - 如何忽略 'label' 上的 'Elevated button' ?

标签 flutter

我想制作一个图标居中的按钮。

This image is the current image.

这是我的代码。

ElevatedButton.icon(
                    onPressed: () {},
                    icon: Icon(Icons.arrow_forward),
                    label: Text(''),
                    style: ElevatedButton.styleFrom(
                      primary: Colors.red,
                      fixedSize: Size(100, 50),
                    )

最佳答案

试试下面的代码希望它对你有帮助。 ElevatedButton.icon 需要标签字段,请参阅文档 here你可以使用TextButton

使用容器

Container(
  height: 50.0,
  width: 150.0,
  child: TextButton(
    child: Icon(Icons.person),
    onPressed: () {},
  ),
),

使用大小框

SizedBox(
  height: 50.0,
  width: 150.0,
  child: TextButton(
    child: Icon(Icons.person),
    onPressed: () {},
  ),
),

关于flutter - 如何忽略 'label' 上的 'Elevated button' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69172307/

相关文章:

flutter - dart 中的词法作用域是什么?

ios - Flutter项目在ios13上运行

flutter - 在 Flutter 中更新 SnackBar 内容

android - 更改最终变量的值

Flutter构建不生成文件

Flutter GridView 不滚动

Flutter:不同的应用程序图标和应用程序名称取决于发布/生产版本或调试/开发版本?

flutter - 库 'package:splashscreen/splashscreen.dart' 是遗留库,不应导入到空安全库中

flutter - 在 Android 移动应用中实现多个过滤器的简单方法

flutter - 我正在尝试让用户登录,但是我的代码仅在应用程序热重启后才有效