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> { ...@@ -283,6 +283,7 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
final Widget title = DefaultTextStyle( final Widget title = DefaultTextStyle(
style: titleTextStyle, style: titleTextStyle,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis,
child: widget.title, child: widget.title,
); );
...@@ -303,6 +304,7 @@ class _CupertinoListTileState extends State<CupertinoListTile> { ...@@ -303,6 +304,7 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
subtitle = DefaultTextStyle( subtitle = DefaultTextStyle(
style: subtitleTextStyle, style: subtitleTextStyle,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis,
child: widget.subtitle!, child: widget.subtitle!,
); );
} }
...@@ -353,7 +355,8 @@ class _CupertinoListTileState extends State<CupertinoListTile> { ...@@ -353,7 +355,8 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
SizedBox(width: widget.leadingToTitle), SizedBox(width: widget.leadingToTitle),
] else ] else
SizedBox(height: widget.leadingSize), SizedBox(height: widget.leadingSize),
Column( Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
...@@ -364,7 +367,7 @@ class _CupertinoListTileState extends State<CupertinoListTile> { ...@@ -364,7 +367,7 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
], ],
], ],
), ),
const Spacer(), ),
if (additionalInfo != null) ...<Widget>[ if (additionalInfo != null) ...<Widget>[
additionalInfo, additionalInfo,
if (widget.trailing != null) if (widget.trailing != null)
......
...@@ -519,4 +519,33 @@ void main() { ...@@ -519,4 +519,33 @@ void main() {
await tester.pumpAndSettle(const Duration(seconds: 5)); await tester.pumpAndSettle(const Duration(seconds: 5));
expect(tester.takeException(), null); 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