颤振溢出定位的按钮不可单击 [英] Flutter overflowed positioned Button is not clickable
本文介绍了颤振溢出定位的按钮不可单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个堆栈小部件,其父元素是这样的定位部件:
I have a stack widget parenting a Positioned widget like this:
Stack(
overflow: Overflow.visible,
children: [
Container(
width: 150,
height: 150,
),
Positioned(
child: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
print('FAB tapped!');
},
backgroundColor: Colors.blueGrey,
),
right: 0,
left: 0,
bottom: -26,
),
],
),
位于晶圆厂外部的晶圆厂部分不可点击,解决方案是什么?
,这是屏幕截图:
That part of the fab which is placed outside the container is not clickable, what is the solution? and here is a screenshot:
推荐答案
尝试一下:
Stack(
overflow: Overflow.visible,
children: [
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>
[
Container(width: 150, height: 150, color: Colors.yellow),
Container(width: 150, height: 28, color: Colors.transparent),
],
),
Positioned(
child: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
print('FAB tapped!');
},
backgroundColor: Colors.blueGrey,
),
right: 0,
left: 0,
bottom: 0,
),
],
)
如果希望按钮保持可点击状态,则应将按钮保留在堆栈中
you should keep button inside of stack if you want it to stay clickable
这篇关于颤振溢出定位的按钮不可单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文