Преглед на файлове

ToggleSwitch: Check if widget is mounted before calling setState

Neeraj Gupta преди 2 години
родител
ревизия
f2d9507ead
променени са 2 файла, в които са добавени 8 реда и са изтрити 6 реда
  1. 3 3
      lib/generated/intl/messages_nl.dart
  2. 5 3
      lib/ui/components/toggle_switch_widget.dart

+ 3 - 3
lib/generated/intl/messages_nl.dart

@@ -148,13 +148,13 @@ class MessageLookup extends MessageLookupByLibrary {
   static String m28(emailIDs) => "Gedeeld met ${emailIDs}";
 
   static String m29(fileType) =>
-      "Dit ${fileType} zal worden verwijderd van jouw apparaat.";
+      "Deze ${fileType} zal worden verwijderd van jouw apparaat.";
 
   static String m30(fileType) =>
-      "Dit ${fileType} staat zowel in ente als in jouw apparaat.";
+      "Deze ${fileType} staat zowel in ente als op jouw apparaat.";
 
   static String m31(fileType) =>
-      "Dit ${fileType} zal worden verwijderd uit ente.";
+      "Deze ${fileType} zal worden verwijderd uit ente.";
 
   static String m32(storageAmountInGB) => "${storageAmountInGB} GB";
 

+ 5 - 3
lib/ui/components/toggle_switch_widget.dart

@@ -83,9 +83,11 @@ class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
                     if (executionState == ExecutionState.inProgress) {
                       executionState = ExecutionState.successful;
                       Future.delayed(const Duration(seconds: 2), () {
-                        setState(() {
-                          executionState = ExecutionState.idle;
-                        });
+                        if (mounted) {
+                          setState(() {
+                            executionState = ExecutionState.idle;
+                          });
+                        }
                       });
                     }
                   } else {