refactor(ui): Refactor About and support screen

This commit is contained in:
Inex Code 2024-12-11 17:41:30 +03:00
parent 52b2d0f51e
commit 0ddcfc7957
No known key found for this signature in database
4 changed files with 46 additions and 40 deletions

View file

@ -0,0 +1,41 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:selfprivacy/config/get_it_config.dart';
import 'package:selfprivacy/utils/platform_adapter.dart';
import 'package:url_launcher/url_launcher.dart';
class LinkListTile extends StatelessWidget {
const LinkListTile({
required this.title,
required this.subtitle,
required this.uri,
required this.icon,
this.longPressText,
super.key,
});
final String title;
final String subtitle;
final String uri;
final IconData icon;
final String? longPressText;
@override
Widget build(final BuildContext context) => ListTile(
title: Text(title),
subtitle: Text(subtitle),
onTap: () => launchUrl(
Uri.parse(uri),
mode: LaunchMode.externalApplication,
),
leading: Icon(icon),
onLongPress: () {
PlatformAdapter.setClipboard(
longPressText ?? uri,
);
getIt<NavigationService>().showSnackBar(
'basis.copied_to_clipboard'.tr(),
);
},
);
}

View file

@ -3,8 +3,8 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:selfprivacy/ui/atoms/list_tiles/link_list_tile.dart';
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
import 'package:selfprivacy/ui/pages/more/about_application.dart';
class FailedToInitSecureStorageScreen extends StatelessWidget { class FailedToInitSecureStorageScreen extends StatelessWidget {
const FailedToInitSecureStorageScreen({ const FailedToInitSecureStorageScreen({

View file

@ -5,11 +5,11 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/config/get_it_config.dart';
import 'package:selfprivacy/ui/atoms/list_tiles/link_list_tile.dart';
import 'package:selfprivacy/ui/atoms/list_tiles/section_title.dart'; import 'package:selfprivacy/ui/atoms/list_tiles/section_title.dart';
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
import 'package:selfprivacy/utils/breakpoints.dart'; import 'package:selfprivacy/utils/breakpoints.dart';
import 'package:selfprivacy/utils/platform_adapter.dart'; import 'package:selfprivacy/utils/platform_adapter.dart';
import 'package:url_launcher/url_launcher.dart';
@RoutePage() @RoutePage()
class AboutApplicationPage extends StatelessWidget { class AboutApplicationPage extends StatelessWidget {
@ -43,6 +43,7 @@ class AboutApplicationPage extends StatelessWidget {
hasBackButton: true, hasBackButton: true,
hasFlashButton: false, hasFlashButton: false,
heroTitle: 'about_application_page.title'.tr(), heroTitle: 'about_application_page.title'.tr(),
heroIcon: Icons.info_outline,
children: [ children: [
SectionTitle(title: 'about_application_page.versions'.tr()), SectionTitle(title: 'about_application_page.versions'.tr()),
FutureBuilder( FutureBuilder(
@ -219,39 +220,3 @@ class AboutApplicationPage extends StatelessWidget {
return apiVersion; return apiVersion;
} }
} }
class LinkListTile extends StatelessWidget {
const LinkListTile({
required this.title,
required this.subtitle,
required this.uri,
required this.icon,
this.longPressText,
super.key,
});
final String title;
final String subtitle;
final String uri;
final IconData icon;
final String? longPressText;
@override
Widget build(final BuildContext context) => ListTile(
title: Text(title),
subtitle: Text(subtitle),
onTap: () => launchUrl(
Uri.parse(uri),
mode: LaunchMode.externalApplication,
),
leading: Icon(icon),
onLongPress: () {
PlatformAdapter.setClipboard(
longPressText ?? uri,
);
getIt<NavigationService>().showSnackBar(
'basis.copied_to_clipboard'.tr(),
);
},
);
}

View file

@ -1411,10 +1411,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "14.2.4" version: "14.2.5"
watcher: watcher:
dependency: transitive dependency: transitive
description: description: