From 456574002b4b9648360c4dbaf9f817457996e18c Mon Sep 17 00:00:00 2001 From: dettlaff Date: Sun, 4 Feb 2024 03:36:10 +0400 Subject: [PATCH 1/6] 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, ), ); } -- 2.42.0 From 02c8da6ea143570f113c435476e473c8dfed428f Mon Sep 17 00:00:00 2001 From: dettlaff Date: Mon, 5 Feb 2024 04:01:54 +0400 Subject: [PATCH 2/6] fix: from review --- lib/ui/pages/server_storage/server_storage.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 7f82a386..c00307ef 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -131,7 +131,7 @@ class ServerConsumptionListTile extends StatelessWidget { final VoidCallback onTap; @override - Widget build(BuildContext context) => GestureDetector( + Widget build(BuildContext context) => InkWell( onTap: onTap, child: Padding( padding: const EdgeInsets.symmetric(vertical: 8), -- 2.42.0 From d76dfe729a85fd5e2bcccf17fc1b812fcb3f9bc7 Mon Sep 17 00:00:00 2001 From: dettlaff Date: Mon, 5 Feb 2024 04:03:01 +0400 Subject: [PATCH 3/6] fix: add finel to BuildContext --- lib/ui/pages/server_storage/server_storage.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index c00307ef..691ddf3f 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -131,7 +131,7 @@ class ServerConsumptionListTile extends StatelessWidget { final VoidCallback onTap; @override - Widget build(BuildContext context) => InkWell( + Widget build(final BuildContext context) => InkWell( onTap: onTap, child: Padding( padding: const EdgeInsets.symmetric(vertical: 8), -- 2.42.0 From fdc2db77821c3b77d013a9a645452d516b0bb72d Mon Sep 17 00:00:00 2001 From: dettlaff Date: Sat, 10 Feb 2024 02:56:55 +0400 Subject: [PATCH 4/6] fix: add borderRadius to InkWell --- .../pages/server_storage/server_storage.dart | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 691ddf3f..0a62fe62 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -131,28 +131,34 @@ class ServerConsumptionListTile extends StatelessWidget { final VoidCallback onTap; @override - Widget build(final BuildContext context) => InkWell( - 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, + Widget build(final BuildContext context) => Material( + borderRadius: BorderRadius.circular(8.0), + color: Colors.transparent, + child: InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(8.0), + 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, ), ), ); -- 2.42.0 From ecb050e5aa107a4059c81eff4a28a931fbe91dd2 Mon Sep 17 00:00:00 2001 From: dettlaff Date: Fri, 1 Mar 2024 17:15:58 +0400 Subject: [PATCH 5/6] fix: padding: const EdgeInsets.symmetric --- lib/ui/pages/server_storage/server_storage.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 0a62fe62..0906de74 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -138,12 +138,12 @@ class ServerConsumptionListTile extends StatelessWidget { onTap: onTap, borderRadius: BorderRadius.circular(8.0), child: Padding( - padding: const EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), child: ConsumptionListItem( title: service.displayName, icon: SvgPicture.string( service.svgIcon, - width: 24.0, + width: 22.0, height: 24.0, colorFilter: ColorFilter.mode( Theme.of(context).colorScheme.onBackground, -- 2.42.0 From 147038793354f661ea72a72440a203b52885b467 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Thu, 11 Apr 2024 13:03:21 +0300 Subject: [PATCH 6/6] refactor(ui): Simplify the server_storage code --- .../pages/server_storage/server_storage.dart | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 0906de74..5f7f01bc 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -43,8 +43,8 @@ class _ServerStoragePageState extends State { return BrandHeroScreen( hasBackButton: true, heroTitle: 'storage.card_title'.tr(), + bodyPadding: const EdgeInsets.symmetric(vertical: 16.0), children: [ - // ...sections, ...widget.diskStatus.diskVolumes.map( (final volume) => Column( mainAxisSize: MainAxisSize.min, @@ -87,8 +87,11 @@ class ServerStorageSection extends StatelessWidget { Widget build(final BuildContext context) => Column( mainAxisSize: MainAxisSize.min, children: [ - ServerStorageListItem( - volume: volume, + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: ServerStorageListItem( + volume: volume, + ), ), const SizedBox(height: 16), ...services.map( @@ -104,12 +107,15 @@ class ServerStorageSection extends StatelessWidget { ), if (volume.isResizable) ...[ const SizedBox(height: 16), - BrandOutlinedButton( - title: 'storage.extend_volume_button.title'.tr(), - onPressed: () => context.pushRoute( - ExtendingVolumeRoute( - diskVolumeToResize: volume, - diskStatus: diskStatus, + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: BrandOutlinedButton( + title: 'storage.extend_volume_button.title'.tr(), + onPressed: () => context.pushRoute( + ExtendingVolumeRoute( + diskVolumeToResize: volume, + diskStatus: diskStatus, + ), ), ), ), @@ -131,34 +137,28 @@ class ServerConsumptionListTile extends StatelessWidget { final VoidCallback onTap; @override - Widget build(final BuildContext context) => Material( - borderRadius: BorderRadius.circular(8.0), - color: Colors.transparent, - child: InkWell( - onTap: onTap, - borderRadius: BorderRadius.circular(8.0), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), - child: ConsumptionListItem( - title: service.displayName, - icon: SvgPicture.string( - service.svgIcon, - width: 22.0, - height: 24.0, - colorFilter: ColorFilter.mode( - Theme.of(context).colorScheme.onBackground, - BlendMode.srcIn, - ), + Widget build(final BuildContext context) => InkWell( + onTap: onTap, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), + child: ConsumptionListItem( + title: service.displayName, + icon: SvgPicture.string( + service.svgIcon, + width: 22.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, ), ), ); -- 2.42.0