在 Flutter 中的 Inkwell 小部件中添加边框半径 [英] Add border Radius in the Inkwell widget in flutter
问题描述
我想使用 inkwell 小部件向容器添加悬停颜色属性,但容器有自己的边框半径,当我使用 inkwell 使用悬停属性时,它采用自定义形状并使其看起来呈矩形悬停在墨水瓶上之后.
I want to add a hover color property to a container using the inkwell widget but the container has its own border-radius and when I am using the hover property using inkwell it is taking its custom shape and making it look rectangle in shape after hovering on the inkwell.
这是我的代码片段:
InkWell(
onTap: () {},
hoverColor: Colors.red[200],
child: Container(
width: 70.w,
height: 60.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
),
child: Row(
children: [
Image.asset(
'images/call.png',
height: 30.h,
),
Text(
'Call',
style: white,
),
],
),
),
),
我希望我让你很好地理解了这个问题
I hope I made you understand the problem well
请帮我解决问题或提供替代方案.
Please help me solve the issue or provide an alternate to it.
推荐答案
简单的新方法/解决方案
我以某种方式同意 @Matthias 的 答案,但如果您需要更现实的答案而不是将 RoundedRectangleBorder
赋予 customBorder
属性,那么只需使用 CircleBorder()
像下面的例子:
I somehow agree with @Matthias's answer but if you need more realistic answer rather than giving RoundedRectangleBorder
to customBorder
property, then simply use CircleBorder()
like an example below:
InkWell(customBorder: CircleBorder(),//... );
这篇关于在 Flutter 中的 Inkwell 小部件中添加边框半径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!