From 73daf028bb5254cf16d654a87330369a9603a781 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Mon, 7 Oct 2024 10:38:36 +0200 Subject: [PATCH] fix: Accommodate long switch channel buttons texts (#1828) ![Screenshot from 2024-10-03 14-02-08](https://github.com/user-attachments/assets/d8ad0486-359b-4ef8-8901-f4b3ac26b0af) ![Screenshot from 2024-10-03 14-02-18](https://github.com/user-attachments/assets/daa0b66e-36d7-4626-ad5c-49ac0d7a94be) Instead of putting using the overflow bar we'll make the switch button flexible so that it can shrink when it needs to (and be larger when the text is long). Fixes: #1513 --- packages/app_center/lib/snapd/snap_page.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/app_center/lib/snapd/snap_page.dart b/packages/app_center/lib/snapd/snap_page.dart index 478451614..9e5a5c992 100644 --- a/packages/app_center/lib/snapd/snap_page.dart +++ b/packages/app_center/lib/snapd/snap_page.dart @@ -28,7 +28,6 @@ import 'package:ubuntu_widgets/ubuntu_widgets.dart'; import 'package:url_launcher/url_launcher_string.dart'; import 'package:yaru/yaru.dart'; -const _kPrimaryButtonMaxWidth = 136.0; const _kChannelDropdownWidth = 220.0; typedef SnapInfo = ({Widget label, Widget value}); @@ -337,11 +336,13 @@ class _SnapActionButtons extends ConsumerWidget { } final hasActiveChange = snapData.activeChangeId != null; - final primaryActionButton = SizedBox( - width: _kPrimaryButtonMaxWidth, + final primaryActionButton = Flexible( child: PushButton.elevated( onPressed: primaryAction.callback(snapData, snapModel, snapLauncher), - child: Text(primaryAction.label(l10n)), + child: Text( + primaryAction.label(l10n), + overflow: TextOverflow.ellipsis, + ), ), ); @@ -400,8 +401,8 @@ class _SnapActionButtons extends ConsumerWidget { snapName: snapModel.snapName, activeChangeId: snapData.activeChangeId!, ) - : OverflowBar( - overflowSpacing: 8, + : Row( + mainAxisSize: MainAxisSize.min, children: [ primaryActionButton, if (snapData.isInstalled && snapData.activeChangeId == null)