Skip to content
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

Allow a BoxDecoration to be specified in ButtonThemeData #41627

Closed
jkurtw opened this issue Sep 30, 2019 · 6 comments
Closed

Allow a BoxDecoration to be specified in ButtonThemeData #41627

jkurtw opened this issue Sep 30, 2019 · 6 comments
Labels
c: new feature Nothing broken; request for a new capability f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Comments

@jkurtw
Copy link

jkurtw commented Sep 30, 2019

Internal: b/141787699

Flutter doesn't have a good way of decorating a button with something that isn't a flat color. This is because the underlying Material widget doesn't allow for it.

Right now we just stack a DecoratedBox behind a MaterialButton with a transparent background. This works for our larger buttons, but fails for our smaller buttons, since the MaterialButton pads the height up to 48dp. This makes the button look like a regular sized button and there's no reasonable way to workaround it.

A proper fix would be to allow a BoxDecoration to be specified in ButtonThemeData. Then we can remove the Stack + DecoratedBox workaround.

Related to or same as #21125

@jkurtw
Copy link
Author

jkurtw commented Sep 30, 2019

b/141787699

@escamoteur escamoteur added f: material design flutter/packages/flutter/material repository. c: new feature Nothing broken; request for a new capability a: annoyance Repeatedly frustrating issues with non-experimental functionality labels Sep 30, 2019
@HansMuller HansMuller added the framework flutter/packages/flutter repository. See also f: labels. label Oct 1, 2019
@shihaohong
Copy link
Contributor

Hi @jkurtw, we shouldn't support this type of modification since that would violate the Material specification.

However, I think what you could be looking for is creating a custom button composed of a GestureDetector and a Container, similar to this S.O. post.

@lukepighetti
Copy link

lukepighetti commented Oct 6, 2019

@shihaohong Does it "violate" the Material spec or is it unspecified by Material spec?

@shihaohong
Copy link
Contributor

shihaohong commented Oct 7, 2019

I believe that modifying components to have an appearance not described in the design language is a violation of the design language.

@jkurtw
Copy link
Author

jkurtw commented Oct 7, 2019

/cc @willlarche for your thoughts

@filiph filiph removed the a: annoyance Repeatedly frustrating issues with non-experimental functionality label Oct 15, 2019
@Hixie Hixie closed this as completed Mar 15, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

No branches or pull requests

7 participants