flutter/packages/flutter
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
![Screenshot 2023-09-29 at 16 59 39](https://github.com/flutter/flutter/assets/48603081/4bc32032-cff3-4237-812f-86f17ed95337)

### After

![Screenshot 2023-09-29 at 16 55 24](https://github.com/flutter/flutter/assets/48603081/05a1fc52-fb31-4790-a840-18f2e9718241)
2023-10-12 14:17:56 +00:00
..
lib Fix chip widgets don't the apply provided iconTheme (#135751) 2023-10-12 14:17:56 +00:00
test Fix chip widgets don't the apply provided iconTheme (#135751) 2023-10-12 14:17:56 +00:00
test_fixes Deprecate useMaterial3 parameter in ThemeData.copyWith() (#131455) 2023-07-28 10:31:53 -07:00
test_private Allow latest pkg:material_color_utilities (#132445) 2023-10-11 23:57:16 +00:00
test_profile Fix typos (#121171) 2023-02-23 19:43:21 +00:00
test_release Stand-alone widget tree with multiple render trees to enable multi-view rendering (#125003) 2023-07-17 16:14:08 +00:00
analysis_options.yaml
build.yaml
dart_test.yaml
LICENSE
pubspec.yaml Allow latest pkg:material_color_utilities (#132445) 2023-10-11 23:57:16 +00:00
README.md

Flutter

Flutter is a new way to build high-performance, cross-platform mobile, web, and desktop apps. Flutter is optimized for today's — and tomorrow's — mobile and desktop devices. We are focused on low-latency input and high frame rates on all platforms.

See the getting started guide for information about using Flutter.