-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix Scaffold having status bar when primary is false
#175156
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 Scaffold having status bar when primary is false
#175156
Conversation
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.
Code Review
This pull request correctly addresses the issue where a Scaffold with primary: false would incorrectly include a status bar gesture detector. The change is simple and effective, wrapping the status bar logic in a condition that checks widget.primary. The accompanying tests are well-written, covering both the intended behavior and preventing potential regressions. I have one minor suggestion to fix a typo in a test description.
| removeRightPadding: false, | ||
| removeBottomPadding: true, | ||
| ); | ||
| if (widget.primary) { |
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.
Drive-by nit: This can use an early return instead, to reduce the diff / indent?
if (!widget.primary) {
break;
}
_addIfNonNull(...);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.
Good idea! Thanks for the suggestion
dkwingsmt
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, thank you!
| switch (themeData.platform) { | ||
| case TargetPlatform.iOS: | ||
| case TargetPlatform.macOS: | ||
| if (!widget.primary) { |
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 also add a paragraph explaining this to the document of [primary]?
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 with a couple of doc nits, thanks for the contribution!
| /// If true then the height of the [appBar] will be extended by the height | ||
| /// of the screen's status bar, i.e. the top padding for [MediaQuery]. | ||
| /// | ||
| /// If ture, on iOS and macOS, tapping the status bar scrolls the app's |
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.
| /// If ture, on iOS and macOS, tapping the status bar scrolls the app's | |
| /// If true, on iOS and macOS, tapping the status bar scrolls the app's |
|
|
||
| // On iOS, tapping the status bar scrolls the app's primary scrollable to the | ||
| // top. We implement this by looking up the primary scroll controller and | ||
| // On iOS and macOS, tapping the status bar scrolls the app's primary scrollable |
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.
| // On iOS and macOS, tapping the status bar scrolls the app's primary scrollable | |
| // On iOS and macOS, if `primary` is true, tapping the status bar scrolls the app's primary scrollable |
|
autosubmit label was removed for flutter/flutter/175156, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.
|
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
When primary is false, `Scaffold` is not at the top of screen, so it should not have a status bar. fixes flutter#175062 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
When primary is false,
Scaffoldis not at the top of screen, so it should not have a status bar.fixes #175062
Pre-launch Checklist
///).Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.