Commit 788614d
authored
Fix "Delete" tooltip is shown disabled on chips with
fixes [Disabled chips with `onDeleted` callback shows "Delete" tooltip on hover](flutter/flutter#141336)
### 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> {
bool _isEnable = false;
@OverRide
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
RawChip(
label: const Text('RawChip'),
onPressed: () {},
isEnabled: _isEnable,
onDeleted: () {},
),
FilterChip(
label: const Text('FilterChip'),
selected: false,
onSelected: _isEnable ? (bool value) {} : null,
onDeleted: () {},
),
InputChip(
label: const Text('InputChip'),
isEnabled: _isEnable,
onDeleted: () {},
),
],
),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
setState(() {
_isEnable = !_isEnable;
});
},
label: Text(_isEnable ? 'Disable' : 'Enable'),
),
);
}
}
```
</details>
### Preview
| Before | After |
| --------------- | --------------- |
| <img src="https://github.com/flutter/flutter/assets/48603081/f80ae5f7-0a6d-4041-ade3-cbc2b5c78188" height="450" /> | <img src="https://github.com/flutter/flutter/assets/48603081/04e62854-e3f1-4b65-9753-183d288f3cfe" height="450" /> |onDeleted callback (#141770)1 parent 6f7aed5 commit 788614d
4 files changed
Lines changed: 114 additions & 4 deletions
File tree
- packages/flutter
- lib/src/material
- test/material
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
283 | 285 | | |
284 | 286 | | |
285 | 287 | | |
| |||
1128 | 1130 | | |
1129 | 1131 | | |
1130 | 1132 | | |
1131 | | - | |
| 1133 | + | |
1132 | 1134 | | |
1133 | 1135 | | |
1134 | 1136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5112 | 5112 | | |
5113 | 5113 | | |
5114 | 5114 | | |
5115 | | - | |
| 5115 | + | |
5116 | 5116 | | |
5117 | 5117 | | |
5118 | 5118 | | |
| |||
5127 | 5127 | | |
5128 | 5128 | | |
5129 | 5129 | | |
| 5130 | + | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
| 5146 | + | |
| 5147 | + | |
| 5148 | + | |
| 5149 | + | |
| 5150 | + | |
| 5151 | + | |
| 5152 | + | |
| 5153 | + | |
| 5154 | + | |
| 5155 | + | |
| 5156 | + | |
| 5157 | + | |
| 5158 | + | |
| 5159 | + | |
5130 | 5160 | | |
5131 | 5161 | | |
5132 | 5162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
| |||
1040 | 1049 | | |
1041 | 1050 | | |
1042 | 1051 | | |
1043 | | - | |
| 1052 | + | |
1044 | 1053 | | |
1045 | 1054 | | |
1046 | 1055 | | |
| |||
1054 | 1063 | | |
1055 | 1064 | | |
1056 | 1065 | | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
1057 | 1096 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
116 | 125 | | |
117 | 126 | | |
118 | 127 | | |
| |||
417 | 426 | | |
418 | 427 | | |
419 | 428 | | |
420 | | - | |
| 429 | + | |
421 | 430 | | |
422 | 431 | | |
423 | 432 | | |
| |||
431 | 440 | | |
432 | 441 | | |
433 | 442 | | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
434 | 473 | | |
0 commit comments