Skip to content

Commit 8c88be1

Browse files
author
Rebar Ahmad
authored
Fix/90 web support (#91)
* [fix]: remove dart:io import and check platforms by Theme API * bump version: 1.21.2 * Add changelog entry
1 parent c89ed5b commit 8c88be1

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.21.2
2+
- Observer Widget
3+
- Fix web support by @Ahmadre in [#91](https://github.com/LinXunFeng/flutter_scrollview_observer/pull/91)
4+
15
## 1.21.1
26
- ObserverCore
37
- improve the logic of `handleListObserve` and `handleGridObserve`.

lib/src/common/observer_widget.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* @Date: 2022-08-08 00:20:03
55
*/
66
import 'dart:async';
7-
import 'dart:io';
87

98
import 'package:flutter/foundation.dart';
109
import 'package:flutter/material.dart';
@@ -157,7 +156,8 @@ class ObserverWidgetState<
157156
.contains(notification.runtimeType)) {
158157
final isIgnoreInnerCanHandleObserve =
159158
ScrollUpdateNotification != notification.runtimeType;
160-
if (kIsWeb || Platform.isWindows || Platform.isMacOS) {
159+
final platform = Theme.of(context).platform;
160+
if (kIsWeb || platform == TargetPlatform.windows || platform == TargetPlatform.macOS) {
161161
// Getting bad observation result because scrolling in Flutter Web
162162
// with mouse wheel is not smooth.
163163
// https://github.com/flutter/flutter/issues/78708

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: scrollview_observer
22
description: A widget for observing data related to the child widgets being displayed in a ScrollView.
3-
version: 1.21.1
3+
version: 1.21.2
44
homepage: https://github.com/fluttercandies/flutter_scrollview_observer
55

66
environment:

0 commit comments

Comments
 (0)