我在 Row 中添加 InkWell 作为小部件,但它抛出了一个错误:
flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building InkWell(gestures: [tap], clipped to BoxShape.rectangle,
flutter: dirty, state: _InkResponseState<InkResponse>#0e6c5):
flutter: No Material widget found.
flutter: InkWell widgets require a Material widget ancestor.
这是我的代码:
Container(
color: Colors.red,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
InkWell(
onTap: (){
//Forgot password Tapped
},
child: Text(Constants.forgotPassword),),
],
),
InkWell
类将始终与材质类一起使用
请尝试下面的代码。
代码:用 Material 类包装 InkWell 类
Material(
child: InkWell(
onTap: (){
//Forgot password Tapped
},
child: Text(Constants.forgotPassword),),
),
Thanks
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)