【问题标题】:how to customize the on tap effect (ripple) in flutter?如何在颤动中自定义点击效果(波纹)?
【发布时间】:2020-12-10 00:13:01
【问题描述】:
InkWell(
          onTap: () {
            print('on tap event');
          },
          child: CachedNetworkImage(
            imageUrl:
                'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSgjoaDvMpuEfm96oHtpEVbwtfIscO8GPuTsA&usqp=CAU',
            imageBuilder: (context, imageProvider) => Container(
              width: 80.0,
              height: 80.0,
              decoration: BoxDecoration(
                shape: BoxShape.circle,
                image: DecorationImage(
                  image: imageProvider,
                  fit: BoxFit.cover,
                ),
              ),
            ),
            placeholder: (context, url) => CircularProgressIndicator(),
            errorWidget: (context, url, error) => Icon(Icons.error),
          ),
        ),

我想在flutter中使用chached_nework_image包来显示我的图像,我希望这些图像是圆形的,并且有点击事件,我试图提出所有这些要求,但是我有一个问题,就是效果在点击事件中,波纹不是圆形的,任何人都可以帮助并向我提出一个好主意,自定义波纹并使其变为圆形,甚至以不同的方式制作整个解决方案。

【问题讨论】:

    标签: flutter dart mobile flutter-layout flutter-dependencies


    【解决方案1】:

    Flutter 类有很好的文档记录,并为您提供了可以查看的替代/附加类列表。如果您查看 InkWell 中的文档,您会发现:

    ///  * [InkResponse], a variant of [InkWell] that doesn't force a rectangular
    ///    shape on the ink reaction.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-14
      • 1970-01-01
      • 2017-07-20
      • 2020-03-22
      • 2015-07-16
      • 1970-01-01
      • 2021-11-28
      • 1970-01-01
      相关资源
      最近更新 更多