Skip to content

Automatically inherit the theme from context #2

Description

@dJani97

Hi there!

I tried this button in my project, and I have some ideas on how to improve it.

If I use ElevatedButton() just by itself, it will conform to my app's style, but if I use EasyButton(type: EasyButtonType.elevated), it just appears as a blue, square rectangle, with full-width. The only way to change this is to pass in each individual parameter like buttonColor, borderRadius and width, making the use of this button a bit counter-productive.

So it'd be great if the button would inherit Theme.of(context).buttonTheme, Theme.of(context).elevatedButtonTheme, etc., just like the default material buttons do.

Alternatively, having a constructor parameter to pass in the theme would be a nice compromise. For example:

EasyButton(
  type: EasyButtonType.elevated,
  elevatedButtonTheme: Theme.of(context).elevatedButtonTheme,
  // ...
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions