Skip to content

Commit

Permalink
feat: Removed ButtonState, ButtonStates and their related classes. (
Browse files Browse the repository at this point in the history
Fixes #1075)
  • Loading branch information
bdlukaa committed Jun 23, 2024
1 parent 64fedd0 commit 590611c
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,55 @@
* feat: Add `NumberBox.textInputAction` and `NumberBox.onEditingComplete` ([#1063](https://github.com/bdlukaa/fluent_ui/pull/1063))
* feat: Add `Tab.color`, `Tab.selectedColor` and `Tab.outlineColor` to TabView ([#1068](https://github.com/bdlukaa/fluent_ui/pull/1068))
* feat: Added `NavigationView.onItemPressed` callback, called when the item is on tap ([#1067](https://github.com/bdlukaa/fluent_ui/pull/1067))
* **BREAKING** feat: Removed `ButtonState`, `ButtonStates` and their related classes. Use `WidgetStateProperty`, `WidgetState` instead.
Before:

```dart
Button(
style: ButtonStyle(
shape: ButtonState.all(RoundedRectangleBorder(...)),
backgroundColor: ButtonState.resolveWith((states) {
if (states.isPressed) {
return Colors.blue.shade900;
}
return Colors.blue;
}),
foregroundColor: ButtonState.resolveWith((states) {
return ButtonState.forStates<Color>(
states,
disabled: Colors.grey,
hovered: Colors.white.withOpacity(0.8),
pressed: Colors.white.withOpacity(0.6),
);
}),
),
),
```

After:

```dart
Button(
style: ButtonStyle(
shape: WidgetStatePropertyAll(RoundedRectangleBorder(...)),
backgroundColor: WidgetStateProperty.resolveWith((states) {
if (states.isPressed) {
return Colors.blue.shade900;
}
return Colors.blue;
}),
foregroundColor: WidgetStateProperty.resolveWith((states) {
return WidgetStateExtension.forStates<Color>(
states,
disabled: Colors.grey,
hovered: Colors.white.withOpacity(0.8),
pressed: Colors.white.withOpacity(0.6),
);
}),
),
),
```

## 4.8.7

Expand Down

0 comments on commit 590611c

Please sign in to comment.