Skip to content

Proposal to add margin to MaterialBanner constructor #118704

Closed

Description

@HELL-i

Use case

I would like to put an outer margin on the material banner.

Line 296 - 297:
    Widget materialBanner = Container(
      margin: EdgeInsets.only(bottom: elevation > 0 ? 10.0 : 0.0),

For example:
 const MaterialBanner({
    super.key,
    required this.content,
    this.contentTextStyle,
    required this.actions,
    this.elevation,
--> this.margin

Proposal

The goal is to get the Material banner with outer margin to get the design like this:
Screenshot 2023-01-18 at 17 01 19

Activity

  1. darshankawar commented on Jan 19, 2023

    @darshankawar
    Member

    @HELL-i
    There's already a margin property as I see here:

    margin: EdgeInsets.only(bottom: elevation > 0 ? 10.0 : 0.0),

    Can you try to make use of that and see if it helps in your case ?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 19, 2023
  3. HELL-i commented on Jan 19, 2023

    @HELL-i
    Author

    @darshankawar
    THX, but i want to set a margin around the material banner and not only at the bottom this can done over the elevation.
    The constructor not including the margin to override it at line 340.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 19, 2023
  5. darshankawar commented on Jan 19, 2023

    @darshankawar
    Member

    I see, thanks for the insight. I'll treat this as a proposal to add margin to MaterialBanner widget.

  6. added
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Jan 19, 2023
  7. changed the title [-]MaterialBanner set outer margin[/-] [+]Proposal to add `margin` to MaterialBanner constructor[/+] on Jan 19, 2023
  8. HELL-i commented on Jan 19, 2023

    @HELL-i
    Author

    THX

  9. HansMuller commented on Jan 19, 2023

    @HansMuller
    Contributor

    The seems like a reasonable feature to add, so long as the defaults don't change. @HELL-i - would be interested in contributing a PR that adds this features (and tests it)?

  10. hasnentai commented on Jan 23, 2023

    @hasnentai
    Contributor

    @HansMuller @darshankawar I would like to work on this issue

  11. HELL-i commented on Jan 23, 2023

    @HELL-i
    Author
  12. hasnentai commented on Jan 23, 2023

    @hasnentai
    Contributor

    @HELL-i Cool I think this looks fine. Thanks for the update

  13. HELL-i commented on Jan 23, 2023

    @HELL-i
    Author

    @hasnentai When i have time i will add widget tests and then i will create the PR.

  14. hasnentai commented on Jan 23, 2023

    @hasnentai
    Contributor

    @HELL-i I added the changes along with Widget Test. Additionally, I also added a margin in withAnimation method and Raised the PR #119005
    cc: @Piinks @shihaohong

  15. added
    r: fixedIssue is closed as already fixed in a newer version
    on Jan 27, 2023
  16. github-actions commented on Mar 3, 2023

    @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.

  17. locked as resolved and limited conversation to collaborators on Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions