Bläddra i källkod

[flutter]: fix some warnings

appflowy 3 år sedan
förälder
incheckning
fac470be99

+ 7 - 1
app_flowy/lib/startup/tasks/application_task.dart

@@ -62,7 +62,7 @@ class ApplicationBlocObserver extends BlocObserver {
   // ignore: unnecessary_overrides
   void onTransition(Bloc bloc, Transition transition) {
     // Log.debug("[current]: ${transition.currentState} \n\n[next]: ${transition.nextState}");
-    Log.debug("${transition.nextState}");
+    //Log.debug("${transition.nextState}");
     super.onTransition(bloc, transition);
   }
 
@@ -71,4 +71,10 @@ class ApplicationBlocObserver extends BlocObserver {
     Log.debug(error);
     super.onError(bloc, error, stackTrace);
   }
+
+  @override
+  void onEvent(Bloc bloc, Object? event) {
+    Log.debug("$event");
+    super.onEvent(bloc, event);
+  }
 }

+ 1 - 1
app_flowy/lib/workspace/infrastructure/i_view_impl.dart

@@ -57,5 +57,5 @@ class IViewListenerImpl extends IViewListener {
   PublishNotifier<UpdateNotifierValue> get updatedNotifier => repo.updatedNotifier;
 
   @override
-  PublishNotifier<RestoreNotifierValue> get restoredNotifier => repo.updatedNotifier;
+  PublishNotifier<RestoreNotifierValue> get restoredNotifier => repo.restoredNotifier;
 }

+ 11 - 1
app_flowy/lib/workspace/presentation/widgets/menu/widget/app/section/section.dart

@@ -55,6 +55,7 @@ class ViewSection extends StatelessWidget {
 }
 
 class ViewSectionNotifier with ChangeNotifier {
+  bool isDisposed = false;
   List<View> _views;
   View? _selectedView;
   CancelableOperation? _notifyListenerOperation;
@@ -107,7 +108,16 @@ class ViewSectionNotifier with ChangeNotifier {
     _notifyListenerOperation = CancelableOperation.fromFuture(
       Future.delayed(const Duration(milliseconds: 30), () {}),
     ).then((_) {
-      notifyListeners();
+      if (!isDisposed) {
+        notifyListeners();
+      }
     });
   }
+
+  @override
+  void dispose() {
+    isDisposed = true;
+    _notifyListenerOperation?.cancel();
+    super.dispose();
+  }
 }

+ 3 - 1
app_flowy/packages/flowy_infra_ui/lib/style_widget/scrolling/styled_scroll_bar.dart

@@ -59,7 +59,9 @@ class ScrollbarState extends State<StyledScrollbar> {
           ).then((_) {
             // Opti: hide with animation
             hideHandler = true;
-            setState(() {});
+            if (mounted) {
+              setState(() {});
+            }
           });
         } else {
           hideHandler = false;