refactor(ui): Simplify the server_storage code
parent
ecb050e5aa
commit
1470387933
|
@ -43,8 +43,8 @@ class _ServerStoragePageState extends State<ServerStoragePage> {
|
|||
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,9 +87,12 @@ class ServerStorageSection extends StatelessWidget {
|
|||
Widget build(final BuildContext context) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ServerStorageListItem(
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: ServerStorageListItem(
|
||||
volume: volume,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
...services.map(
|
||||
(final service) => ServerConsumptionListTile(
|
||||
|
@ -104,7 +107,9 @@ class ServerStorageSection extends StatelessWidget {
|
|||
),
|
||||
if (volume.isResizable) ...[
|
||||
const SizedBox(height: 16),
|
||||
BrandOutlinedButton(
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: BrandOutlinedButton(
|
||||
title: 'storage.extend_volume_button.title'.tr(),
|
||||
onPressed: () => context.pushRoute(
|
||||
ExtendingVolumeRoute(
|
||||
|
@ -113,6 +118,7 @@ class ServerStorageSection extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
|
@ -131,14 +137,10 @@ class ServerConsumptionListTile extends StatelessWidget {
|
|||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(final BuildContext context) => Material(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
Widget build(final BuildContext context) => InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||
child: ConsumptionListItem(
|
||||
title: service.displayName,
|
||||
icon: SvgPicture.string(
|
||||
|
@ -151,8 +153,7 @@ class ServerConsumptionListTile extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
rightSideText: service.storageUsage.used.toString(),
|
||||
percentage:
|
||||
service.storageUsage.used.byte / volume.sizeTotal.byte,
|
||||
percentage: service.storageUsage.used.byte / volume.sizeTotal.byte,
|
||||
color: volume.root
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.secondary,
|
||||
|
@ -160,6 +161,5 @@ class ServerConsumptionListTile extends StatelessWidget {
|
|||
dense: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue