Skip to content

Commit c143ca4

Browse files
committed
fix a layout crash on large devices
1 parent eb88e29 commit c143ca4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/common/list_tiles.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,23 @@ Widget settingList(
6262
required List<dynamic> itemList,
6363
required Widget Function(BuildContext, int) itemBuilder,
6464
}) {
65-
double maxWidth = (getDeviceSize(context).width / 2.0) - 12.0;
65+
double maxWidth = getDeviceSize(context).width - 24.0;
66+
if (getDeviceSize(context).isLargeDevice) {
67+
maxWidth /= 2.0;
68+
}
6669

6770
return AnimatedSize(
6871
duration: shortAnimationDuration,
6972
child: ListTile(
7073
title: ConstrainedBox(
71-
constraints: BoxConstraints(maxWidth: maxWidth),
74+
constraints: BoxConstraints(maxWidth: maxWidth * 0.6),
7275
child: Text(
7376
title,
7477
style: textStyleTitle,
7578
),
7679
),
7780
trailing: ConstrainedBox(
78-
constraints: BoxConstraints(maxWidth: maxWidth),
81+
constraints: BoxConstraints(maxWidth: maxWidth * 0.4),
7982
child: settingListTitle(
8083
title: selectedItem,
8184
color: Theme.of(context).textTheme.bodySmall!.color!,

0 commit comments

Comments
 (0)