Unverified Commit e93297b9 authored by Alex Sandri's avatar Alex Sandri Committed by GitHub

fix overflow error in `CupertinoListTile` (#113010)

parent 300181b3
......@@ -283,6 +283,7 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
final Widget title = DefaultTextStyle(
style: titleTextStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
child: widget.title,
);
......@@ -303,6 +304,7 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
subtitle = DefaultTextStyle(
style: subtitleTextStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
child: widget.subtitle!,
);
}
......@@ -353,7 +355,8 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
SizedBox(width: widget.leadingToTitle),
] else
SizedBox(height: widget.leadingSize),
Column(
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
......@@ -364,7 +367,7 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
],
],
),
const Spacer(),
),
if (additionalInfo != null) ...<Widget>[
additionalInfo,
if (widget.trailing != null)
......
......@@ -519,4 +519,33 @@ void main() {
await tester.pumpAndSettle(const Duration(seconds: 5));
expect(tester.takeException(), null);
});
testWidgets('title does not overflow', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: CupertinoPageScaffold(
child: CupertinoListTile(
title: Text('CupertinoListTile' * 10),
),
),
),
);
expect(tester.takeException(), null);
});
testWidgets('subtitle does not overflow', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: CupertinoPageScaffold(
child: CupertinoListTile(
title: const Text(''),
subtitle: Text('CupertinoListTile' * 10),
),
),
),
);
expect(tester.takeException(), null);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment