Taha Tesser
f65dd3bac0
Fix chip widgets don't the apply provided iconTheme (#135751)
fixes [`Chip.iconTheme` does not apply the icon theme](https://github.com/flutter/flutter/issues/111828)
### Description
- Fix chip widgets that don't utilize the provided `iconTheme`.
- Prevent `iconTheme` with just color from overriding the default icon size.
- Add some missing M3 tests for the chip and chip theme properties.
### Code sample
<details>
<summary>expand to view the code sample</summary>
```dart
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(useMaterial3: true),
home: const Example(),
);
}
}
class Example extends StatefulWidget {
const Example({super.key});
@override
State<Example> createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
final bool _isEnable = true;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
RawChip(
iconTheme: const IconThemeData(color: Colors.amber),
avatar: const Icon(Icons.favorite_rounded),
label: const Text('RawChip'),
onPressed: () {},
isEnabled: _isEnable,
),
const Chip(
iconTheme: IconThemeData(color: Colors.amber),
avatar: Icon(Icons.favorite_rounded),
label: Text('Chip'),
// onDeleted: () {},
),
FilterChip(
iconTheme: const IconThemeData(color: Colors.amber),
avatar: const Icon(Icons.favorite_rounded),
label: const Text('FilterChip'),
selected: false,
onSelected: _isEnable ? (bool value) {} : null,
),
InputChip(
iconTheme: const IconThemeData(color: Colors.amber),
avatar: const Icon(Icons.favorite_rounded),
label: const Text('InputChip'),
isEnabled: _isEnable,
onPressed: () {},
),
ActionChip(
iconTheme: const IconThemeData(color: Colors.amber),
avatar: const Icon(Icons.favorite_rounded),
label: const Text('ActionChip'),
onPressed: _isEnable ? () {} : null,
),
ChoiceChip(
iconTheme: const IconThemeData(color: Colors.amber),
avatar: const Icon(Icons.favorite_rounded),
label: const Text('ChoiceChip'),
selected: false,
onSelected: _isEnable ? (bool value) {} : null,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {},
child: const Icon(Icons.add),
),
);
}
}
```
</details>
### Before

### After

2023-10-12 14:17:56 +00:00
..
2023-09-11 09:42:27 -07:00
2023-10-12 14:17:56 +00:00
2023-08-14 10:05:20 -07:00
2023-08-31 10:19:13 -07:00
2023-08-14 10:05:20 -07:00
2023-08-31 10:19:13 -07:00
2023-08-22 15:50:48 +00:00
2023-08-14 10:05:20 -07:00
2023-09-18 20:31:54 -07:00
2023-08-31 10:19:13 -07:00
2023-08-22 15:50:48 +00:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-10-09 06:31:49 +00:00
2023-10-09 06:31:49 +00:00
2023-08-31 10:19:13 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-09-11 09:42:27 -07:00
2023-09-18 13:45:38 -07:00
2023-08-14 10:05:20 -07:00
2023-09-01 08:53:53 -07:00
2023-10-10 18:11:23 -07:00
2023-10-10 18:11:23 -07:00
2023-10-10 18:11:23 -07:00
2023-10-12 14:17:56 +00:00
2023-10-12 14:17:56 +00:00
2023-10-12 14:17:56 +00:00
2023-10-09 10:05:28 +00:00
2023-09-06 11:00:56 -07:00
2023-10-09 10:05:28 +00:00
2023-08-14 10:05:20 -07:00
2023-09-15 08:55:50 -07:00
2023-10-10 08:32:01 -07:00
2023-10-06 11:26:06 +00:00
2023-09-01 08:53:53 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-10-02 11:03:18 +00:00
2023-09-05 13:45:12 -07:00
2023-09-01 08:53:53 -07:00
2023-09-01 08:53:53 -07:00
2023-09-05 13:45:12 -07:00
2023-09-29 18:15:53 +00:00
2023-09-05 13:45:12 -07:00
2023-10-10 10:05:51 -07:00
2023-10-10 10:05:51 -07:00
2023-09-11 09:42:27 -07:00
2023-10-10 10:05:51 -07:00
2023-10-10 10:05:51 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-09-05 13:45:12 -07:00
2023-09-07 21:55:32 +00:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-10-10 18:11:23 -07:00
2023-08-14 10:05:20 -07:00
2023-10-12 14:17:56 +00:00
2023-09-05 13:45:12 -07:00
2023-09-05 13:45:12 -07:00
2023-10-11 07:19:30 +00:00
2023-09-11 09:42:27 -07:00
2023-09-11 09:42:27 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-10-09 09:10:23 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-09-05 13:45:12 -07:00
2023-09-05 13:45:12 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-10-10 18:11:23 -07:00
2023-10-12 14:17:56 +00:00
2023-09-05 13:45:12 -07:00
2023-09-21 17:37:07 +00:00
2023-08-14 10:05:20 -07:00
2023-09-11 09:42:27 -07:00
2023-08-17 23:36:11 +00:00
2023-09-05 13:45:12 -07:00
2023-10-10 18:11:23 -07:00
2023-08-14 10:05:20 -07:00
2023-09-21 10:06:21 -07:00
2023-09-15 12:53:51 -07:00
2023-09-05 13:45:12 -07:00
2023-09-05 13:45:12 -07:00
2023-09-05 13:45:12 -07:00
2023-09-05 13:45:12 -07:00
2023-09-05 13:45:12 -07:00
2023-09-28 18:41:18 +00:00
2023-08-14 10:05:20 -07:00
2023-09-22 08:03:02 +00:00
2023-09-05 13:45:12 -07:00
2023-09-15 15:15:06 +00:00
2023-09-05 13:45:12 -07:00
2023-09-11 09:42:27 -07:00
2023-08-14 10:05:20 -07:00
2023-09-22 15:27:05 -07:00
2023-09-11 09:42:27 -07:00
2023-09-05 13:45:12 -07:00
2023-09-11 09:42:27 -07:00
2023-10-10 10:05:51 -07:00
2023-09-20 19:59:08 +00:00
2023-08-14 10:05:20 -07:00
2023-09-28 18:21:58 +00:00
2023-09-05 13:45:12 -07:00
2023-10-10 18:11:23 -07:00
2023-08-14 10:05:20 -07:00
2023-09-28 16:06:53 +00:00
2023-08-14 10:05:20 -07:00
2023-09-14 18:29:18 +00:00
2023-09-05 13:45:12 -07:00
2023-09-29 17:45:35 -07:00
2023-09-05 13:45:12 -07:00
2023-09-07 17:50:45 -07:00
2023-08-31 08:52:06 -07:00
2023-10-12 00:55:38 +00:00
2023-09-11 09:42:27 -07:00
2023-09-07 11:13:55 -07:00
2023-08-14 10:05:20 -07:00
2023-09-11 09:42:27 -07:00
2023-09-11 09:42:27 -07:00
2023-09-28 01:42:16 +00:00
2023-09-05 13:45:12 -07:00
2023-10-10 18:11:23 -07:00
2023-10-12 01:17:07 +00:00
2023-09-05 13:45:12 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-09-05 13:41:10 -07:00
2023-09-05 13:41:10 -07:00
2023-09-11 09:42:27 -07:00
2023-08-14 10:05:20 -07:00
2023-10-10 10:05:51 -07:00
2023-09-22 15:27:05 -07:00
2023-09-07 17:50:45 -07:00
2023-10-10 18:11:23 -07:00
2023-09-11 09:42:27 -07:00
2023-08-14 10:05:20 -07:00
2023-09-05 13:45:12 -07:00
2023-09-05 13:45:12 -07:00
2023-09-11 09:42:27 -07:00
2023-09-05 13:45:12 -07:00
2023-10-10 10:05:51 -07:00
2023-09-11 09:42:27 -07:00
2023-10-10 10:05:51 -07:00
2023-09-05 13:45:12 -07:00
2023-09-05 13:45:12 -07:00
2023-09-11 09:42:27 -07:00
2023-08-28 22:27:39 +00:00
2023-08-25 15:13:42 -05:00
2023-09-05 13:45:12 -07:00
2023-09-11 09:42:27 -07:00
2023-10-10 11:05:26 -07:00
2023-09-05 13:45:12 -07:00
2023-09-11 09:42:27 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-10-10 18:11:23 -07:00
2023-10-06 22:12:20 +00:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-08-14 10:05:20 -07:00
2023-10-10 18:11:23 -07:00
2023-09-05 13:45:12 -07:00