-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
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]
?
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.
|
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 #175062
Pre-launch Checklist
///
).Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. 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.