From ae7a3e45e1c2c0ab086e917c3f8cd3e0920fcefc Mon Sep 17 00:00:00 2001 From: franzap <_@franzap.com> Date: Tue, 16 Dec 2025 11:41:47 -0300 Subject: [PATCH] UI bugfixes --- lib/screens/updates_screen.dart | 16 +++++-- lib/widgets/app_card.dart | 9 ++-- lib/widgets/version_pill_widget.dart | 63 +++++++++++++++------------- 3 files changed, 52 insertions(+), 36 deletions(-) diff --git a/lib/screens/updates_screen.dart b/lib/screens/updates_screen.dart index 5167a13..6239b2a 100644 --- a/lib/screens/updates_screen.dart +++ b/lib/screens/updates_screen.dart @@ -47,6 +47,7 @@ class UpdatesScreen extends HookConsumerWidget { label: 'Updates', count: updatesCount, textStyle: tabLabelStyle, + badgeColor: Colors.red.withValues(alpha: 0.4), ), ), Tab( @@ -54,6 +55,7 @@ class UpdatesScreen extends HookConsumerWidget { label: 'Up to date', count: upToDateCount, textStyle: tabLabelStyle, + badgeColor: Colors.blue.shade700.withValues(alpha: 0.4), ), ), Tab( @@ -61,6 +63,7 @@ class UpdatesScreen extends HookConsumerWidget { label: 'Bookmarks', count: bookmarksCount, textStyle: tabLabelStyle, + badgeColor: Colors.blue.shade700.withValues(alpha: 0.4), ), ), ], @@ -641,11 +644,13 @@ class _TabLabelWithBadge extends StatelessWidget { required this.label, required this.count, this.textStyle, + this.badgeColor, }); final String label; final int count; final TextStyle? textStyle; + final Color? badgeColor; @override Widget build(BuildContext context) { @@ -659,7 +664,11 @@ class _TabLabelWithBadge extends StatelessWidget { children: [ Text(label), if (count > 0) - Positioned(top: -6, right: -18, child: _CountBadge(count: count)), + Positioned( + top: -6, + right: -18, + child: _CountBadge(count: count, color: badgeColor), + ), ], ), ), @@ -668,9 +677,10 @@ class _TabLabelWithBadge extends StatelessWidget { } class _CountBadge extends StatelessWidget { - const _CountBadge({required this.count}); + const _CountBadge({required this.count, this.color}); final int count; + final Color? color; @override Widget build(BuildContext context) { @@ -679,7 +689,7 @@ class _CountBadge extends StatelessWidget { return Container( padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), decoration: BoxDecoration( - color: Colors.red.withValues(alpha: 0.4), + color: color ?? Colors.red.withValues(alpha: 0.4), borderRadius: BorderRadius.circular(9), ), constraints: const BoxConstraints(minWidth: 18, minHeight: 18), diff --git a/lib/widgets/app_card.dart b/lib/widgets/app_card.dart index 4bcc2e2..e44c90d 100644 --- a/lib/widgets/app_card.dart +++ b/lib/widgets/app_card.dart @@ -121,7 +121,6 @@ class AppCard extends HookConsumerWidget { ] else ...[ // Default: name and version in same row Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( child: Text( @@ -135,9 +134,11 @@ class AppCard extends HookConsumerWidget { ), ), const SizedBox(width: 12), - VersionPillWidget( - app: app!, - showUpdateArrow: showUpdateArrow, + Flexible( + child: VersionPillWidget( + app: app!, + showUpdateArrow: showUpdateArrow, + ), ), ], ), diff --git a/lib/widgets/version_pill_widget.dart b/lib/widgets/version_pill_widget.dart index 5c665db..120a447 100644 --- a/lib/widgets/version_pill_widget.dart +++ b/lib/widgets/version_pill_widget.dart @@ -75,14 +75,16 @@ class VersionPillWidget extends HookConsumerWidget { mainAxisSize: MainAxisSize.min, children: [ // Current version pill (muted colors for installed version) - _buildVersionPill( - context, - ref, - installedPackages, - installedVersion, - Theme.of(context).colorScheme.outline.withValues(alpha: 0.3), - Theme.of(context).colorScheme.onSurface, - isInstalledVersion: true, + Flexible( + child: _buildVersionPill( + context, + ref, + installedPackages, + installedVersion, + Theme.of(context).colorScheme.outline.withValues(alpha: 0.3), + Theme.of(context).colorScheme.onSurface, + isInstalledVersion: true, + ), ), // Arrow icon (always arrow, forbidden icon is in the pill itself) @@ -95,18 +97,20 @@ class VersionPillWidget extends HookConsumerWidget { ), ), - _buildVersionPill( - context, - ref, - installedPackages, - availableVersion, - isDowngrade - ? Theme.of(context).colorScheme.outline.withValues(alpha: 0.3) - : AppColors.darkPillBackground, - isDowngrade - ? Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5) - : Colors.white, - isDowngrade: isDowngrade, + Flexible( + child: _buildVersionPill( + context, + ref, + installedPackages, + availableVersion, + isDowngrade + ? Theme.of(context).colorScheme.outline.withValues(alpha: 0.3) + : AppColors.darkPillBackground, + isDowngrade + ? Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.5) + : Colors.white, + isDowngrade: isDowngrade, + ), ), ], ); @@ -168,15 +172,16 @@ class VersionPillWidget extends HookConsumerWidget { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text( - displayVersion, - maxLines: null, - overflow: TextOverflow.visible, - softWrap: true, - style: context.textTheme.labelMedium?.copyWith( - fontWeight: FontWeight.bold, - color: finalTextColor, - fontSize: 11.5, + Flexible( + child: Text( + displayVersion, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: context.textTheme.labelMedium?.copyWith( + fontWeight: FontWeight.bold, + color: finalTextColor, + fontSize: 11.5, + ), ), ), if (statusIcon != null) ...[