Skip to content

Make sure that a RefreshIndicator doesn't crash in 0x0 environment#177644

Merged
auto-submit[bot] merged 6 commits into
flutter:masterfrom
ahmedsameha1:handle#6537-RefreshIndicator
Nov 11, 2025
Merged

Make sure that a RefreshIndicator doesn't crash in 0x0 environment#177644
auto-submit[bot] merged 6 commits into
flutter:masterfrom
ahmedsameha1:handle#6537-RefreshIndicator

Conversation

@ahmedsameha1

Copy link
Copy Markdown
Contributor

This is my attempt to handle #6537 for the RefreshIndicator widget.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Oct 28, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a test to prevent a regression for issue #6537, where RefreshIndicator could crash in a zero-sized environment. The test correctly sets up this scenario.

My review identifies that the test is incomplete as it doesn't trigger the scrolling behavior that could cause the crash. I've provided suggestions to add a drag gesture simulation to the test and to make the ListView scrollable, making the test more comprehensive and robust for catching this kind of regression.

),
),
);
expect(tester.getSize(find.byType(RefreshIndicator)), Size.zero);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current test only verifies that the widget can be pumped without crashing. To properly test for the crash described in issue #6537, which occurs during a scroll, a drag gesture should be simulated. This will trigger the code path that could cause a crash and ensure the fix is effective.

    expect(tester.getSize(find.byType(RefreshIndicator)), Size.zero);

    // Drag to trigger a scroll notification to test the drag behavior in a
    // zero-sized environment, which could cause a crash.
    final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(Center)));
    await gesture.moveBy(const Offset(0.0, 20.0));
    await tester.pump();
    await gesture.up();
    await tester.pumpAndSettle();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

child: SizedBox.shrink(
child: RefreshIndicator(
onRefresh: refresh,
child: ListView(children: const <Text>[Text('X')]),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To ensure the ListView is scrollable even when its content fits within its (zero-sized) viewport, you should add physics: const AlwaysScrollableScrollPhysics(). This makes the test more robust for triggering scroll notifications.

Suggested change
child: ListView(children: const <Text>[Text('X')]),
child: ListView(physics: const AlwaysScrollableScrollPhysics(), children: const <Text>[Text('X')]),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@victorsanni victorsanni requested a review from dkwingsmt October 30, 2025 22:14

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. (I'm a bit surprised that this would work!)

@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit

auto-submit Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/177644, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR.

@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit auto-submit Bot added this pull request to the merge queue Nov 11, 2025
Merged via the queue into flutter:master with commit 45fe915 Nov 11, 2025
76 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
IvoneDjaja pushed a commit to IvoneDjaja/flutter that referenced this pull request Nov 22, 2025
…lutter#177644)

This is my attempt to handle
flutter#6537 for the RefreshIndicator
widget.

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
…lutter#177644)

This is my attempt to handle
flutter#6537 for the RefreshIndicator
widget.

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…lutter#177644)

This is my attempt to handle
flutter#6537 for the RefreshIndicator
widget.

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants