簡體   English   中英

如何在 flutter 中自定義點擊效果(波紋)?

[英]how to customize the on tap effect (ripple) in flutter?

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 package 來顯示我的圖像,我還希望這些圖像是圓形的,並且有點擊事件,我試圖滿足所有這些要求,但我有一個問題,這是 on 的效果點擊事件,波紋是方形的而不是圓形的,任何人都可以幫助我並向我提出一個好主意,自定義波紋並將其改為圓形,甚至以不同的方式制作整個解決方案。

Flutter 類有很好的文檔記錄,並為您提供了可供選擇/附加類的列表,您可以查看。 如果您查看InkWell中的文檔,您會發現:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM