From 456574002b4b9648360c4dbaf9f817457996e18c Mon Sep 17 00:00:00 2001 From: dettlaff Date: Sun, 4 Feb 2024 03:36:10 +0400 Subject: [PATCH] feat: add route to services in storage page --- .../pages/server_storage/server_storage.dart | 46 +++++++++++-------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 2d356e38..7f82a386 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -95,6 +95,11 @@ class ServerStorageSection extends StatelessWidget { (final service) => ServerConsumptionListTile( service: service, volume: volume, + onTap: () { + context.pushRoute( + ServiceRoute(serviceId: service.id), + ); + }, ), ), if (volume.isResizable) ...[ @@ -117,33 +122,38 @@ class ServerConsumptionListTile extends StatelessWidget { const ServerConsumptionListTile({ required this.service, required this.volume, + required this.onTap, super.key, }); final Service service; final DiskVolume volume; + final VoidCallback onTap; @override - Widget build(final BuildContext context) => Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: ConsumptionListItem( - title: service.displayName, - icon: SvgPicture.string( - service.svgIcon, - width: 24.0, - height: 24.0, - colorFilter: ColorFilter.mode( - Theme.of(context).colorScheme.onBackground, - BlendMode.srcIn, + Widget build(BuildContext context) => GestureDetector( + onTap: onTap, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: ConsumptionListItem( + title: service.displayName, + icon: SvgPicture.string( + service.svgIcon, + width: 24.0, + height: 24.0, + colorFilter: ColorFilter.mode( + Theme.of(context).colorScheme.onBackground, + BlendMode.srcIn, + ), ), + rightSideText: service.storageUsage.used.toString(), + percentage: service.storageUsage.used.byte / volume.sizeTotal.byte, + color: volume.root + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.secondary, + backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + dense: true, ), - rightSideText: service.storageUsage.used.toString(), - percentage: service.storageUsage.used.byte / volume.sizeTotal.byte, - color: volume.root - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.secondary, - backgroundColor: Theme.of(context).colorScheme.surfaceVariant, - dense: true, ), ); }