From 24f2844125e35e20cc7cbe206f6e505b45fa3feb Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sun, 15 Dec 2024 20:04:35 +0300 Subject: [PATCH] refactor(ui): Refactor server screens --- lib/ui/atoms/chart_elements/legend.dart | 2 +- lib/ui/molecules/cards/service_status.dart | 65 +++++++++++++++++ lib/ui/molecules/cards/storage_card.dart | 2 +- lib/ui/molecules/charts/disk_charts.dart | 2 +- .../molecules/list_items/user_list_item.dart | 1 - .../charts/server_charts.dart} | 25 ++++++- .../logs_screen.dart => server/logs.dart} | 8 +-- .../memory_usage_by_service.dart} | 4 +- .../select_timezone.dart} | 11 +-- .../server_details.dart} | 31 +++----- .../server_settings.dart | 41 +++++++++-- .../server_settings_screen.dart | 35 ---------- .../pages/server_storage/server_storage.dart | 61 ++++++++++------ lib/ui/pages/services/service.dart | 63 +---------------- lib/ui/router/router.dart | 9 +-- lib/ui/router/router.gr.dart | 70 ++++++++----------- pubspec.lock | 4 +- 17 files changed, 225 insertions(+), 209 deletions(-) create mode 100644 lib/ui/molecules/cards/service_status.dart rename lib/ui/{pages/server_details/charts/chart.dart => organisms/charts/server_charts.dart} (82%) rename lib/ui/pages/{server_details/logs/logs_screen.dart => server/logs.dart} (98%) rename lib/ui/pages/{server_details/memory_usage_by_service_screen.dart => server/memory_usage_by_service.dart} (98%) rename lib/ui/pages/{server_details/time_zone/time_zone.dart => server/select_timezone.dart} (93%) rename lib/ui/pages/{server_details/server_details_screen.dart => server/server_details.dart} (68%) rename lib/ui/pages/{server_details => server}/server_settings.dart (81%) delete mode 100644 lib/ui/pages/server_details/server_settings_screen.dart diff --git a/lib/ui/atoms/chart_elements/legend.dart b/lib/ui/atoms/chart_elements/legend.dart index 891535ff..5c07d5c7 100644 --- a/lib/ui/atoms/chart_elements/legend.dart +++ b/lib/ui/atoms/chart_elements/legend.dart @@ -16,7 +16,7 @@ class Legend extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ ColoredCircle(color: color), - const SizedBox(width: 5), + const SizedBox(width: 4), Text( text, style: Theme.of(context).textTheme.labelSmall, diff --git a/lib/ui/molecules/cards/service_status.dart b/lib/ui/molecules/cards/service_status.dart new file mode 100644 index 00000000..508b4026 --- /dev/null +++ b/lib/ui/molecules/cards/service_status.dart @@ -0,0 +1,65 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/models/service.dart'; +import 'package:selfprivacy/ui/atoms/cards/filled_card.dart'; + +class ServiceStatusCard extends StatelessWidget { + const ServiceStatusCard({ + required this.status, + super.key, + }); + final ServiceStatus status; + + @override + Widget build(final BuildContext context) { + late IconData icon; + late String buttonTitle; + + switch (status) { + case ServiceStatus.active: + icon = Icons.check_circle_outline; + buttonTitle = 'service_page.status.active'; + break; + + case ServiceStatus.inactive: + icon = Icons.stop_circle_outlined; + buttonTitle = 'service_page.status.inactive'; + break; + + case ServiceStatus.failed: + icon = Icons.error_outline; + buttonTitle = 'service_page.status.failed'; + break; + + case ServiceStatus.off: + icon = Icons.power_settings_new; + buttonTitle = 'service_page.status.off'; + break; + + case ServiceStatus.activating: + icon = Icons.restart_alt_outlined; + buttonTitle = 'service_page.status.activating'; + break; + + case ServiceStatus.deactivating: + icon = Icons.restart_alt_outlined; + buttonTitle = 'service_page.status.deactivating'; + break; + + case ServiceStatus.reloading: + icon = Icons.restart_alt_outlined; + buttonTitle = 'service_page.status.reloading'; + } + + return FilledCard( + tertiary: true, + child: ListTile( + leading: Icon( + icon, + size: 24, + ), + title: Text(buttonTitle.tr()), + ), + ); + } +} diff --git a/lib/ui/molecules/cards/storage_card.dart b/lib/ui/molecules/cards/storage_card.dart index 71db9258..ad43253f 100644 --- a/lib/ui/molecules/cards/storage_card.dart +++ b/lib/ui/molecules/cards/storage_card.dart @@ -67,7 +67,7 @@ class StorageCard extends StatelessWidget { highlightShape: BoxShape.rectangle, onTap: () => diskStatus.diskVolumes.isEmpty ? null - : context.pushRoute(ServerStorageRoute(diskStatus: diskStatus)), + : context.pushRoute(const ServerStorageRoute()), child: Padding( padding: const EdgeInsets.all(16.0), child: Column( diff --git a/lib/ui/molecules/charts/disk_charts.dart b/lib/ui/molecules/charts/disk_charts.dart index f6981af9..a247c789 100644 --- a/lib/ui/molecules/charts/disk_charts.dart +++ b/lib/ui/molecules/charts/disk_charts.dart @@ -2,7 +2,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/ui/molecules/charts/generic_chart.dart'; -import 'package:selfprivacy/ui/pages/server_details/server_details_screen.dart'; +import 'package:selfprivacy/ui/organisms/charts/server_charts.dart'; class DiskChart extends GenericLineChart { DiskChart({ diff --git a/lib/ui/molecules/list_items/user_list_item.dart b/lib/ui/molecules/list_items/user_list_item.dart index e4cf474d..c94ff34a 100644 --- a/lib/ui/molecules/list_items/user_list_item.dart +++ b/lib/ui/molecules/list_items/user_list_item.dart @@ -20,7 +20,6 @@ class UserListItem extends StatelessWidget { context.pushRoute(UserDetailsRoute(login: user.login)); }, leading: CircleAvatar( - backgroundColor: user.color, child: Text( user.login[0].toUpperCase(), ), diff --git a/lib/ui/pages/server_details/charts/chart.dart b/lib/ui/organisms/charts/server_charts.dart similarity index 82% rename from lib/ui/pages/server_details/charts/chart.dart rename to lib/ui/organisms/charts/server_charts.dart index 86a1e8b2..24c077ba 100644 --- a/lib/ui/pages/server_details/charts/chart.dart +++ b/lib/ui/organisms/charts/server_charts.dart @@ -1,6 +1,27 @@ -part of '../server_details_screen.dart'; +import 'package:auto_route/auto_route.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart'; +import 'package:selfprivacy/logic/common_enum/common_enum.dart'; +import 'package:selfprivacy/logic/cubit/metrics/metrics_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/models/disk_status.dart'; +import 'package:selfprivacy/logic/models/metrics.dart'; +import 'package:selfprivacy/theming/harmonized_basic_colors.dart'; +import 'package:selfprivacy/ui/atoms/cards/filled_card.dart'; +import 'package:selfprivacy/ui/atoms/chart_elements/legend.dart'; +import 'package:selfprivacy/ui/molecules/buttons/period_selector.dart'; +import 'package:selfprivacy/ui/molecules/cards/chart_card.dart'; +import 'package:selfprivacy/ui/molecules/charts/cpu_chart.dart'; +import 'package:selfprivacy/ui/molecules/charts/disk_charts.dart'; +import 'package:selfprivacy/ui/molecules/charts/memory_chart.dart'; +import 'package:selfprivacy/ui/molecules/charts/network_charts.dart'; +import 'package:selfprivacy/ui/router/router.dart'; + +class ServerCharts extends StatelessWidget { + const ServerCharts({super.key}); -class _Chart extends StatelessWidget { @override Widget build(final BuildContext context) { final MetricsCubit cubit = context.watch(); diff --git a/lib/ui/pages/server_details/logs/logs_screen.dart b/lib/ui/pages/server/logs.dart similarity index 98% rename from lib/ui/pages/server_details/logs/logs_screen.dart rename to lib/ui/pages/server/logs.dart index 4d43937f..86680b6e 100644 --- a/lib/ui/pages/server_details/logs/logs_screen.dart +++ b/lib/ui/pages/server/logs.dart @@ -9,16 +9,16 @@ import 'package:selfprivacy/ui/molecules/placeholders/empty_page_placeholder.dar import 'package:selfprivacy/utils/platform_adapter.dart'; @RoutePage() -class ServerLogsScreen extends StatefulWidget { - const ServerLogsScreen({this.serviceId, super.key}); +class ServerLogsPage extends StatefulWidget { + const ServerLogsPage({this.serviceId, super.key}); final String? serviceId; @override - State createState() => _ServerLogsScreenState(); + State createState() => _ServerLogsPageState(); } -class _ServerLogsScreenState extends State { +class _ServerLogsPageState extends State { final ScrollController _scrollController = ScrollController(); late ServerLogsBloc _serverLogsBloc; diff --git a/lib/ui/pages/server_details/memory_usage_by_service_screen.dart b/lib/ui/pages/server/memory_usage_by_service.dart similarity index 98% rename from lib/ui/pages/server_details/memory_usage_by_service_screen.dart rename to lib/ui/pages/server/memory_usage_by_service.dart index 41452014..34278b51 100644 --- a/lib/ui/pages/server_details/memory_usage_by_service_screen.dart +++ b/lib/ui/pages/server/memory_usage_by_service.dart @@ -16,8 +16,8 @@ import 'package:selfprivacy/ui/router/router.dart'; import 'package:skeletonizer/skeletonizer.dart'; @RoutePage() -class MemoryUsageByServiceScreen extends StatelessWidget { - const MemoryUsageByServiceScreen({super.key}); +class MemoryUsageByServicePage extends StatelessWidget { + const MemoryUsageByServicePage({super.key}); @override Widget build(final BuildContext context) => BlocProvider( diff --git a/lib/ui/pages/server_details/time_zone/time_zone.dart b/lib/ui/pages/server/select_timezone.dart similarity index 93% rename from lib/ui/pages/server_details/time_zone/time_zone.dart rename to lib/ui/pages/server/select_timezone.dart index d574d5e4..0e171f7e 100644 --- a/lib/ui/pages/server_details/time_zone/time_zone.dart +++ b/lib/ui/pages/server/select_timezone.dart @@ -1,4 +1,4 @@ -part of '../server_settings_screen.dart'; +part of 'server_settings.dart'; final List locations = timeZoneDatabase.locations.values.toList() ..sort( @@ -6,14 +6,15 @@ final List locations = timeZoneDatabase.locations.values.toList() l1.currentTimeZone.offset.compareTo(l2.currentTimeZone.offset), ); -class SelectTimezone extends StatefulWidget { - const SelectTimezone({super.key}); +@RoutePage() +class SelectTimezonePage extends StatefulWidget { + const SelectTimezonePage({super.key}); @override - State createState() => _SelectTimezoneState(); + State createState() => _SelectTimezonePageState(); } -class _SelectTimezoneState extends State { +class _SelectTimezonePageState extends State { final ScrollController scrollController = ScrollController(); final TextEditingController searchController = TextEditingController(); diff --git a/lib/ui/pages/server_details/server_details_screen.dart b/lib/ui/pages/server/server_details.dart similarity index 68% rename from lib/ui/pages/server_details/server_details_screen.dart rename to lib/ui/pages/server/server_details.dart index 86801d8b..fe417384 100644 --- a/lib/ui/pages/server_details/server_details_screen.dart +++ b/lib/ui/pages/server/server_details.dart @@ -3,39 +3,27 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart'; -import 'package:selfprivacy/logic/common_enum/common_enum.dart'; import 'package:selfprivacy/logic/cubit/metrics/metrics_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/logic/models/disk_status.dart'; -import 'package:selfprivacy/logic/models/metrics.dart'; -import 'package:selfprivacy/theming/harmonized_basic_colors.dart'; -import 'package:selfprivacy/ui/atoms/cards/filled_card.dart'; -import 'package:selfprivacy/ui/atoms/chart_elements/legend.dart'; import 'package:selfprivacy/ui/atoms/icons/brand_icons.dart'; +import 'package:selfprivacy/ui/atoms/list_tiles/section_headline.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; -import 'package:selfprivacy/ui/molecules/buttons/period_selector.dart'; -import 'package:selfprivacy/ui/molecules/cards/chart_card.dart'; import 'package:selfprivacy/ui/molecules/cards/server_text_details_card.dart'; import 'package:selfprivacy/ui/molecules/cards/storage_card.dart'; -import 'package:selfprivacy/ui/molecules/charts/cpu_chart.dart'; -import 'package:selfprivacy/ui/molecules/charts/disk_charts.dart'; -import 'package:selfprivacy/ui/molecules/charts/memory_chart.dart'; -import 'package:selfprivacy/ui/molecules/charts/network_charts.dart'; +import 'package:selfprivacy/ui/organisms/charts/server_charts.dart'; import 'package:selfprivacy/ui/router/router.dart'; -part 'charts/chart.dart'; - var navigatorKey = GlobalKey(); @RoutePage() -class ServerDetailsScreen extends StatefulWidget { - const ServerDetailsScreen({super.key}); +class ServerDetailsPage extends StatefulWidget { + const ServerDetailsPage({super.key}); @override - State createState() => _ServerDetailsScreenState(); + State createState() => _ServerDetailsPageState(); } -class _ServerDetailsScreenState extends State +class _ServerDetailsPageState extends State with SingleTickerProviderStateMixin { late TabController tabController; @@ -89,14 +77,13 @@ class _ServerDetailsScreenState extends State onTap: () => context.pushRoute(ServerLogsRoute()), ), const Divider(height: 32), - Text( - 'server.resource_usage'.tr(), - style: Theme.of(context).textTheme.titleLarge, + SectionHeadline( + title: 'server.resource_usage'.tr(), ), const SizedBox(height: 8), BlocProvider( create: (final context) => MetricsCubit()..restart(), - child: _Chart(), + child: const ServerCharts(), ), const SizedBox(height: 8), const ServerTextDetailsCard(), diff --git a/lib/ui/pages/server_details/server_settings.dart b/lib/ui/pages/server/server_settings.dart similarity index 81% rename from lib/ui/pages/server_details/server_settings.dart rename to lib/ui/pages/server/server_settings.dart index 58715fa6..0b691793 100644 --- a/lib/ui/pages/server_details/server_settings.dart +++ b/lib/ui/pages/server/server_settings.dart @@ -1,4 +1,37 @@ -part of 'server_settings_screen.dart'; +import 'package:auto_route/auto_route.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; +import 'package:selfprivacy/logic/models/job.dart'; +import 'package:selfprivacy/ui/atoms/progress_indicators/brand_loader.dart'; +import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/router/router.dart'; +import 'package:selfprivacy/utils/breakpoints.dart'; +import 'package:selfprivacy/utils/extensions/duration.dart'; +import 'package:timezone/timezone.dart'; + +part 'select_timezone.dart'; + +@RoutePage() +class ServerSettingsPage extends StatefulWidget { + const ServerSettingsPage({super.key}); + + @override + State createState() => _ServerSettingsPageState(); +} + +class _ServerSettingsPageState extends State { + @override + Widget build(final BuildContext context) => BrandHeroScreen( + hasFlashButton: true, + heroIcon: Icons.settings_outlined, + heroTitle: 'server.settings'.tr(), + children: const [ + _ServerSettings(), + ], + ); +} class _ServerSettings extends StatefulWidget { const _ServerSettings(); @@ -106,11 +139,7 @@ class _ServerSettingsState extends State<_ServerSettings> { serverDetailsState.serverTimezone.toString(), ), onTap: () { - Navigator.of(context).push( - materialRoute( - const SelectTimezone(), - ), - ); + context.pushRoute(const SelectTimezoneRoute()); }, ), SwitchListTile.adaptive( diff --git a/lib/ui/pages/server_details/server_settings_screen.dart b/lib/ui/pages/server_details/server_settings_screen.dart deleted file mode 100644 index 0ffde783..00000000 --- a/lib/ui/pages/server_details/server_settings_screen.dart +++ /dev/null @@ -1,35 +0,0 @@ -import 'package:auto_route/auto_route.dart'; -import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/material.dart'; -import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; -import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart'; -import 'package:selfprivacy/logic/models/job.dart'; -import 'package:selfprivacy/ui/atoms/progress_indicators/brand_loader.dart'; -import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; -import 'package:selfprivacy/utils/breakpoints.dart'; -import 'package:selfprivacy/utils/extensions/duration.dart'; -import 'package:selfprivacy/utils/route_transitions/basic.dart'; -import 'package:timezone/timezone.dart'; - -part 'server_settings.dart'; -part 'time_zone/time_zone.dart'; - -@RoutePage() -class ServerSettingsScreen extends StatefulWidget { - const ServerSettingsScreen({super.key}); - - @override - State createState() => _ServerSettingsScreenState(); -} - -class _ServerSettingsScreenState extends State { - @override - Widget build(final BuildContext context) => BrandHeroScreen( - hasFlashButton: true, - heroIcon: Icons.settings_outlined, - heroTitle: 'server.settings'.tr(), - children: const [ - _ServerSettings(), - ], - ); -} diff --git a/lib/ui/pages/server_storage/server_storage.dart b/lib/ui/pages/server_storage/server_storage.dart index 6fbca3c9..057e9ba3 100644 --- a/lib/ui/pages/server_storage/server_storage.dart +++ b/lib/ui/pages/server_storage/server_storage.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:gap/gap.dart'; import 'package:selfprivacy/logic/bloc/services/services_bloc.dart'; +import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart'; import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; @@ -17,12 +18,9 @@ import 'package:selfprivacy/utils/show_jobs_modal.dart'; @RoutePage() class ServerStoragePage extends StatefulWidget { const ServerStoragePage({ - required this.diskStatus, super.key, }); - final DiskStatus diskStatus; - @override State createState() => _ServerStoragePageState(); } @@ -33,7 +31,7 @@ class _ServerStoragePageState extends State { final bool isReady = context.watch().state is ServerInstallationFinished; - final List services = context.watch().state.services; + final DiskStatus diskStatus = context.watch().state.diskStatus; if (!isReady) { return BrandHeroScreen( @@ -49,24 +47,10 @@ class _ServerStoragePageState extends State { bodyPadding: const EdgeInsets.symmetric(vertical: 16.0), hasFlashButton: true, children: [ - ...widget.diskStatus.diskVolumes.map( - (final volume) => Column( - mainAxisSize: MainAxisSize.min, - children: [ - ServerStorageSection( - volume: volume, - diskStatus: widget.diskStatus, - services: services - .where( - (final service) => - service.storageUsage.volume == volume.name, - ) - .toList(), - ), - const Gap(16), - const Divider(), - const Gap(16), - ], + ...diskStatus.diskVolumes.map( + (final volume) => DiskConsumptionOverview( + volume: volume, + diskStatus: diskStatus, ), ), const Gap(8), @@ -85,6 +69,39 @@ class _ServerStoragePageState extends State { } } +class DiskConsumptionOverview extends StatelessWidget { + const DiskConsumptionOverview({ + required this.volume, + required this.diskStatus, + super.key, + }); + + final DiskVolume volume; + final DiskStatus diskStatus; + + @override + Widget build(final BuildContext context) { + final List services = context.watch().state.services; + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + ServerStorageSection( + volume: volume, + diskStatus: diskStatus, + services: services + .where( + (final service) => service.storageUsage.volume == volume.name, + ) + .toList(), + ), + const Gap(16), + const Divider(), + const Gap(16), + ], + ); + } +} + class ServerStorageSection extends StatelessWidget { const ServerStorageSection({ required this.volume, diff --git a/lib/ui/pages/services/service.dart b/lib/ui/pages/services/service.dart index 28fe321a..7c021c05 100644 --- a/lib/ui/pages/services/service.dart +++ b/lib/ui/pages/services/service.dart @@ -8,8 +8,8 @@ import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart'; import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart'; import 'package:selfprivacy/logic/models/job.dart'; import 'package:selfprivacy/logic/models/service.dart'; -import 'package:selfprivacy/ui/atoms/cards/filled_card.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/molecules/cards/service_status.dart'; import 'package:selfprivacy/ui/router/router.dart'; import 'package:selfprivacy/utils/launch_url.dart'; import 'package:selfprivacy/utils/platform_adapter.dart'; @@ -198,64 +198,3 @@ class _ServicePageState extends State { ); } } - -class ServiceStatusCard extends StatelessWidget { - const ServiceStatusCard({ - required this.status, - super.key, - }); - final ServiceStatus status; - - @override - Widget build(final BuildContext context) { - late IconData icon; - late String buttonTitle; - - switch (status) { - case ServiceStatus.active: - icon = Icons.check_circle_outline; - buttonTitle = 'service_page.status.active'; - break; - - case ServiceStatus.inactive: - icon = Icons.stop_circle_outlined; - buttonTitle = 'service_page.status.inactive'; - break; - - case ServiceStatus.failed: - icon = Icons.error_outline; - buttonTitle = 'service_page.status.failed'; - break; - - case ServiceStatus.off: - icon = Icons.power_settings_new; - buttonTitle = 'service_page.status.off'; - break; - - case ServiceStatus.activating: - icon = Icons.restart_alt_outlined; - buttonTitle = 'service_page.status.activating'; - break; - - case ServiceStatus.deactivating: - icon = Icons.restart_alt_outlined; - buttonTitle = 'service_page.status.deactivating'; - break; - - case ServiceStatus.reloading: - icon = Icons.restart_alt_outlined; - buttonTitle = 'service_page.status.reloading'; - } - - return FilledCard( - tertiary: true, - child: ListTile( - leading: Icon( - icon, - size: 24, - ), - title: Text(buttonTitle.tr()), - ), - ); - } -} diff --git a/lib/ui/router/router.dart b/lib/ui/router/router.dart index 150edc41..2a3c7300 100644 --- a/lib/ui/router/router.dart +++ b/lib/ui/router/router.dart @@ -20,10 +20,10 @@ import 'package:selfprivacy/ui/pages/onboarding/onboarding.dart'; import 'package:selfprivacy/ui/pages/providers/providers.dart'; import 'package:selfprivacy/ui/pages/recovery_key/recovery_key.dart'; import 'package:selfprivacy/ui/pages/root_route.dart'; -import 'package:selfprivacy/ui/pages/server_details/logs/logs_screen.dart'; -import 'package:selfprivacy/ui/pages/server_details/memory_usage_by_service_screen.dart'; -import 'package:selfprivacy/ui/pages/server_details/server_details_screen.dart'; -import 'package:selfprivacy/ui/pages/server_details/server_settings_screen.dart'; +import 'package:selfprivacy/ui/pages/server/logs.dart'; +import 'package:selfprivacy/ui/pages/server/memory_usage_by_service.dart'; +import 'package:selfprivacy/ui/pages/server/server_details.dart'; +import 'package:selfprivacy/ui/pages/server/server_settings.dart'; import 'package:selfprivacy/ui/pages/server_storage/binds_migration/services_migration.dart'; import 'package:selfprivacy/ui/pages/server_storage/extending_volume.dart'; import 'package:selfprivacy/ui/pages/server_storage/server_storage.dart'; @@ -108,6 +108,7 @@ class RootRouter extends RootStackRouter { AutoRoute(page: ServiceRoute.page), AutoRoute(page: ServiceSettingsRoute.page), AutoRoute(page: ServerDetailsRoute.page), + AutoRoute(page: SelectTimezoneRoute.page), AutoRoute(page: DnsDetailsRoute.page), AutoRoute(page: BackupDetailsRoute.page), AutoRoute(page: BackupsListRoute.page), diff --git a/lib/ui/router/router.gr.dart b/lib/ui/router/router.gr.dart index 4a3b03e1..a1dacb11 100644 --- a/lib/ui/router/router.gr.dart +++ b/lib/ui/router/router.gr.dart @@ -307,7 +307,7 @@ class InitializingRoute extends PageRouteInfo { } /// generated route for -/// [MemoryUsageByServiceScreen] +/// [MemoryUsageByServicePage] class MemoryUsageByServiceRoute extends PageRouteInfo { const MemoryUsageByServiceRoute({List? children}) : super( @@ -320,7 +320,7 @@ class MemoryUsageByServiceRoute extends PageRouteInfo { static PageInfo page = PageInfo( name, builder: (data) { - return const MemoryUsageByServiceScreen(); + return const MemoryUsageByServicePage(); }, ); } @@ -478,7 +478,26 @@ class RootRoute extends PageRouteInfo { } /// generated route for -/// [ServerDetailsScreen] +/// [SelectTimezonePage] +class SelectTimezoneRoute extends PageRouteInfo { + const SelectTimezoneRoute({List? children}) + : super( + SelectTimezoneRoute.name, + initialChildren: children, + ); + + static const String name = 'SelectTimezoneRoute'; + + static PageInfo page = PageInfo( + name, + builder: (data) { + return const SelectTimezonePage(); + }, + ); +} + +/// generated route for +/// [ServerDetailsPage] class ServerDetailsRoute extends PageRouteInfo { const ServerDetailsRoute({List? children}) : super( @@ -491,13 +510,13 @@ class ServerDetailsRoute extends PageRouteInfo { static PageInfo page = PageInfo( name, builder: (data) { - return const ServerDetailsScreen(); + return const ServerDetailsPage(); }, ); } /// generated route for -/// [ServerLogsScreen] +/// [ServerLogsPage] class ServerLogsRoute extends PageRouteInfo { ServerLogsRoute({ String? serviceId, @@ -519,7 +538,7 @@ class ServerLogsRoute extends PageRouteInfo { builder: (data) { final args = data.argsAs( orElse: () => const ServerLogsRouteArgs()); - return ServerLogsScreen( + return ServerLogsPage( serviceId: args.serviceId, key: args.key, ); @@ -544,7 +563,7 @@ class ServerLogsRouteArgs { } /// generated route for -/// [ServerSettingsScreen] +/// [ServerSettingsPage] class ServerSettingsRoute extends PageRouteInfo { const ServerSettingsRoute({List? children}) : super( @@ -557,24 +576,17 @@ class ServerSettingsRoute extends PageRouteInfo { static PageInfo page = PageInfo( name, builder: (data) { - return const ServerSettingsScreen(); + return const ServerSettingsPage(); }, ); } /// generated route for /// [ServerStoragePage] -class ServerStorageRoute extends PageRouteInfo { - ServerStorageRoute({ - required DiskStatus diskStatus, - Key? key, - List? children, - }) : super( +class ServerStorageRoute extends PageRouteInfo { + const ServerStorageRoute({List? children}) + : super( ServerStorageRoute.name, - args: ServerStorageRouteArgs( - diskStatus: diskStatus, - key: key, - ), initialChildren: children, ); @@ -583,31 +595,11 @@ class ServerStorageRoute extends PageRouteInfo { static PageInfo page = PageInfo( name, builder: (data) { - final args = data.argsAs(); - return ServerStoragePage( - diskStatus: args.diskStatus, - key: args.key, - ); + return const ServerStoragePage(); }, ); } -class ServerStorageRouteArgs { - const ServerStorageRouteArgs({ - required this.diskStatus, - this.key, - }); - - final DiskStatus diskStatus; - - final Key? key; - - @override - String toString() { - return 'ServerStorageRouteArgs{diskStatus: $diskStatus, key: $key}'; - } -} - /// generated route for /// [ServicePage] class ServiceRoute extends PageRouteInfo { diff --git a/pubspec.lock b/pubspec.lock index bcc890ec..9e0a8a71 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1411,10 +1411,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.2.4" watcher: dependency: transitive description: