【发布时间】:2018-06-09 12:53:13
【问题描述】:
我应该将材质作为 Raw material 按钮的父级放置在哪里,以便它可以响应点击并显示启动颜色。 小部件树如下所示。
Widget build(BuildContext context) {
return new Container(
child: new Center(
child: new Stack(
alignment: Alignment.center,
children: <Widget>[
new Container(
child: new Padding(
padding: const EdgeInsets.all(5.0),
child: new Container(
child: new AudioComponent(
updateMe: [WatchableAudioProperties.audioPlayerState],
playerBuilder: (BuildContext context, AudioPlayer
player,
Widget child) {
IconData icon = Icons.play_arrow;
return new RawMaterialButton(
shape: new CircleBorder(),
fillColor: Colors.white,
splashColor: lightAccentColor,
highlightColor: lightAccentColor.withOpacity(0.5),
elevation: 10.0,
highlightElevation: 5.0,
onPressed: (){},
child: new Padding(
padding: const EdgeInsets.all(8.0),
child: new Icon(
icon,
color: accentColor,
size: 50.0,
),
),
);
},
),
),
),
),
new Container(
height: 151.0,
width: 151.0,
child: waves,
),
],
),
),
);
}
如果我将另一个容器添加到堆栈中并放置一个类似的 RawMaterial 按钮,即使没有在任何地方添加材质小部件,它也会根据需要做出响应。我不明白为什么堆栈中第一个容器中的 RawButton 不起作用
【问题讨论】:
-
也许你的
Container覆盖了按钮,所以它没有触摸输入