color: Colors.transparent,
child: Container(
height: barHeight,
margin: const EdgeInsets.fromLTRB(20, 0, 20, 20),
child: Row(
children: <Widget>[
IconButton(
icon: Image.asset(
'images/close.png',
package: 'tencent_cloud_chat_uikit',
),
iconSize: 30,
onPressed: () {
if (_latestValue.isPlaying) {
_playPause();
}
Navigator.of(context).pop();
},
),
Expanded(child: Container()),
if (widget.downloadFn != null)
IconButton(
icon: Image.asset(
'images/bg_download.png',
package: 'tencent_cloud_chat_uikit',
),
iconSize: 30,
onPressed: () async {
// 这里的点击事件偶尔无法响应
setState(() {
isLoading = true;
});
await widget.downloadFn?.call();
Future.delayed(const Duration(milliseconds: 200), () {
setState(() {
isLoading = false;
});
});
},
)
],
),
),
);
将父布局的material控件去掉后
height: barHeight,
margin: const EdgeInsets.fromLTRB(20, 0, 20, 20),
child: Row(
children: <Widget>[
IconButton(
icon: Image.asset(
'images/close.png',
package: 'tencent_cloud_chat_uikit',
),
iconSize: 30,
onPressed: () {
if (_latestValue.isPlaying) {
_playPause();
}
Navigator.of(context).pop();
},
),
Expanded(child: Container()),
if (widget.downloadFn != null)
InkWell(child: IconButton(
icon: Image.asset(
'images/bg_download.png',
package: 'tencent_cloud_chat_uikit',
),
iconSize: 30,
onPressed: () async {
if (TencentUtils.isDoubleClick()) {
return;
}
setState(() {
isLoading = true;
});
await widget.downloadFn?.call();
Future.delayed(const Duration(milliseconds: 200), () {
setState(() {
isLoading = false;
});
});
},
),)
],
),
)
IconButton的点击事件可以响应。每日一问,关于materail控件为何会偶现点击不生效,暂时没查到相关资料~~