我正在使用浮动动作按钮来暂停和播放动作,但是一个动作正在发生,另一个动作却没有发生。
bool video_record = true;
FloatingActionButton(
backgroundColor: Colors.red,
onPressed: (){
setState(() {
_onRecordButtonPressed();
if(!video_record){
_onStopButtonPressed();
}
});
}
),
答案 0 :(得分:0)
这就是您应该这样做的方式。
FloatingActionButton(
backgroundColor: Colors.red,
onPressed: () {
_onRecordButtonPressed();
if (!video_record) {
_onStopButtonPressed();
}
setState(() {
video_record = !video_record;
});
}),