• Taha Tesser's avatar
    Fix chips `onDeleted` callback don't show the delete button when disabled (#137685) · 4648f544
    Taha Tesser authored
    fixes [Chips with `onDeleted` callback should show the delete button in the `disabled` state](https://github.com/flutter/flutter/issues/136638)
    
    ### 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 const MaterialApp(
          debugShowCheckedModeBanner: false,
          home: Example(),
        );
      }
    }
    
    class Example extends StatefulWidget {
      const Example({super.key});
    
      @override
      State<Example> createState() => _ExampleState();
    }
    
    class _ExampleState extends State<Example> {
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                RawChip(
                  avatar: const Icon(Icons.favorite_rounded),
                  label: const Text('RawChip'),
                  onSelected: null,
                  isEnabled: false,
                  onDeleted: () {},
                ),
                InputChip(
                  avatar: const Icon(Icons.favorite_rounded),
                  label: const Text('InputChip'),
                  isEnabled: false,
                  onPressed: null,
                  onDeleted: () {},
                ),
                FilterChip(
                  avatar: const Icon(Icons.favorite_rounded),
                  label: const Text('FilterChip'),
                  onSelected: null,
                  onDeleted: () {},
                ),
              ],
            ),
          ),
        );
      }
    }
    ```
    
    </details>
    
    | Before | After |
    | --------------- | --------------- |
    | <img src="https://github.com/flutter/flutter/assets/48603081/8bd458de-cfd2-44f0-a0dd-a8298938c61f" /> | <img src="https://github.com/flutter/flutter/assets/48603081/afca0684-b061-416b-b029-5316588c6888" /> |
    4648f544
Name
Last commit
Last update
.github Loading commit data...
.vscode Loading commit data...
bin Loading commit data...
dev Loading commit data...
examples Loading commit data...
packages Loading commit data...
.ci.yaml Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CODEOWNERS Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
PATENT_GRANT Loading commit data...
README.md Loading commit data...
TESTOWNERS Loading commit data...
analysis_options.yaml Loading commit data...
dartdoc_options.yaml Loading commit data...
flutter_console.bat Loading commit data...