Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit 90a58a5

Browse files
authored
[visibility_detector] Adapt to upcoming changes in Flutter (#480)
1 parent eb38a4d commit 90a58a5

25 files changed

+102
-112
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ jobs:
4949
- name: flutter test
5050
run: flutter test
5151

52-
- name: flutter format
53-
run: flutter format --dry-run --set-exit-if-changed .
52+
- name: dart format
53+
run: dart format -o none --set-exit-if-changed .
5454
# Only test formatting on one version of Flutter.
5555
if: ${{ matrix.version == 'stable' }}
5656

packages/scrollable_positioned_list/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.3.8+1
2+
* Migrate tests off deprecated APIs.
3+
* Bump min Flutter version to 3.1.0.
4+
15
# 0.3.8
26
* Add ScrollOffsetController to allow pixel-based changes in offset.
37
* Bump min sdk version to 2.15.0

packages/scrollable_positioned_list/example/test/scrollable_positioned_list_example_test.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
// found in the LICENSE file.
44

55
import 'package:flutter/material.dart';
6-
import 'package:flutter/rendering.dart';
76
import 'package:flutter_test/flutter_test.dart';
87
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
98

109
import 'package:scrollable_positioned_list_example/main.dart';
1110

1211
void main() {
1312
setUp(() {
14-
WidgetsBinding.instance.renderView.configuration = TestViewConfiguration(
15-
size: const Size(800, 900), window: RendererBinding.instance.window);
13+
WidgetsBinding.instance.renderView.configuration =
14+
TestViewConfiguration.fromView(
15+
size: const Size(800, 900),
16+
view: WidgetsBinding.instance.platformDispatcher.views.single,
17+
);
1618
});
1719

1820
testWidgets('Start at 0', (WidgetTester tester) async {

packages/scrollable_positioned_list/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: scrollable_positioned_list
2-
version: 0.3.8
2+
version: 0.3.8+1
33
description: >
44
A list with helper methods to programmatically scroll to an item.
55
homepage: https://github.com/google/flutter.widgets/tree/master/packages/scrollable_positioned_list
66

77
environment:
88
sdk: '>=2.15.0 <4.0.0'
9-
flutter: '>=2.12.0'
9+
flutter: '>=3.1.0'
1010

1111
dependencies:
1212
flutter:

packages/scrollable_positioned_list/test/horizontal_scrollable_positioned_list_test.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ void main() {
2222
EdgeInsets? padding,
2323
int initialScrollIndex = 0,
2424
}) async {
25-
tester.binding.window.devicePixelRatioTestValue = 1.0;
26-
tester.binding.window.physicalSizeTestValue =
27-
const Size(screenWidth, screenHeight);
25+
tester.view.devicePixelRatio = 1.0;
26+
tester.view.physicalSize = const Size(screenWidth, screenHeight);
2827

2928
await tester.pumpWidget(
3029
MaterialApp(

packages/scrollable_positioned_list/test/positioned_list_test.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ void main() {
2424
double anchor = 0,
2525
int itemCount = defaultItemCount,
2626
}) async {
27-
tester.binding.window.devicePixelRatioTestValue = 1.0;
28-
tester.binding.window.physicalSizeTestValue =
29-
const Size(screenWidth, screenHeight);
27+
tester.view.devicePixelRatio = 1.0;
28+
tester.view.physicalSize = const Size(screenWidth, screenHeight);
3029

3130
await tester.pumpWidget(
3231
MaterialApp(

packages/scrollable_positioned_list/test/reversed_positioned_list_test.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ void main() {
2323
double anchor = 0,
2424
int itemCount = defaultItemCount,
2525
}) async {
26-
tester.binding.window.devicePixelRatioTestValue = 1.0;
27-
tester.binding.window.physicalSizeTestValue =
28-
const Size(screenWidth, screenHeight);
26+
tester.view.devicePixelRatio = 1.0;
27+
tester.view.physicalSize = const Size(screenWidth, screenHeight);
2928

3029
await tester.pumpWidget(
3130
MaterialApp(

packages/scrollable_positioned_list/test/reversed_scrollable_positioned_list_test.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ void main() {
2121
EdgeInsets? padding,
2222
int initialIndex = 0,
2323
}) async {
24-
tester.binding.window.devicePixelRatioTestValue = 1.0;
25-
tester.binding.window.physicalSizeTestValue =
26-
const Size(screenWidth, screenHeight);
24+
tester.view.devicePixelRatio = 1.0;
25+
tester.view.physicalSize = const Size(screenWidth, screenHeight);
2726

2827
await tester.pumpWidget(
2928
MaterialApp(

packages/scrollable_positioned_list/test/scroll_offset_controller_test.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ void main() {
3737
double? minCacheExtent,
3838
bool variableHeight = false,
3939
}) async {
40-
tester.binding.window.devicePixelRatioTestValue = 1.0;
41-
tester.binding.window.physicalSizeTestValue =
42-
const Size(screenWidth, screenHeight);
40+
tester.view.devicePixelRatio = 1.0;
41+
tester.view.physicalSize = const Size(screenWidth, screenHeight);
4342

4443
await tester.pumpWidget(
4544
MaterialApp(

packages/scrollable_positioned_list/test/scroll_offset_listener_test.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ void main() {
3636
double? minCacheExtent,
3737
bool variableHeight = false,
3838
}) async {
39-
tester.binding.window.devicePixelRatioTestValue = 1.0;
40-
tester.binding.window.physicalSizeTestValue =
41-
const Size(screenWidth, screenHeight);
39+
tester.view.devicePixelRatio = 1.0;
40+
tester.view.physicalSize = const Size(screenWidth, screenHeight);
4241

4342
await tester.pumpWidget(
4443
MaterialApp(

0 commit comments

Comments
 (0)