diff --git a/lib/ui/atoms/list_tiles/link_list_tile.dart b/lib/ui/atoms/list_tiles/link_list_tile.dart new file mode 100644 index 00000000..52d1ba55 --- /dev/null +++ b/lib/ui/atoms/list_tiles/link_list_tile.dart @@ -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().showSnackBar( + 'basis.copied_to_clipboard'.tr(), + ); + }, + ); +} diff --git a/lib/ui/pages/errors/failed_to_init_secure_storage.dart b/lib/ui/pages/errors/failed_to_init_secure_storage.dart index 10d6e935..d72e2c69 100644 --- a/lib/ui/pages/errors/failed_to_init_secure_storage.dart +++ b/lib/ui/pages/errors/failed_to_init_secure_storage.dart @@ -3,8 +3,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.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/pages/more/about_application.dart'; class FailedToInitSecureStorageScreen extends StatelessWidget { const FailedToInitSecureStorageScreen({ diff --git a/lib/ui/pages/more/about_application.dart b/lib/ui/pages/more/about_application.dart index 63e87418..38796660 100644 --- a/lib/ui/pages/more/about_application.dart +++ b/lib/ui/pages/more/about_application.dart @@ -5,11 +5,11 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:package_info_plus/package_info_plus.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/layouts/brand_hero_screen.dart'; import 'package:selfprivacy/utils/breakpoints.dart'; import 'package:selfprivacy/utils/platform_adapter.dart'; -import 'package:url_launcher/url_launcher.dart'; @RoutePage() class AboutApplicationPage extends StatelessWidget { @@ -43,6 +43,7 @@ class AboutApplicationPage extends StatelessWidget { hasBackButton: true, hasFlashButton: false, heroTitle: 'about_application_page.title'.tr(), + heroIcon: Icons.info_outline, children: [ SectionTitle(title: 'about_application_page.versions'.tr()), FutureBuilder( @@ -219,39 +220,3 @@ class AboutApplicationPage extends StatelessWidget { 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().showSnackBar( - 'basis.copied_to_clipboard'.tr(), - ); - }, - ); -} diff --git a/pubspec.lock b/pubspec.lock index 9e0a8a71..bcc890ec 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1411,10 +1411,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "14.2.5" watcher: dependency: transitive description: