Skip to content

Conversation

@Piinks
Copy link
Contributor

@Piinks Piinks commented Aug 6, 2024

WIP - I am not sure this is the right fix, as I've worked on it it's grown in complexity.

This issue is urgent for an internal customer (b/357067239)

This crash can happen from multiple code paths, the customer issue does not have a repro, but I found two in the issue tracker:

I think these PRs are related, which is why the CC for @bleroux & @chunhtai - what do you two think here? I broke 3 tests here, not sure if this is the right way to go.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Aug 6, 2024
@chunhtai chunhtai self-requested a review August 6, 2024 18:34
// Dispose if we had one already, this can happen if the index of the tab
// controller, which sets _currentIndex, changes before we have laid out.
_pageController?.dispose();
_pageController = PageController(
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing this, can _pageController somehow sets its _PagePosition's _pageToUseOnStartup if the viewport dimension is not yet applied?

if (_controller!.index != _currentIndex) {
_currentIndex = _controller!.index;
_warpToCurrentIndex();
if (_pageCanChange()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what happen if this is false? do we just drop the change?

auto-submit bot pushed a commit that referenced this pull request Aug 7, 2024
…s are set (#153017)

## Description

This PR fixes `PageController` throwing when using `jumpToPage` or `animateToPage` to switch page before the viewport dimensions were retrieved.

Solution based on #152947 (comment).

## Related Issue

Fixes #86222.
Fixes #152079

## Tests

Adds 2 tests.
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…s are set (flutter#153017)

## Description

This PR fixes `PageController` throwing when using `jumpToPage` or `animateToPage` to switch page before the viewport dimensions were retrieved.

Solution based on flutter#152947 (comment).

## Related Issue

Fixes flutter#86222.
Fixes flutter#152079

## Tests

Adds 2 tests.
@Piinks Piinks closed this Aug 7, 2024
DBowen33 pushed a commit to DBowen33/flutter that referenced this pull request Aug 16, 2024
…s are set (flutter#153017)

## Description

This PR fixes `PageController` throwing when using `jumpToPage` or `animateToPage` to switch page before the viewport dimensions were retrieved.

Solution based on flutter#152947 (comment).

## Related Issue

Fixes flutter#86222.
Fixes flutter#152079

## Tests

Adds 2 tests.
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…s are set (flutter#153017)

## Description

This PR fixes `PageController` throwing when using `jumpToPage` or `animateToPage` to switch page before the viewport dimensions were retrieved.

Solution based on flutter#152947 (comment).

## Related Issue

Fixes flutter#86222.
Fixes flutter#152079

## Tests

Adds 2 tests.
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.

2 participants