flutter/examples/api/lib
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
..
animation Implement new AnimationStatus getters (#148570) 2024-05-20 17:43:03 +00:00
cupertino Add example for CupertinoCheckbox (#151779) 2024-07-16 16:54:02 +00:00
gestures Add an example for TapAndPanGestureRecognizer (#131873) 2023-08-09 19:59:03 +00:00
material Use .fromMap() constructors in example code (#152535) 2024-08-01 22:28:22 +00:00
painting Factor out deprecated names in example code (#151374) 2024-07-08 19:06:54 +00:00
rendering Factor out deprecated names in example code (#151374) 2024-07-08 19:06:54 +00:00
sample_templates Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
services Change some usage of RawKeyEvent to KeyEvent in preparation for deprecation (#136420) 2023-10-14 00:25:18 +00:00
ui/text docimports for API samples (#151606) 2024-07-11 20:36:55 +00:00
widgets Use .fromMap() constructors in example code (#152535) 2024-08-01 22:28:22 +00:00