Explorar o código

Check if mounted before calling setState()

ashilkn %!s(int64=2) %!d(string=hai) anos
pai
achega
011fb59a58
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      lib/ui/components/buttons/button_widget.dart

+ 5 - 3
lib/ui/components/buttons/button_widget.dart

@@ -216,9 +216,11 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
   Widget build(BuildContext context) {
     if (executionState == ExecutionState.successful) {
       Future.delayed(Duration(seconds: widget.isInAlert ? 1 : 2), () {
-        setState(() {
-          executionState = ExecutionState.idle;
-        });
+        if (mounted) {
+          setState(() {
+            executionState = ExecutionState.idle;
+          });
+        }
       });
     }
     return GestureDetector(