Taha Tesser
ccf42dde88
Introduce avatarBoxConstraints
& deleteIconBoxConstraints
for the chips (#143302)
fixes [Chip widget's avatar padding changing if label text is more than 1 line](https://github.com/flutter/flutter/issues/136892)
### Code sample
<details>
<summary>expand to view the code sample</summary>
```dart
import 'package:flutter/material.dart';
List<String> strings = [
'hello good morning',
'hello good morning hello good morning',
'hello good morning hello good morning hello good morning'
];
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text(
'avatarBoxConstraints: null \ndeleteIconBoxConstraints: null',
textAlign: TextAlign.center),
for (String string in strings)
Padding(
padding: const EdgeInsets.all(8.0),
child: RawChip(
label: Container(
width: 150,
color: Colors.amber,
child: Text(
string,
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
),
avatar: const Icon(Icons.settings),
onDeleted: () {},
),
),
],
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text(
'avatarBoxConstraints: BoxConstraints.tightForFinite() \ndeleteIconBoxConstraints: BoxConstraints.tightForFinite()',
textAlign: TextAlign.center),
for (String string in strings)
Padding(
padding: const EdgeInsets.all(8.0),
child: RawChip(
avatarBoxConstraints:
const BoxConstraints.tightForFinite(),
deleteIconBoxConstraints:
const BoxConstraints.tightForFinite(),
label: Container(
width: 150,
color: Colors.amber,
child: Text(
string,
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
),
avatar: const Icon(Icons.settings),
onDeleted: () {},
),
),
],
),
],
),
),
),
);
}
}
```
</details>
### Preview

# Example previews


2024-02-13 20:30:53 +00:00
..
2023-04-04 20:34:29 +00:00
2023-07-12 20:08:05 +00:00
2022-12-20 16:03:21 -08:00
2023-04-04 20:34:29 +00:00
2023-11-20 15:24:41 -08:00
2023-07-17 17:56:07 +00:00
2024-01-12 22:10:25 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-09-20 19:59:08 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2024-02-12 17:08:20 +00:00
2023-11-01 23:29:49 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2024-02-13 20:30:53 +00:00
2023-04-04 20:34:29 +00:00
2023-12-11 22:56:04 +00:00
2023-04-04 20:34:29 +00:00
2023-09-11 18:55:53 -05:00
2023-04-04 20:34:29 +00:00
2023-04-18 23:00:03 +00:00
2023-04-04 20:34:29 +00:00
2023-07-17 18:24:49 +00:00
2023-04-04 20:34:29 +00:00
2023-09-18 08:33:14 +00:00
2023-04-04 20:34:29 +00:00
2023-08-21 20:13:22 +00:00
2023-12-06 16:40:24 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-08-29 17:31:02 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-09-01 00:02:04 +00:00
2023-06-01 15:22:03 -07:00
2023-06-29 06:29:03 +00:00
2023-04-04 20:34:29 +00:00
2023-10-18 20:13:08 +00:00
2023-11-03 22:25:37 +00:00
2023-07-17 18:24:49 +00:00
2023-07-11 09:30:05 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-08-15 00:55:07 +00:00
2023-04-04 20:34:29 +00:00
2023-11-20 15:24:41 -08:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-07-11 20:04:17 +00:00
2023-05-05 16:39:11 +00:00
2024-02-07 10:26:27 +00:00
2023-09-08 09:40:49 +00:00
2023-07-12 20:08:05 +00:00
2024-01-03 21:26:02 +00:00
2023-12-11 21:32:55 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-07-12 20:08:05 +00:00
2024-01-12 16:35:08 +00:00
2023-11-07 10:26:23 -08:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2024-02-02 01:48:17 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-04-04 20:34:29 +00:00
2023-10-26 23:55:38 +00:00
2024-01-26 19:12:24 +00:00
2023-06-02 01:05:31 +00:00
2023-11-03 20:18:36 +00:00