Flutter:控制 IconButton 上的波纹效果大小

标签 flutter dart

我有一个IconButton,当按下时波纹效果是圆形的并且比按钮的面积大,我怎样才能减少点击按钮时波纹效果的大小?

 IconButton(
                  constraints: const BoxConstraints(minWidth: 30),
                  icon: SvgPicture.asset(
                    'asset_path',
                    color: Colors.white,
                  ),
                  onPressed: () {
                    // do something
                  },
                )

enter image description here

最佳答案

  splashRadius: 120,

 IconButton(
   iconSize: 80,
   splashRadius: 120,
   splashColor: Colors.green,
   tooltip: 'Répète le mot',
   icon: Icon(
        Icons.mic,
        color: Colors.red[900],
   ),

使用splashRadius来控制

关于Flutter:控制 IconButton 上的波纹效果大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70951493/

相关文章:

flutter - 如何在 Flutter 中使卡片可拖动

syntax - dart mixin 'with' 不能在没有 'extends' 的情况下使用?

android - Flutter 缓存非常老的错误

ios - 自定义 `UITextField` 子类没有出现在屏幕上

flutter - 如何在关闭flutter应用程序时处理流?

flutter - 如何在showDatePicker中调整文本initialDate的大小

ios - iOS 上 Flutter 的代码设计错误

json - 写入本地 json 文件 dart flutter

flutter - Riverpod,在 BuildContext 和 Provider 之外读取状态

Dart/flutter : how to build a form with multiple user input fields easily