diff --git a/lib/config/brand_theme.dart b/lib/config/brand_theme.dart index aa94a8ec..3adae29c 100644 --- a/lib/config/brand_theme.dart +++ b/lib/config/brand_theme.dart @@ -1,3 +1,3 @@ import 'package:flutter/material.dart'; -const EdgeInsets paddingH15V0 = EdgeInsets.symmetric(horizontal: 15); +const EdgeInsets paddingH16V0 = EdgeInsets.symmetric(horizontal: 16); diff --git a/lib/ui/molecules/cards/provider_screen_card.dart b/lib/ui/molecules/cards/provider_screen_card.dart new file mode 100644 index 00000000..ee309bfc --- /dev/null +++ b/lib/ui/molecules/cards/provider_screen_card.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; +import 'package:gap/gap.dart'; +import 'package:selfprivacy/logic/models/state_types.dart'; +import 'package:selfprivacy/ui/atoms/masks/icon_status_mask.dart'; + +class ProviderScreenCard extends StatelessWidget { + const ProviderScreenCard({ + required this.state, + required this.icon, + required this.title, + required this.subtitle, + this.onTap, + super.key, + }); + + final Function()? onTap; + final StateType state; + final IconData icon; + final String title; + final String subtitle; + + @override + Widget build(final BuildContext context) => Card( + clipBehavior: Clip.antiAlias, + child: InkResponse( + highlightShape: BoxShape.rectangle, + onTap: onTap, + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + IconStatusMask( + status: state, + icon: Icon(icon, size: 32, color: Colors.white), + ), + const Gap(8), + Expanded( + child: Text( + title, + style: Theme.of(context).textTheme.headlineMedium, + ), + ), + if (state != StateType.uninitialized) + IconStatusMask( + status: state, + icon: Icon( + state == StateType.stable + ? Icons.check_circle_outline + : state == StateType.warning + ? Icons.warning_amber_outlined + : Icons.error_outline, + color: Colors.white, + ), + ), + ], + ), + const SizedBox(height: 8), + if (state != StateType.uninitialized) + Text( + subtitle, + style: Theme.of(context).textTheme.bodyLarge, + ), + ], + ), + ), + ), + ); +} diff --git a/lib/ui/organisms/jobs/jobs_content.dart b/lib/ui/organisms/jobs/jobs_content.dart index 7435241d..c4d6ce74 100644 --- a/lib/ui/organisms/jobs/jobs_content.dart +++ b/lib/ui/organisms/jobs/jobs_content.dart @@ -108,7 +108,7 @@ class JobsContent extends StatelessWidget { } return ListView( controller: controller, - padding: paddingH15V0, + padding: paddingH16V0, children: [ const Gap(16), Center( diff --git a/lib/ui/pages/more/more.dart b/lib/ui/pages/more/more.dart index 83703ef2..a5de34fe 100644 --- a/lib/ui/pages/more/more.dart +++ b/lib/ui/pages/more/more.dart @@ -28,7 +28,7 @@ class MorePage extends StatelessWidget { body: ListView( children: [ Padding( - padding: paddingH15V0, + padding: paddingH16V0, child: Column( children: [ if (!isReady) diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index b3792f56..df44655d 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -1,7 +1,6 @@ import 'package:auto_route/auto_route.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:gap/gap.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/bloc/backups/backups_bloc.dart'; import 'package:selfprivacy/logic/bloc/outdated_server_checker/outdated_server_checker_bloc.dart'; @@ -10,8 +9,8 @@ import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/state_types.dart'; import 'package:selfprivacy/ui/atoms/icons/brand_icons.dart'; -import 'package:selfprivacy/ui/atoms/masks/icon_status_mask.dart'; import 'package:selfprivacy/ui/molecules/cards/not_ready_card.dart'; +import 'package:selfprivacy/ui/molecules/cards/provider_screen_card.dart'; import 'package:selfprivacy/ui/molecules/cards/server_outdated_card.dart'; import 'package:selfprivacy/ui/organisms/headers/brand_header.dart'; import 'package:selfprivacy/ui/router/router.dart'; @@ -75,7 +74,7 @@ class _ProvidersPageState extends State { ) : null, body: ListView( - padding: paddingH15V0, + padding: paddingH16V0, children: [ if (!isReady) ...[ const NotReadyCard(), @@ -90,7 +89,7 @@ class _ProvidersPageState extends State { ), const SizedBox(height: 16), ], - _Card( + ProviderScreenCard( state: getServerStatus(), icon: BrandIcons.server, title: 'server.card_title'.tr(), @@ -102,7 +101,7 @@ class _ProvidersPageState extends State { : null, ), const SizedBox(height: 16), - _Card( + ProviderScreenCard( state: getDnsStatus(), icon: BrandIcons.globe, title: 'domain.screen_title'.tr(), @@ -114,7 +113,7 @@ class _ProvidersPageState extends State { : null, ), const SizedBox(height: 16), - _Card( + ProviderScreenCard( state: isBackupInitialized ? StateType.stable : StateType.uninitialized, @@ -130,70 +129,3 @@ class _ProvidersPageState extends State { ); } } - -class _Card extends StatelessWidget { - const _Card({ - required this.state, - required this.icon, - required this.title, - required this.subtitle, - this.onTap, - }); - - final Function()? onTap; - final StateType state; - final IconData icon; - final String title; - final String subtitle; - - @override - Widget build(final BuildContext context) => Card( - clipBehavior: Clip.antiAlias, - child: InkResponse( - highlightShape: BoxShape.rectangle, - onTap: onTap, - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - IconStatusMask( - status: state, - icon: Icon(icon, size: 30, color: Colors.white), - ), - const Gap(8), - Expanded( - child: Text( - title, - style: Theme.of(context).textTheme.headlineMedium, - ), - ), - if (state != StateType.uninitialized) - IconStatusMask( - status: state, - icon: Icon( - state == StateType.stable - ? Icons.check_circle_outline - : state == StateType.warning - ? Icons.warning_amber_outlined - : Icons.error_outline, - color: Colors.white, - ), - ), - ], - ), - const SizedBox(height: 8), - if (state != StateType.uninitialized) - Text( - subtitle, - style: Theme.of(context).textTheme.bodyLarge, - ), - ], - ), - ), - ), - ); -} diff --git a/lib/ui/pages/server_details/memory_usage_by_service_screen.dart b/lib/ui/pages/server_details/memory_usage_by_service_screen.dart index 099f908f..059cd09f 100644 --- a/lib/ui/pages/server_details/memory_usage_by_service_screen.dart +++ b/lib/ui/pages/server_details/memory_usage_by_service_screen.dart @@ -10,8 +10,8 @@ import 'package:selfprivacy/logic/cubit/metrics/metrics_cubit.dart'; import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/ui/atoms/buttons/segmented_buttons.dart'; import 'package:selfprivacy/ui/atoms/icons/brand_icons.dart'; -import 'package:selfprivacy/ui/molecules/placeholders/empty_page_placeholder.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/molecules/placeholders/empty_page_placeholder.dart'; @RoutePage() class MemoryUsageByServiceScreen extends StatelessWidget { diff --git a/lib/ui/pages/services/services.dart b/lib/ui/pages/services/services.dart index daa72ea7..6f948463 100644 --- a/lib/ui/pages/services/services.dart +++ b/lib/ui/pages/services/services.dart @@ -11,8 +11,8 @@ import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/logic/models/state_types.dart'; import 'package:selfprivacy/ui/atoms/icons/brand_icons.dart'; import 'package:selfprivacy/ui/atoms/masks/icon_status_mask.dart'; -import 'package:selfprivacy/ui/molecules/placeholders/empty_page_placeholder.dart'; import 'package:selfprivacy/ui/molecules/cards/server_outdated_card.dart'; +import 'package:selfprivacy/ui/molecules/placeholders/empty_page_placeholder.dart'; import 'package:selfprivacy/ui/organisms/headers/brand_header.dart'; import 'package:selfprivacy/ui/router/router.dart'; import 'package:selfprivacy/utils/breakpoints.dart'; @@ -56,7 +56,7 @@ class _ServicesPageState extends State { : RefreshIndicator( onRefresh: context.read().awaitReload, child: ListView( - padding: paddingH15V0, + padding: paddingH16V0, children: [ if (outdatedServerCheckerState is OutdatedServerCheckerOutdated) ...[ diff --git a/lib/ui/pages/users/reset_password.dart b/lib/ui/pages/users/reset_password.dart index 4b39342c..1585ffbc 100644 --- a/lib/ui/pages/users/reset_password.dart +++ b/lib/ui/pages/users/reset_password.dart @@ -36,7 +36,7 @@ class ResetPassword extends StatelessWidget { ), const SizedBox(width: 14), Padding( - padding: paddingH15V0, + padding: paddingH16V0, child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/ui/pages/users/user.dart b/lib/ui/pages/users/user.dart index 6c1658c6..e9459c66 100644 --- a/lib/ui/pages/users/user.dart +++ b/lib/ui/pages/users/user.dart @@ -14,7 +14,7 @@ class _User extends StatelessWidget { context.pushRoute(UserDetailsRoute(login: user.login)); }, child: Container( - padding: paddingH15V0, + padding: paddingH16V0, height: 48, child: Row( children: [ diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index 4775bb22..667ac7d7 100644 --- a/lib/ui/pages/users/user_details.dart +++ b/lib/ui/pages/users/user_details.dart @@ -314,7 +314,7 @@ class NewSshKey extends StatelessWidget { ), const SizedBox(width: 14), Padding( - padding: paddingH15V0, + padding: paddingH16V0, child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index e90b060d..9b5e8e83 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -19,10 +19,10 @@ import 'package:selfprivacy/ui/atoms/buttons/outlined_button.dart'; import 'package:selfprivacy/ui/atoms/cards/filled_card.dart'; import 'package:selfprivacy/ui/atoms/icons/brand_icons.dart'; import 'package:selfprivacy/ui/atoms/list_tiles/list_tile_on_surface_variant.dart'; -import 'package:selfprivacy/ui/molecules/placeholders/empty_page_placeholder.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; import 'package:selfprivacy/ui/molecules/cards/server_outdated_card.dart'; import 'package:selfprivacy/ui/molecules/info_box/info_box.dart'; +import 'package:selfprivacy/ui/molecules/placeholders/empty_page_placeholder.dart'; import 'package:selfprivacy/ui/organisms/headers/brand_header.dart'; import 'package:selfprivacy/ui/router/router.dart'; import 'package:selfprivacy/utils/breakpoints.dart';