Skip to content

Commit

Permalink
fix(ObserverWidget): scrolling with the Mouse Wheel is not smooth
Browse files Browse the repository at this point in the history
  • Loading branch information
qiangjindong authored Sep 17, 2023
1 parent b45c7f5 commit 4b04a4e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/src/common/observer_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @Repo: https://github.com/LinXunFeng/flutter_scrollview_observer
* @Date: 2022-08-08 00:20:03
*/
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
Expand Down Expand Up @@ -149,17 +151,16 @@ class ObserverWidgetState<
onNotification: (notification) {
if (innerAutoTriggerObserveScrollNotifications
.contains(notification.runtimeType)) {
if (kIsWeb) {
if (kIsWeb || Platform.isWindows || Platform.isMacOS) {
// Getting bad observation result because scrolling in Flutter Web
// with mouse wheel is not smooth.
// https://github.com/flutter/flutter/issues/78708
// https://github.com/flutter/flutter/issues/78634
//
// issue
// https://github.com/LinXunFeng/flutter_scrollview_observer/issues/31
Future.delayed(const Duration(milliseconds: 1), () {
handleContexts();
});
WidgetsBinding.instance
.addPostFrameCallback((_) => handleContexts());
} else {
handleContexts();
}
Expand Down

0 comments on commit 4b04a4e

Please sign in to comment.