Skip to content

Add param "extendedBody" for Scaffold (#17555) - #25654

Closed
IKatsuba wants to merge 10 commits into
flutter:masterfrom
IKatsuba:master
Closed

IKatsuba wants to merge 10 commits into
flutter:masterfrom
IKatsuba:master

Conversation

@IKatsuba

@IKatsuba IKatsuba commented Dec 21, 2018 •

Copy link
Copy Markdown

What's changed

Added parameter Scaffold.extendedBody.

If Scaffold.extendedBody=true and a Scaffold.bottomNavigationBar is specified then the body extends to the bottom of the Scaffold, instead of only extending to the top of Scaffold.bottomNavigationBar.

If the keyboard is closed or the keyboard is open and Scaffold.resizeToAvoidBottomInset=false then the Scaffold.resizeToAvoidBottomInset parameter does not affect Scaffold.extendedBody.

If the keyboard is open and Scaffold.resizeToAvoidBottomInset=true then the body extends to the bottom of the keyboard.

Before

2019-01-21 11 48 46

After

...
Scaffold(extendedBody: true, ...)
...

2019-01-21 11 48 31

Existing issues that the PR fixes

@googlebot

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@IKatsuba

Copy link
Copy Markdown
Author

I signed it!

@googlebot

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@zoechi zoechi added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Dec 21, 2018

@kolja-esders kolja-esders left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Small syntax fix.

@kolja-esders kolja-esders left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Added trailing commas.

@googlebot

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot googlebot added cla: no and removed cla: yes labels Jan 4, 2019
@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Jan 4, 2019
@IKatsuba

Copy link
Copy Markdown
Author

Any update on this?

@HansMuller

Copy link
Copy Markdown
Contributor

Looking now. Sorry about the delay.

@HansMuller

Copy link
Copy Markdown
Contributor

Generally speaking:

  • The PR's description should:
    -- Describe what's being changed and why.
    -- List the existing issues that the PR fixes.
    -- If the PR introduces visual changes, before and after screenshots should be included. If possible, it's helpful to crop full-screen screenshots to highlight the changes.
  • The changes introduced by the PR should defend against regressions with tests.
  • If the changes fix an issue, then a regression test that's specific to the issue should be included.

This PR looks like it will fix #17555

If extendedBody is true, should the body resize when the keyboard is displayed, i.e. when the MediaQuery's viewInset.bottom > 0? Presumably it should unless Scaffold.resizeToAvoidBottomInset is true?

@IKatsuba IKatsuba changed the title Add param "extendedBody" for Scaffold (#17555) [WIP] Add param "extendedBody" for Scaffold (#17555) Jan 21, 2019
@googlebot

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

@IKatsuba

Copy link
Copy Markdown
Author

@HansMuller I edited Issue and added tests

@IKatsuba IKatsuba changed the title [WIP] Add param "extendedBody" for Scaffold (#17555) Add param "extendedBody" for Scaffold (#17555) Jan 22, 2019

@HansMuller HansMuller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The issue's description is much improved, thanks!

The issue's description still needs to explain how the scaffold's body response when the keyboard appears and extendedBody is true.

@IKatsuba IKatsuba changed the title Add param "extendedBody" for Scaffold (#17555) [WIP] Add param "extendedBody" for Scaffold (#17555) Jan 23, 2019
@IKatsuba

Copy link
Copy Markdown
Author

@HansMuller I edited the issue and refactored the tests.

@IKatsuba IKatsuba changed the title [WIP] Add param "extendedBody" for Scaffold (#17555) Add param "extendedBody" for Scaffold (#17555) Jan 25, 2019
@IKatsuba

IKatsuba commented Feb 1, 2019

Copy link
Copy Markdown
Author

Any update on this?

Comment thread analysis_benchmark.json Outdated
"time": 3.488,
"issues": 0,
"missingDartDocs": 0
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you probably didn't mean to include this file?

@IKatsuba IKatsuba Feb 3, 2019 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

deleted 17f794a

/// If true and a [bottomNavigationBar] is specified then the body
/// extends to the bottom of the Scaffold, instead of only extending
/// to the top of the [bottomNavigationBar].
final bool extendedBody;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this should probably be called "extendBody" rather than "extendedBody".

"extend body" says whether we should extend the body or not.
"extended body" says whether the body is extended or not.

In this case, the body can be either, it doesn't have an intrinsic property of being extended. We decide whether to extend it or not. Hence "extend body".

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

renamed param to "extendBody" 17f794a

@Hixie

Hixie commented Feb 4, 2019 •

Copy link
Copy Markdown
Contributor

So I was thinking of using this in my own app, but there's a huge problem with it, as far as I can tell: you have to add padding to the bottom of your list (or whatever is in your body), but there's really no way to know how much padding to add.

@Hixie

Hixie commented Feb 4, 2019

Copy link
Copy Markdown
Contributor

What we really need to do is find a way to put the padding that we add at the bottom into the MediaQuery for the body.

In my app I worked around this like this:

                  body: LayoutBuilder(
                    builder: (BuildContext context, BoxConstraints constraints) {
                      const double bottomPadding = 50.0;
                      final double height = constraints.maxHeight + bottomPadding;
                      final MediaQueryData metrics = MediaQuery.of(context);
                      return OverflowBox(
			minWidth: constraints.maxWidth,
                        maxWidth: constraints.maxWidth,
                        minHeight: height,
                        maxHeight: height,
                        alignment: Alignment.topCenter,
                        child: MediaQuery(
                          data: metrics.copyWith(padding: metrics.padding.copyWith(bottom: bottomPadding)),
                          child: TabBarView(
                            children: pages,
                          ),
                        ),
                      );
                    },
	          ),

@IKatsuba

IKatsuba commented Feb 4, 2019

Copy link
Copy Markdown
Author

@Hixie thanks, I understood. I'll try to do

@aytunch

aytunch commented Feb 7, 2019

Copy link
Copy Markdown

Is this going to be merged to Flutter soon? Personally I think it gives meaning to notched fab and bnb

@IKatsuba

IKatsuba commented Feb 8, 2019

Copy link
Copy Markdown
Author

@aytunch sorry, I do not have much time to work on PR. I will try to continue next week.

@HansMuller

Copy link
Copy Markdown
Contributor

@IKatsuba I'm working on a version of this PR that generates the appropriate MediaQuery to per #25654 (comment). It's a bit tricky. I hope to have something up for review today.

@IKatsuba

Copy link
Copy Markdown
Author

@HansMuller sorry guys. Trying to find time in the next couple of days.

@HansMuller

Copy link
Copy Markdown
Contributor

I've moved this PR to #27973, so I'm going to close this one.

@IKatsuba - thanks for looking into this issue and writing a fix! I hope to land #27973 tomorrow or early next week.

@HansMuller HansMuller closed this Feb 15, 2019
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants