From 6c801617314edeba7d3f69fcb28c07781de3d7d0 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Mon, 7 Oct 2024 17:10:28 +0200 Subject: [PATCH] fix: Use `IntrinsicWidth` for rows with space (#1837) Fixed a bug reported on Discord where the length of the text makes the button bar overflow: ![image](https://github.com/user-attachments/assets/c76acfbb-aaff-4065-b91c-249f446096d3) (Image of how the bug looks like, not how it looks like after the fix) --- packages/app_center/lib/manage/manage_page.dart | 1 + .../app_center/lib/manage/manage_snap_tile.dart | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/app_center/lib/manage/manage_page.dart b/packages/app_center/lib/manage/manage_page.dart index 2e36a7a83..0b146204a 100644 --- a/packages/app_center/lib/manage/manage_page.dart +++ b/packages/app_center/lib/manage/manage_page.dart @@ -276,6 +276,7 @@ class ManagePage extends ConsumerWidget { index: index, length: snapListState.snaps.length, ), + hasFixedSize: true, ), ), error: (_, __) => diff --git a/packages/app_center/lib/manage/manage_snap_tile.dart b/packages/app_center/lib/manage/manage_snap_tile.dart index 80a41c722..2ff06bc77 100644 --- a/packages/app_center/lib/manage/manage_snap_tile.dart +++ b/packages/app_center/lib/manage/manage_snap_tile.dart @@ -19,12 +19,14 @@ class ManageSnapTile extends StatelessWidget { required this.snap, this.position = ManageTilePosition.middle, this.showUpdateButton = false, + this.hasFixedSize = false, super.key, }); final Snap snap; final ManageTilePosition position; final bool showUpdateButton; + final bool hasFixedSize; @override Widget build(BuildContext context) { @@ -34,6 +36,10 @@ class ManageSnapTile extends StatelessWidget { ? DateTime.now().difference(snap.installDate!) : null; const radius = Radius.circular(8); + final buttonBar = Align( + alignment: Alignment.centerRight, + child: _ButtonBar(snap, showUpdateButton), + ); return DecoratedBox( decoration: BoxDecoration( @@ -162,13 +168,9 @@ class ManageSnapTile extends StatelessWidget { ), ], ), - trailing: SizedBox( - width: 260, - child: Align( - alignment: Alignment.centerRight, - child: _ButtonBar(snap, showUpdateButton), - ), - ), + trailing: hasFixedSize + ? SizedBox(width: 180, child: buttonBar) + : IntrinsicWidth(child: buttonBar), ), ); }