-
Notifications
You must be signed in to change notification settings - Fork 29.7k
content dimensions are not established get controller value error #148938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
content dimensions are not established get controller value error #148938
Conversation
|
@Piinks Please check it out |
Piinks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the PR description to provide some context on why this is the right fix?
* master: (181 commits) Fix the scrolling layout deviation of `CupertinoActionSheet` (flutter#149439) Roll Flutter Engine from 60a7bb2353b6 to a6aa5d826649 (2 revisions) (flutter#149627) Roll Flutter Engine from ea72558be758 to 60a7bb2353b6 (2 revisions) (flutter#149623) Place `flutter_gpu` in the package cache. (flutter#149299) Switch to triage-* labels for platform package triage (flutter#149614) Roll pub packages (flutter#149617) Fixes multi line textfield hint text gets ellipsized (flutter#148423) Support failures-only and silent reporters in `flutter test` (flutter#148739) [CupertinoActionSheet] Fix overflow of the overscroll section when the user scrolls far (flutter#149542) Fix InputDecorator.prefixIcon color when disabled (flutter#149595) Added filter callback on dropdown menu (flutter#143939) update generated localized message files in the stocks test app (flutter#148741) Add a simplified SimpleCascadingMenuApp example (flutter#149147) Reland "Prevent LayoutBuilder from rebuilding more than once (flutter#147856)" (flutter#149303) Move some benchmarks from MotoG4 to Mokey (flutter#149567) Roll Packages from d8e8e8c to 11e192a (2 revisions) (flutter#149596) Cleanup triage reports from docs/ (flutter#149545) Roll Flutter Engine from d81edf635a9f to ea72558be758 (1 revision) (flutter#149590) Roll Flutter Engine from b0f4d7459708 to d81edf635a9f (1 revision) (flutter#149468) Roll Flutter Engine from 40b868efcc46 to b0f4d7459708 (1 revision) (flutter#149467) ...
i added,please check |
|
why this pr can fixed #146986 Before determining the content size of the page view, Added If the page view itself has not determined the size and the page value is obtained, an assertion should still be thrown |
|
Two tests failed, I'll deal with them later |
* master: (213 commits) Fix: Memory leak in UndoHistory widget because it never de-registered itself as global UndoManager client (Resolves flutter#148291) (flutter#150661) [CupertinoActionSheet] Fix the layout (part 1) (flutter#149636) Remove discontinued `device_info` and `connectivity` plugins from `flutter_gallery`, roll pub packages (flutter#150585) [a11y] Update semantics in bottom_navigation_bar.dart (flutter#150576) Roll Flutter Engine from dda82d905f37 to 33415c6ee7c2 (7 revisions) (flutter#150637) Reland 4: [CupertinoActionSheet] Match colors to native (flutter#150442) Enable SelectionArea double tap/triple tap gesture support for mobile platforms (flutter#149295) made SelectionArea alignment consistent between web and other platform (flutter#150037) Fix link hook typo (flutter#150194) Stop looking for .packages when analyzing (flutter#150349) Update flutter.dev links from misc packages to more permanent destinations (flutter#150532) Roll Flutter Engine from dd37cefd4a94 to dda82d905f37 (9 revisions) (flutter#150582) Update Material token to the latest 4.1.0 (flutter#150382) Let the lockfile script generate lockfiles for kotlin gradle files as well (flutter#150471) Make popup menu hardcoded padding configurable (flutter#150506) [flutter_tools] un-hide the --dds flag (flutter#150280) [material/menu_anchor.dart] Remove _MenuAnchorState from parent when disposed. (flutter#149586) Add test for inherited_notifier.0.dart (flutter#150344) [CLI tool] in `flutter test`, consider `--flavor` when validating the cached asset bundle (flutter#150461) Test InputDecoration API examples (flutter#148560) ...
|
@Piinks The description and test case issues of the PR have been resolved, please check again |
* master: (23 commits) Roll pub packages (flutter#150810) Remove reference to `MaterialApp` and `showCupertinoModalPopup` from `CupertinoAlertDialog` (flutter#150725) Read `AndroidManifest.xml` and emit `manifest-impeller-(enabled|disabled)` analytics (flutter#150791) [flutter_tools] Shut down Chromium cleanly using a command sent through the debug protocol (flutter#150645) Reland fix inputDecorator hint color on M3 (flutter#150278) Roll Flutter Engine from 62e0b5f9c340 to 94023d711db3 (7 revisions) (flutter#150797) Fix collapsed InputDecorator minimum height (flutter#150770) Add more warm up frame docs (flutter#150464) Roll pub packages (flutter#150739) Add `focusNode`, `focusColor`, `onFocusChange`, `autofocus` to `CupertinoButton` (flutter#150721) Document RenderObject._relayoutBoundary and its invariant; small refactors (flutter#150527) Roll Flutter Engine from 6313b1e5afd7 to 62e0b5f9c340 (1 revision) (flutter#150790) fix a typo (flutter#150682) Fix link in RenderObjectWidget doc comment (flutter#150600) Roll Flutter Engine from fbd92055f3a6 to 6313b1e5afd7 (1 revision) (flutter#150781) [tool] make `ErrorHandlingFileSystem.deleteIfExists` catch error code 3 (`ERROR_PATH_NOT_FOUND` on Windows) (flutter#150741) Roll Packages from 711b4ac to 03f5f6d (21 revisions) (flutter#150779) Roll Flutter Engine from afa7ce19bca8 to fbd92055f3a6 (1 revision) (flutter#150777) Reland Add tests for form_text_field.1.dart (flutter#150481) (flutter#150696) (flutter#150750) Add an example for CupertinoPopupSurface (flutter#150357) ...
Piinks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
nate-thegrate
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great overall—thanks for contributing the bugfix!
| ); | ||
| return !hasPixels || !hasContentDimensions | ||
| return !hasPixels || !(hasContentDimensions || haveDimensions) | ||
| ? null | ||
| : _cachedPage ?? getPageFromPixels(clampDouble(pixels, minScrollExtent, maxScrollExtent), viewportDimension); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could tweak the boolean logic here to make it easier to follow:
return hasPixels && (hasContentDimensions || haveDimensions)
? _cachedPage ?? getPageFromPixels(clampDouble(...), viewportDimension)
: null;Alternatively, we could put a guard statement at the beginning to simplify both the assert and the return statement:
double? get page {
if (!hasPixels) {
return null;
}
assert(
hasContentDimensions || !haveDimensions,
'Page value is only available after content dimensions are established.',
);
return hasContentDimensions || haveDimensions
? _cachedPage ?? getPageFromPixels(clampDouble(...), viewportDimension)
: null;
}| }); | ||
| }); | ||
|
|
||
| testWidgets('Get the page value before the content dimension is determined,do not throw an assertion and return null', (WidgetTester tester) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this test, it looks great!
I have a small wording suggestion
(Edit: I guess the top priority at this point is to figure out why this test is failing.)
|
It looks like the test added by this PR is failing: Even after another frame is pumped, it appears that the value of |
|
Oh that is my fault likely. I fiddled with the test to avoid another round of back and forth. Let me take a look. |
|
|
||
| await tester.pump(); | ||
| currentPage = controller.page == null ? 'null' : 'not empty'; | ||
| expect(find.text('not empty'), findsOneWidget); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, actually it looks like we may have found a bug in adjusting this test. @hello-coder-xu can you take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for test failure: The page is not refreshed after await tester.pump(), and text is still displayed as null. The view needs to be updated before the test can pass normally.
* master: (88 commits) Fix scheduler event loop being stuck due to task with Priority.idle (flutter#151168) Fix result propagation in RenderSliverEdgeInsetsPadding.hitTestChildren (flutter#149825) docImports for flutter_test (flutter#151189) Interactable ScrollView content when settling a scroll activity (flutter#145848) [flutter_tools] Update the mapping for the Dart SDK internal URI (flutter#151170) Roll pub packages (flutter#151129) Fix typo (flutter#151192) [tool] Fix `stdin.flush` calls on processes started by `FakeProcessManager` (flutter#151183) Roll Flutter Engine from 433d360eee11 to 44278941443e (4 revisions) (flutter#151186) Use `ErrorHandlingFileSystem.deleteIfExists` when deleting .plugin_symlinks (flutter#151073) ScrollEndNotification example: auto-scroll based on RenderSliver constraints and geometry (flutter#143538) Roll Packages from 412ec46 to d2705fb (13 revisions) (flutter#151169) docimports for painting (flutter#151143) docimports for scheduler (flutter#151126) `dismissible.dart` code cleanup (flutter#150276) docimports for physics (flutter#151125) docimports for services (flutter#151134) docimports for cupertino (flutter#151149) docimports for gestures (flutter#151123) Docimports for foundation (flutter#151119) ...
nate-thegrate
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great work here!
Roll Flutter from af913a7 to fafd67d (41 revisions) flutter/flutter@af913a7...fafd67d 2024-07-05 [email protected] Roll Flutter Engine from 74d40c160e48 to 4ee09d3b7f3b (1 revision) (flutter/flutter#151346) 2024-07-05 [email protected] Roll Flutter Engine from ba9c7b6336ef to 74d40c160e48 (1 revision) (flutter/flutter#151340) 2024-07-05 [email protected] Roll Flutter Engine from 1f0f950ea02a to ba9c7b6336ef (1 revision) (flutter/flutter#151331) 2024-07-05 [email protected] Roll Flutter Engine from 3c6a373bda3e to 1f0f950ea02a (1 revision) (flutter/flutter#151326) 2024-07-04 [email protected] Roll Flutter Engine from 79a91e38c587 to 3c6a373bda3e (2 revisions) (flutter/flutter#151318) 2024-07-04 [email protected] Roll Packages from d2705fb to 754de19 (3 revisions) (flutter/flutter#151315) 2024-07-04 [email protected] Roll Flutter Engine from 2b6bb516e7e6 to 79a91e38c587 (2 revisions) (flutter/flutter#151314) 2024-07-04 [email protected] Roll Flutter Engine from 8e2d05fa95d7 to 2b6bb516e7e6 (2 revisions) (flutter/flutter#151299) 2024-07-04 [email protected] Roll Flutter Engine from 4190543cb093 to 8e2d05fa95d7 (13 revisions) (flutter/flutter#151293) 2024-07-03 [email protected] Roll pub packages (flutter/flutter#151203) 2024-07-03 [email protected] Fix invalid URL suggestion for gradle incompatability (flutter/flutter#150999) 2024-07-03 [email protected] Cupertino transparent navigation bars (flutter/flutter#149102) 2024-07-03 [email protected] Prepares semantics_update_test for upcoming link URL change (flutter/flutter#151261) 2024-07-03 [email protected] Add a message about spam/brigading (flutter/flutter#150583) 2024-07-03 [email protected] PinnedHeaderSliver example based on the iOS Settings AppBar (flutter/flutter#151205) 2024-07-03 [email protected] Update deprecation policy (flutter/flutter#151257) 2024-07-03 [email protected] SliverFloatingHeader (flutter/flutter#151145) 2024-07-03 [email protected] Remove warning when KGP version not detected (flutter/flutter#151254) 2024-07-03 [email protected] Feat: Add withOpacity to gradient (flutter/flutter#150670) 2024-07-03 [email protected] Fix references in examples (flutter/flutter#151204) 2024-07-03 [email protected] Fix link in tree hygene doc (flutter/flutter#151235) 2024-07-03 [email protected] content dimensions are not established get controller value error (flutter/flutter#148938) 2024-07-03 [email protected] chore: fix typos and link broken (flutter/flutter#150402) 2024-07-03 [email protected] Add example of goldenFileComparator usage in widget tests (flutter/flutter#150422) 2024-07-03 [email protected] Fix project name fallback (flutter/flutter#150614) 2024-07-03 [email protected] Roll Flutter Engine from a3e61c0fd1c2 to 4190543cb093 (1 revision) (flutter/flutter#151241) 2024-07-03 [email protected] Roll Flutter Engine from 8274f54f11be to a3e61c0fd1c2 (2 revisions) (flutter/flutter#151237) 2024-07-03 [email protected] Force regeneration of platform-specific manifests before running performance tests (flutter/flutter#151003) 2024-07-03 [email protected] Handle a SocketException thrown when sending the browser close command to Chrome (flutter/flutter#151197) 2024-07-03 [email protected] Roll Flutter Engine from a02e3f673da3 to 8274f54f11be (4 revisions) (flutter/flutter#151226) 2024-07-03 [email protected] Roll Flutter Engine from c5c0c54d6d1d to a02e3f673da3 (1 revision) (flutter/flutter#151212) 2024-07-03 [email protected] Roll Flutter Engine from 44278941443e to c5c0c54d6d1d (9 revisions) (flutter/flutter#151208) 2024-07-02 [email protected] Fix scheduler event loop being stuck due to task with Priority.idle (flutter/flutter#151168) 2024-07-02 [email protected] Fix result propagation in RenderSliverEdgeInsetsPadding.hitTestChildren (flutter/flutter#149825) 2024-07-02 [email protected] docImports for flutter_test (flutter/flutter#151189) 2024-07-02 [email protected] Interactable ScrollView content when settling a scroll activity (flutter/flutter#145848) 2024-07-02 [email protected] [flutter_tools] Update the mapping for the Dart SDK internal URI (flutter/flutter#151170) 2024-07-02 [email protected] Roll pub packages (flutter/flutter#151129) 2024-07-02 [email protected] Fix typo (flutter/flutter#151192) 2024-07-02 [email protected] [tool] Fix `stdin.flush` calls on processes started by `FakeProcessManager` (flutter/flutter#151183) 2024-07-02 [email protected] Roll Flutter Engine from 433d360eee11 to 44278941443e (4 revisions) (flutter/flutter#151186) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human ...
Fixed #146986
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.