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-12-20 22:05:29 +00:00
2024-02-13 20:30:53 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-31 16:13:17 +00:00
2024-01-31 16:13:17 +00:00
2023-12-15 14:13:31 -08:00
2024-01-31 16:13:17 +00:00
2023-12-15 14:13:31 -08:00
2024-01-29 22:00:51 +00:00
2024-01-24 16:49:18 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-23 19:24:54 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-24 16:13:26 +00:00
2023-12-15 14:13:31 -08:00
2024-01-24 16:13:26 +00:00
2023-12-15 14:13:31 -08:00
2024-01-19 18:29:07 +00:00
2023-12-15 14:13:31 -08:00
2024-02-01 21:11:26 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-12 10:07:51 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-13 20:30:53 +00:00
2024-02-13 20:30:53 +00:00
2024-02-13 20:30:53 +00:00
2024-01-29 21:21:34 -08:00
2024-02-01 04:59:05 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-16 21:40:08 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-13 00:12:02 +00:00
2024-02-13 00:12:02 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-16 10:08:27 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-07 13:57:21 +00:00
2024-02-13 03:57:15 +00:00
2023-12-15 14:13:31 -08:00
2024-02-07 13:57:21 +00:00
2024-02-12 17:08:20 +00:00
2023-12-15 14:13:31 -08:00
2024-01-22 10:01:05 +00:00
2024-01-22 10:01:05 +00:00
2024-01-22 11:13:31 +00:00
2024-01-22 11:13:31 +00:00
2023-12-15 14:13:31 -08:00
2024-02-12 17:08:20 +00:00
2023-12-15 14:13:31 -08:00
2024-02-13 20:30:53 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-24 16:13:26 +00:00
2023-12-15 14:13:31 -08:00
2024-01-24 16:13:26 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-24 16:13:26 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-07 02:44:21 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-13 20:30:53 +00:00
2023-12-15 14:13:31 -08:00
2024-02-13 08:48:18 +00:00
2024-01-30 22:41:15 +00:00
2023-12-15 14:13:31 -08:00
2024-01-23 17:47:06 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-09-21 10:06:21 -07:00
2023-12-15 14:13:31 -08:00
2024-01-31 09:58:00 -08:00
2023-12-20 22:05:29 +00:00
2023-12-15 14:13:31 -08:00
2023-12-20 22:05:29 +00:00
2023-12-15 14:13:31 -08:00
2024-01-24 19:45:47 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-07 23:14:56 +00:00
2023-12-15 14:13:31 -08:00
2024-02-12 17:08:20 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-20 00:27:18 +00:00
2023-12-15 14:13:31 -08:00
2024-02-08 20:36:24 +00:00
2023-12-15 14:13:31 -08:00
2024-01-09 18:19:07 +00:00
2024-02-12 10:07:51 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-22 18:21:31 +00:00
2023-12-15 14:13:31 -08:00
2024-01-05 21:28:07 +00:00
2023-12-15 14:13:31 -08:00
2024-02-07 10:26:27 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-19 13:01:07 -08:00
2023-12-15 14:13:31 -08:00
2024-01-24 16:13:26 +00:00
2024-01-17 22:49:04 +00:00
2024-01-26 00:20:21 +00:00
2023-12-15 14:13:31 -08:00
2024-01-09 09:49:13 +00:00
2024-01-24 16:13:26 +00:00
2024-01-20 00:27:18 +00:00
2023-12-16 19:23:11 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-12 16:35:08 +00:00
2024-02-12 10:07:51 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-12 22:10:25 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-06 19:01:49 +00:00
2024-02-12 17:08:20 +00:00
2024-02-02 01:48:17 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-13 08:48:18 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-02-07 02:44:21 +00:00
2023-12-15 14:13:31 -08:00
2023-12-20 22:05:29 +00:00
2024-01-20 00:27:18 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-22 10:01:05 +00:00
2023-12-15 14:13:31 -08:00
2024-01-31 17:17:53 +00:00
2024-01-24 16:13:26 +00:00
2023-12-15 14:13:31 -08:00
2023-12-15 14:13:31 -08:00
2024-01-24 16:13:26 +00:00
2024-01-20 00:27:18 +00:00
2023-12-15 14:13:31 -08:00