[flutter]: fix some warnings

This commit is contained in:
appflowy 2021-11-04 13:22:35 +08:00
parent ad2a5179a8
commit fac470be99
4 changed files with 22 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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();
}
}

View File

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