Nate Wilson
6ff806d74e
Use .fromMap()
constructors in example code ( #152535 )
...
Currently, there are 21 `.resolveWith()` calls in example files.
This pull request changes 11 of them to use the new `.fromMap()` constructor. (Seven of them are now `const`!)
```dart
ListTile(
iconColor: WidgetStateColor.fromMap(<WidgetStatesConstraint, Color>{
WidgetState.disabled: Colors.red,
WidgetState.selected: Colors.green,
WidgetState.any: Colors.black,
}),
// The same can be achieved using the .resolveWith() constructor.
// The text color will be identical to the icon color above.
textColor: WidgetStateColor.resolveWith((Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) {
return Colors.red;
}
if (states.contains(WidgetState.selected)) {
return Colors.green;
}
return Colors.black;
}),
),
```
2024-08-01 22:28:22 +00:00
..
2023-04-04 20:34:29 +00:00
2023-07-12 20:08:05 +00:00
2022-12-20 16:03:21 -08:00
2023-04-04 20:34:29 +00:00
2023-11-20 15:24:41 -08:00
2024-04-08 18:42:07 +00:00
2024-01-12 22:10:25 +00:00
2024-05-09 16:47:16 +00:00
2023-04-04 20:34:29 +00:00
2024-03-11 23:04:57 +00:00
2023-09-20 19:59:08 +00:00
2024-03-25 08:39:05 +00:00
2023-04-04 20:34:29 +00:00
2024-02-12 17:08:20 +00:00
2023-11-01 23:29:49 +00:00
2024-07-17 19:56:01 +00:00
2024-07-08 19:06:54 +00:00
2023-04-04 20:34:29 +00:00
2024-06-13 19:28:21 +00:00
2024-07-03 17:56:48 +00:00
2024-06-12 05:07:23 +00:00
2023-04-04 20:34:29 +00:00
2024-07-08 19:06:54 +00:00
2024-07-08 19:06:54 +00:00
2023-04-18 23:00:03 +00:00
2023-04-04 20:34:29 +00:00
2023-07-17 18:24:49 +00:00
2023-04-04 20:34:29 +00:00
2024-04-03 16:31:06 +00:00
2023-04-04 20:34:29 +00:00
2024-07-11 20:36:55 +00:00
2023-12-06 16:40:24 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-08-29 17:31:02 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-09-01 00:02:04 +00:00
2024-08-01 22:28:22 +00:00
2024-08-01 22:28:22 +00:00
2024-04-03 02:39:46 +00:00
2024-06-03 17:11:36 +00:00
2024-07-08 19:06:54 +00:00
2023-07-17 18:24:49 +00:00
2023-07-11 09:30:05 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-08-15 00:55:07 +00:00
2023-04-04 20:34:29 +00:00
2023-11-20 15:24:41 -08:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-07-11 20:04:17 +00:00
2024-07-11 20:36:55 +00:00
2024-05-20 08:02:09 +00:00
2023-09-08 09:40:49 +00:00
2024-07-08 19:06:54 +00:00
2024-01-03 21:26:02 +00:00
2024-04-02 21:10:52 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2024-05-23 18:54:11 +00:00
2024-01-12 16:35:08 +00:00
2024-08-01 22:28:22 +00:00
2023-04-04 20:34:29 +00:00
2024-05-20 15:33:16 +00:00
2024-07-26 11:54:28 +00:00
2024-08-01 22:28:22 +00:00
2023-04-04 20:34:29 +00:00
2024-06-18 17:52:21 +00:00
2023-04-04 20:34:29 +00:00
2023-10-26 23:55:38 +00:00
2024-01-26 19:12:24 +00:00
2023-06-02 01:05:31 +00:00
2023-11-03 20:18:36 +00:00