Skip to content

Getting the body behind transparent Appbar #17088

Closed

Description

@RyanAfrish7

Is there a configuration in Scaffold class which can be utilized for the purpose of putting the body behind transparent Appbar?

Without this capability Scaffold becomes useless when having a transparent Appbar. I hope that the material guidelines don't discourage transparent appbar.

Activity

  1. lukepighetti commented on Jun 18, 2018

    @lukepighetti
    Contributor

    I would like to be able to make the appBar transparent and apply a blur. Thank you.

  2. RyanAfrish7 commented on Jun 18, 2018

    @RyanAfrish7
    Author

    I found a way to achieve this. Setup your Scaffold as follows.

    Remove the appBar from the appBar slot of the Scaffold. Add the appBar into a Stack within the Scaffold's body. Add another Container to fill the screen to the Stack. Add all the components into that Container. That's it. You may now add background blur to the appBar and it works like a charm.

  3. RyanAfrish7 commented on Jun 18, 2018

    @RyanAfrish7
    Author

    Will add a snippet as soon as I find some time.

  4. lukepighetti commented on Jun 18, 2018

    @lukepighetti
    Contributor

    Does this break anything unintended?

  5. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jun 19, 2018
  6. zoechi commented on Jun 19, 2018

    @zoechi
    Contributor
  7. Hixie commented on Jun 19, 2018

    @Hixie
    Contributor

    If your body can scroll, then I recommend using SliverAppBar and putting it inside the scrolling container. If it can't scroll, then I don't really understand what part of the body should be below the app bar, can you elaborate?

  8. lukepighetti commented on Jun 19, 2018

    @lukepighetti
    Contributor

    Hi @Hixie , what you are recommending is contrary to standard rules of engagement for AppBar UI on iOS.

  9. Hixie commented on Jun 22, 2018

    @Hixie
    Contributor

    Can you describe these rules of engagement in more detail? I wasn't aware that this bug was specific to iOS.

  10. added this to the milestone on Jun 22, 2018
  11. Hixie commented on Jun 22, 2018

    @Hixie
    Contributor
  12. xster commented on Jun 22, 2018

    @xster
    Contributor

    @lukepighetti, is there a specific Material Design on iOS convention wrt transparency you're referring to?

  13. lukepighetti commented on Jun 23, 2018

    @lukepighetti
    Contributor

    This is a feature request, I suppose.

    In the absence of a Cupertino layout, being able to adjust the AppBar transparency & blur and show the content behind it would allow it to appear more Cupertino without having to rewrite the base scaffold or whatever you want to call it. I would even argue that it could look nice on Android as well.

  14. 16 remaining items

  15. herkulano commented on Feb 27, 2019

    @herkulano

    @willlarche the new material gmail on android has a nice transparent AppBar.

    screenshot_20190227-141650

  16. TheChrisED commented on Mar 26, 2019

    @TheChrisED

    I would argue this is also important for bottom app bars. While the designers may be undecided on whether transparent app bars should be in the Material Design spec, inset floating action buttons are part of Material Design. See this screenshot from material.io:

    Bildschirmfoto 2019-03-26 um 15 31 07
    For this to work with a scrolling view, the bottom app bar needs to be on top of the body of the Scaffold. I also cannot use a CupertinoTabScaffold because the material Scaffold widget takes care of placing the floating action button, which CupertinoTabScaffold cannot do.
    This is a screenshot from my current project, where the body currently does not scroll behind the bottom app bar, therefore its notch just shows the canvas color:

    inset-fab-scrollview

  17. willlarche commented on Mar 26, 2019

    @willlarche
    Contributor

    @TheChrisED , you're right that this affects bottom rect components too.

    BTW: The top one is bottom app bar but the bottom one is actually bottom nav!

  18. Ahmadre commented on May 16, 2019

    @Ahmadre

    Actually this trick (using stack) worked for me and I'm pretty satisfied with the result:
    https://stackoverflow.com/a/53666091/2735029

    Let me know what you think.

    I tried that solution, but breaks with safe-area, so: not the yellow of the egg...

  19. damiantew commented on May 31, 2019

    @damiantew

    <AppBar position="static" style={{ background: 'transparent', boxShadow: 'none'}}>

  20. self-assigned this
    on Jun 26, 2019
  21. HansMuller commented on Jun 28, 2019

    @HansMuller
    Contributor

    Fixing this issue by making it possible to extend a Scaffold's body behind its AppBar seems reasonable.

    Sadly, four months ago, I introduced a boolean Scaffold flag called extendBody. It means: extend the body behind the Scaffold's bottom navigation bar.

    Rather than adding extendUpperBody (or whatever) I think it would be best to change extendBody to an enum with three values. That's a breaking change ofcourse. Need some feedback from developers to see if that's OK.

  22. Hixie commented on Jul 1, 2019

    @Hixie
    Contributor

    I dunno, I think extending down and extending up are orthogonal issues, it makes sense that they'd be separately controllable.

  23. jonataslaw commented on Jul 31, 2019

    @jonataslaw

    I need it

  24. wsakka commented on Aug 4, 2019

    @wsakka

    Rather than adding extendUpperBody (or whatever) I think it would be best to change extendBody to an enum with three values. That's a breaking change ofcourse. Need some feedback from developers to see if that's OK.

    @HansMuller Not sure why you'd opt for the breaking change. I'd rather see it as extendBehindAppbar or something similar.

  25. github-actions commented on Aug 15, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  26. locked as resolved and limited conversation to collaborators on Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

frameworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesplatform-iosiOS applications specificallywaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions