타이머를 만드는 중이고 타이머 내부의 텍스트를 변경하는 재생 및 일시 중지 버튼이 있습니다. "재생"을 누르면 타이머가 계산을 시작하지만 일시 중지하면 버튼의 텍스트와 타이머 내부의 텍스트가 변하지 않는 이유를 아는 사람이 있습니까?
AnimatedBuilder(
animation: controller,
builder: (context, child) {
return Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 0),
child: FloatingActionButton.extended(
backgroundColor: Colors.grey[50],
onPressed: () {
if (controller.isAnimating){
controller.stop();
}
else {
controller.reverse(
from: controller.value == 0.0
? 1.0
: controller.value);
}
},
icon: Icon(controller.isAnimating
? Icons.pause
: Icons.play_arrow),
label: Text(
controller.isAnimating ? "Pause" : "Play")),
);
}),
전화 controller.stop();
를 시도하십시오setState
이렇게 :
setState(() {
controller.stop();
});
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다