-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
fix: update _floatingActionButtonVisibility only if floatingActionButon is not null #148829
base: master
Are you sure you want to change the base?
fix: update _floatingActionButtonVisibility only if floatingActionButon is not null #148829
Conversation
…pdate * master: (92 commits) Add tests for actions.0.dart API example. (flutter#148678) Introduce `WidgetStateBorderSide.lerp` (flutter#148122) add `default-flavor` field to flutter pubspec, which will be used as the flavor in `flutter build/run` if `--flavor` is not provided (flutter#147968) [wiki migration] Pages under docs/postmortems/ (flutter#148798) Roll Flutter Engine from e5a73e520e89 to c89defa55801 (2 revisions) (flutter#148812) Make hover tests functional and cleanup mouse pointers in Material toggleables (flutter#148808) Fix two dimensional viewport unexpected null exception when no child is laid out (flutter#148256) Roll Flutter Engine from bc1345b6b50a to e5a73e520e89 (3 revisions) (flutter#148807) Add test for undo_history_controller.0.dart (flutter#148205) Roll Flutter Engine from a8872c8915a2 to bc1345b6b50a (6 revisions) (flutter#148802) Fix test that leaks images. (flutter#148494) Fix warnings in `dependency_version_checker.gradle.kts` (flutter#148699) [wiki migration] Android team pages (flutter#148585) Fix leaky test. (flutter#148788) Add DropdownButton.menuWidth (flutter#148125) Add test for focus example 2 (flutter#147624) Add a migrator to remove `FlutterMultiDexApplication.java` (flutter#148515) [wiki migration] Infra team pages (flutter#148718) Roll Flutter Engine from 8a352f01e503 to a8872c8915a2 (1 revision) (flutter#148776) Fix the output of the CDN test. (flutter#148730) ...
e09a2a2
to
05ce0ce
Compare
This comment (#146736 (comment)) reports an issue of the exact same type at the exact same call stack - but doesn't relate to whether there is a FAB. Although this might fix the issue with the FAB, I doubt it will fix the root issue, which seems to be in this line:
The change to the flutter/packages/flutter/lib/src/widgets/transitions.dart Lines 128 to 135 in 26e5352
Interestingly, the mounted check was added in 1d7c680, which doesn't appear to be present on the current beta v3.22.0-0.3.pre. I doubt this check will make a difference, as it's not a set state after disposal issue, but I could be wrong. Can the original issue be reproduced on 'master'? |
I use the latest master, the problem still exists
|
I merged and formatted the code |
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.
As I stated above, I'm not sure this PR fixes the underlying issue, and if it is merged, I will likely have to open another issue that's pretty much exactly the same.
if (scaffold.widget.floatingActionButton != null) { | ||
scaffold._floatingActionButtonVisibilityValue = 1.0; | ||
} |
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 might just be hacking around the problem and not addressing the root cause, but I'll defer to @Piinks.
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 agree with @JaffaKetchup and @justinmc. This does not appear to fix the root issue since it is not dependent on the presence of the FAB.
@hello-coder-xu if you would like to continue working on this, one idea may be to create a test case where this issue reproduces without a FAB. That way if the test passes, we'll know that the primary issue here is fixed.
I'm happy to create an MRE of my case that doesn't use a FAB, but it might take a little while to boil down from what I've got right now. Would that be helpful? |
Here's an MRE. It doesn't do anything complex at all, doesn't even use anything from the The error occurs when the bottom sheet is expanded, then shrunk to/past its initial height. void main() {
final outerBottomSheetController = DraggableScrollableController();
runApp(
MaterialApp(
home: Scaffold(
body: AnimatedBuilder(
animation: outerBottomSheetController,
builder: (context, _) => const SizedBox(),
),
bottomSheet: DraggableScrollableSheet(
controller: outerBottomSheetController,
builder: (context, innerScrollController) => ColoredBox(
color: Colors.black,
child: ListView.builder(
controller: innerScrollController,
itemBuilder: (context, index) => Text(index.toString()),
),
),
),
),
),
);
} |
Yes, I reproduced the problem, and I found another solution, I need some time to verify it |
4e0aaa3
to
3846fea
Compare
I updated it, please check it out |
@@ -1746,4 +1746,49 @@ void main() { | |||
areCreateAndDispose, | |||
); | |||
}); | |||
|
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 add back the test you had for the floating action button? That way we know we fixed both scenarios where this bug presented.
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 updated
@@ -835,7 +835,14 @@ class _DraggableScrollableSheetScrollController extends ScrollController { | |||
curve: Curves.linear, | |||
); | |||
} | |||
extent.updateSize(extent.initialSize, position.context.notificationContext!); | |||
final StatefulElement element = position.context.notificationContext! as StatefulElement; |
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 is very different from the earlier fix, can you explain a bit in the PR description what you found as the root issue, and why this fixes it?
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 added description
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, ok, thank you for adding the comment.
This does not look like the right fix to me.
We should not need to be checking whether or not the element is dirty, and further shouldn't be using a post frame callback to initiate the update. It feels like this is working around the root cause of the issue, do you know why we end up here with a dirty element? Tracing this back further will probably reveal the real issue.
…pdate * 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 d8e8e8cee712 to 11e192a86db3 (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) ...
c4d98fb
to
26adfe6
Compare
@@ -835,7 +835,14 @@ class _DraggableScrollableSheetScrollController extends ScrollController { | |||
curve: Curves.linear, | |||
); | |||
} | |||
extent.updateSize(extent.initialSize, position.context.notificationContext!); | |||
final StatefulElement element = position.context.notificationContext! as StatefulElement; |
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, ok, thank you for adding the comment.
This does not look like the right fix to me.
We should not need to be checking whether or not the element is dirty, and further shouldn't be using a post frame callback to initiate the update. It feels like this is working around the root cause of the issue, do you know why we end up here with a dirty element? Tracing this back further will probably reveal the real issue.
@Piinks |
Fixed #146736
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.