Skip to content

Commit

Permalink
fix: Use IntrinsicWidth for rows with space (#1837)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
spydon authored Oct 7, 2024
1 parent eaf0192 commit 6c80161
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/app_center/lib/manage/manage_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class ManagePage extends ConsumerWidget {
index: index,
length: snapListState.snaps.length,
),
hasFixedSize: true,
),
),
error: (_, __) =>
Expand Down
16 changes: 9 additions & 7 deletions packages/app_center/lib/manage/manage_snap_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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(
Expand Down Expand Up @@ -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),
),
);
}
Expand Down

0 comments on commit 6c80161

Please sign in to comment.