Widget state properties (#142151)
Fixes #138270. Moves the majority of the logic of MaterialStateProperties down to the widgets layer, then has the existing Material classes pull from the widgets versions.
This commit is contained in:
@@ -358,13 +358,13 @@ class _TextButtonExampleState extends State<TextButtonExample> {
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
overlayColor: Colors.transparent,
|
||||
foregroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
|
||||
foregroundBuilder: (BuildContext context, Set<WidgetState> states, Widget? child) {
|
||||
late final ImageProvider image;
|
||||
if (currentAction != null) {
|
||||
image = runningImage;
|
||||
} else if (states.contains(MaterialState.pressed)) {
|
||||
} else if (states.contains(WidgetState.pressed)) {
|
||||
image = pressedImage;
|
||||
} else if (states.contains(MaterialState.hovered)) {
|
||||
} else if (states.contains(WidgetState.hovered)) {
|
||||
image = hoveredImage;
|
||||
} else {
|
||||
image = defaultImage;
|
||||
|
||||
Reference in New Issue
Block a user