refactor(ui): Simplify the server_storage code
parent
ecb050e5aa
commit
1470387933
|
@ -43,8 +43,8 @@ class _ServerStoragePageState extends State<ServerStoragePage> {
|
||||||
return BrandHeroScreen(
|
return BrandHeroScreen(
|
||||||
hasBackButton: true,
|
hasBackButton: true,
|
||||||
heroTitle: 'storage.card_title'.tr(),
|
heroTitle: 'storage.card_title'.tr(),
|
||||||
|
bodyPadding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||||
children: [
|
children: [
|
||||||
// ...sections,
|
|
||||||
...widget.diskStatus.diskVolumes.map(
|
...widget.diskStatus.diskVolumes.map(
|
||||||
(final volume) => Column(
|
(final volume) => Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
@ -87,8 +87,11 @@ class ServerStorageSection extends StatelessWidget {
|
||||||
Widget build(final BuildContext context) => Column(
|
Widget build(final BuildContext context) => Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
ServerStorageListItem(
|
Padding(
|
||||||
volume: volume,
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
child: ServerStorageListItem(
|
||||||
|
volume: volume,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
...services.map(
|
...services.map(
|
||||||
|
@ -104,12 +107,15 @@ class ServerStorageSection extends StatelessWidget {
|
||||||
),
|
),
|
||||||
if (volume.isResizable) ...[
|
if (volume.isResizable) ...[
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
BrandOutlinedButton(
|
Padding(
|
||||||
title: 'storage.extend_volume_button.title'.tr(),
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
onPressed: () => context.pushRoute(
|
child: BrandOutlinedButton(
|
||||||
ExtendingVolumeRoute(
|
title: 'storage.extend_volume_button.title'.tr(),
|
||||||
diskVolumeToResize: volume,
|
onPressed: () => context.pushRoute(
|
||||||
diskStatus: diskStatus,
|
ExtendingVolumeRoute(
|
||||||
|
diskVolumeToResize: volume,
|
||||||
|
diskStatus: diskStatus,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -131,34 +137,28 @@ class ServerConsumptionListTile extends StatelessWidget {
|
||||||
final VoidCallback onTap;
|
final VoidCallback onTap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => Material(
|
Widget build(final BuildContext context) => InkWell(
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
onTap: onTap,
|
||||||
color: Colors.transparent,
|
child: Padding(
|
||||||
child: InkWell(
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
onTap: onTap,
|
child: ConsumptionListItem(
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
title: service.displayName,
|
||||||
child: Padding(
|
icon: SvgPicture.string(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
service.svgIcon,
|
||||||
child: ConsumptionListItem(
|
width: 22.0,
|
||||||
title: service.displayName,
|
height: 24.0,
|
||||||
icon: SvgPicture.string(
|
colorFilter: ColorFilter.mode(
|
||||||
service.svgIcon,
|
Theme.of(context).colorScheme.onBackground,
|
||||||
width: 22.0,
|
BlendMode.srcIn,
|
||||||
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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue