我正在尋找某種方式在顫動中的 png 或 svg 影像上添加漣漪效果,而不覆寫影像中的透明部分。
我使用此代碼在 svg 影像上添加漣漪效果:
Stack(
children: [
SvgPicture.asset(
R_Image.BACK,
width: 45,
height: 45,
fit: BoxFit.fill,
),
Positioned.fill(
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
Navigator.of(context).pop();
},
),
),
),
],
)
結果如下:

如何從漣漪效應中洗掉 svg 影像的透明部分?
在 android 中,我@android:id/mask用于此目的,但如何在顫振中做到這一點?
uj5u.com熱心網友回復:
嘗試這個
body: new Center(
child: new Container(
child: new Material(
child: new InkWell(
onTap: (){print("tapped");},
child: new Container(
width: 100.0,
height: 100.0,
),
),
color: Colors.transparent,
),
color: Colors.orange,
),
),
uj5u.com熱心網友回復:
嘗試用 ClipRRect 包裝 Stack
ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Stack(
clipBehavior: Clip.none,
children: [
SvgPicture.asset(
R_Image.BACK,
width: 45,
height: 45,
fit: BoxFit.fill,
),
Positioned.fill(
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
Navigator.of(context).pop();
},
),
),
),
],
),
),
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/312327.html
