refactor: service_page build cleanup
parent
9050677ab2
commit
b750d603b5
|
@ -170,83 +170,54 @@ class ServiceStatusCard extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) {
|
Widget build(final BuildContext context) {
|
||||||
|
late IconData icon;
|
||||||
|
late String buttonTitle;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case ServiceStatus.active:
|
case ServiceStatus.active:
|
||||||
return FilledCard(
|
icon = Icons.check_circle_outline;
|
||||||
child: ListTile(
|
buttonTitle = 'service_page.status.active';
|
||||||
leading: const Icon(
|
break;
|
||||||
Icons.check_circle_outline,
|
|
||||||
size: 24,
|
|
||||||
),
|
|
||||||
title: Text('service_page.status.active'.tr()),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case ServiceStatus.inactive:
|
case ServiceStatus.inactive:
|
||||||
return FilledCard(
|
icon = Icons.stop_circle_outlined;
|
||||||
tertiary: true,
|
buttonTitle = 'service_page.status.inactive';
|
||||||
child: ListTile(
|
break;
|
||||||
leading: const Icon(
|
|
||||||
Icons.stop_circle_outlined,
|
|
||||||
size: 24,
|
|
||||||
),
|
|
||||||
title: Text('service_page.status.inactive'.tr()),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case ServiceStatus.failed:
|
case ServiceStatus.failed:
|
||||||
return FilledCard(
|
icon = Icons.error_outline;
|
||||||
error: true,
|
buttonTitle = 'service_page.status.failed';
|
||||||
child: ListTile(
|
break;
|
||||||
leading: const Icon(
|
|
||||||
Icons.error_outline,
|
|
||||||
size: 24,
|
|
||||||
),
|
|
||||||
title: Text('service_page.status.failed'.tr()),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case ServiceStatus.off:
|
case ServiceStatus.off:
|
||||||
return FilledCard(
|
icon = Icons.power_settings_new;
|
||||||
tertiary: true,
|
buttonTitle = 'service_page.status.off';
|
||||||
child: ListTile(
|
break;
|
||||||
leading: const Icon(
|
|
||||||
Icons.power_settings_new,
|
|
||||||
size: 24,
|
|
||||||
),
|
|
||||||
title: Text('service_page.status.off'.tr()),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case ServiceStatus.activating:
|
case ServiceStatus.activating:
|
||||||
return FilledCard(
|
icon = Icons.restart_alt_outlined;
|
||||||
tertiary: true,
|
buttonTitle = 'service_page.status.activating';
|
||||||
child: ListTile(
|
break;
|
||||||
leading: const Icon(
|
|
||||||
Icons.restart_alt_outlined,
|
|
||||||
size: 24,
|
|
||||||
),
|
|
||||||
title: Text('service_page.status.activating'.tr()),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case ServiceStatus.deactivating:
|
case ServiceStatus.deactivating:
|
||||||
return FilledCard(
|
icon = Icons.restart_alt_outlined;
|
||||||
tertiary: true,
|
buttonTitle = 'service_page.status.deactivating';
|
||||||
child: ListTile(
|
break;
|
||||||
leading: const Icon(
|
|
||||||
Icons.restart_alt_outlined,
|
|
||||||
size: 24,
|
|
||||||
),
|
|
||||||
title: Text('service_page.status.deactivating'.tr()),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case ServiceStatus.reloading:
|
case ServiceStatus.reloading:
|
||||||
return FilledCard(
|
icon = Icons.restart_alt_outlined;
|
||||||
tertiary: true,
|
buttonTitle = 'service_page.status.reloading';
|
||||||
child: ListTile(
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.restart_alt_outlined,
|
|
||||||
size: 24,
|
|
||||||
),
|
|
||||||
title: Text('service_page.status.reloading'.tr()),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FilledCard(
|
||||||
|
tertiary: true,
|
||||||
|
child: ListTile(
|
||||||
|
leading: Icon(
|
||||||
|
icon,
|
||||||
|
size: 24,
|
||||||
|
),
|
||||||
|
title: Text(buttonTitle.tr()),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue