我遇到一种情况,我希望在点击小部件时可以看到模态底部工作表。
此代码可以正常工作(来自小部件,它基本上是一张“卡片”):
return Container(
color: Colors.white,
margin: EdgeInsets.symmetric(horizontal: 5.0),
child: Material(
child: InkWell(
onTap: () {
showMaterialModalBottomSheet(
expand: false,
context: context,
builder: (context) =>
customiseItemScreen(item: this.item,),
);
},
...
...
但是,我还想在customiseItemScreen
小部件。当涉及到脚手架时,很容易理解:
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton:
...
...
但是由于customiseItemScreen
返回一个Material(不带脚手架),以上成员不存在。有没有更好的方法来解决这个问题,或者现有代码中可能缺少的解决方案?
提前致谢,
您可以将 Stack 小部件与 Positioned 小部件一起使用
Stack(
children: [
Material(...),
Positioned(...) //put a button inside and position it with bottom and right
)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)