RaisedButton我在小部件中使用它时遇到了问题Positioned。
问题是当我RaisedButton在内部 Positioned小部件中使用时,onPressed单击子项时事件没有触发RaisedButton,但是当我单击RaisedButton它的另一个空间时,事件就起作用了。
RaisedButton请注意,它在正常情况下工作正常,并且在使用内部小部件时发生Positioned。
这是我的小部件:
Positioned(
child: Center(
child: SizedBox(
width: 80,
height: 65,
child: RaisedButton(
padding: EdgeInsets.all(0),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
color: Colors.green,
child: Icon(Icons.message, size: 50, color: Colors.white,),
// When I clicked on this icon, onPressed didn't triggered. but when I click on another space of button it triggered.
onPressed: () {
print('Hello world from onPressed');
},
),
),
),
top: -30,
left: 0, …Run Code Online (Sandbox Code Playgroud)