ubuntu / yaru.dart

Ubuntu Yaru Flutter widgets and themes for building desktop and web applications
https://ubuntu.github.io/yaru.dart/
Mozilla Public License 2.0
179 stars 33 forks source link

feat(YaruWindowControl)!: use material state properties for colors #859

Closed Jupi007 closed 4 months ago

Jupi007 commented 4 months ago

This PR fix the property name, and add more flexibility in the way you can customize the colors:

YaruWindowControl(
  ...
  backgroundColor:
      MaterialStateProperty.resolveWith((states) {
    if (states.contains(MaterialState.pressed)) {
      return Colors.green;
    }
    if (states.contains(MaterialState.hovered)) {
      return Colors.blue;
    }
    if (states.contains(MaterialState.disabled)) {
      return Colors.yellow;
    }
    return null;
  }),
),
Jupi007 commented 4 months ago

It should be reacting in the same way as previously if you use MaterialStatePropertyAll.