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

💡 MacosStateProperty #142

Closed
bdlukaa opened this issue Jun 18, 2021 · 2 comments
Closed

💡 MacosStateProperty #142

bdlukaa opened this issue Jun 18, 2021 · 2 comments
Assignees

Comments

@bdlukaa
Copy link
Contributor

bdlukaa commented Jun 18, 2021

Use case

On the material library, we can customize the way a widget looks at every state: disabled, pressing, hovering and focused. That's possible because of MaterialStateProperty<T>. We should have one as well.

Proposal

Create MacosStateProperty<T>, a class that will handle how widgets should look like at every state.

Here's a little example of how it should look like:

PrimaryButton(
  cursor: MacosStateProperty.all(MouseCursor.defer), // Sets a value for all the states
  color: MacosStateProperty.resolveWith((Set<MacosState> states) {
    // sets a value of every state
    if (states.contains(MacosState.disabled)) return MacosTheme.of(context).disabledColor;
    // pressing
    // hovering
    // focused
    return defaultColor;
  }),
  ...
),
@bdlukaa bdlukaa self-assigned this Jun 18, 2021
@bdlukaa bdlukaa changed the title 💡 MaterialStateProperty for this package 💡 MacosStateProperty Jun 18, 2021
@bdlukaa
Copy link
Contributor Author

bdlukaa commented Jun 18, 2021

I can make a PR for this tomorrow

@bdlukaa
Copy link
Contributor Author

bdlukaa commented Jun 22, 2021

I realized this is useless. Widgets such as PushButton, BackButton and IconButton handle their colors internally (for pressing/hovering). The other inputs (checkbox, radio button, switch) doesn't change the color on mouse hover/press.

@bdlukaa bdlukaa closed this as completed Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant