From 4d98ca874b624cf26b1bc5e6d502532136351922 Mon Sep 17 00:00:00 2001 From: Jackiu Date: Thu, 2 Feb 2023 21:19:47 +0800 Subject: [PATCH] Feat: add contact page --- lib/common/widgets/menu_button.dart | 6 +-- lib/pages/about/view.dart | 38 ----------------- lib/pages/contact/view.dart | 65 +++++++++++++++++++++++++++++ lib/pages/index.dart | 1 + 4 files changed, 69 insertions(+), 41 deletions(-) create mode 100644 lib/pages/contact/view.dart diff --git a/lib/common/widgets/menu_button.dart b/lib/common/widgets/menu_button.dart index 13a7dc6d..8a02440b 100644 --- a/lib/common/widgets/menu_button.dart +++ b/lib/common/widgets/menu_button.dart @@ -7,7 +7,7 @@ class MenuButton extends StatelessWidget { final menuRoutes = const [ SettingsPage(), AboutPage(), - AboutPage(), + ContactPage(), ]; @override @@ -46,8 +46,8 @@ class MenuButton extends StatelessWidget { value: 2, padding: const EdgeInsets.symmetric(horizontal: 12), child: MenuListTile( - leading: const Icon(Icons.help_outline_rounded), - text: S.of(context).help, + leading: const Icon(Icons.contact_support), + text: S.of(context).contact, ), ), ], diff --git a/lib/pages/about/view.dart b/lib/pages/about/view.dart index 57b73664..607cfb5f 100644 --- a/lib/pages/about/view.dart +++ b/lib/pages/about/view.dart @@ -82,44 +82,6 @@ class _AboutPageState extends State { child: Text(S.of(context).app_legalese), ), ), - SectionTitle(title: S.of(context).contact), - ListTile( - leading: const Icon(CustomIcons.telegram, size: 32), - title: Text(S.of(context).telegram), - subtitle: const Text(VersionUtil.telegramGroup), - onLongPress: () => Clipboard.setData( - const ClipboardData(text: VersionUtil.telegramGroup)), - onTap: () { - launchUrl( - Uri.parse(VersionUtil.telegramGroupUrl), - mode: LaunchMode.externalApplication, - ); - }, - ), - ListTile( - leading: const Icon(CustomIcons.mail_squared, size: 34), - title: Text(S.of(context).email), - subtitle: const Text(VersionUtil.email), - onLongPress: () => - Clipboard.setData(const ClipboardData(text: VersionUtil.email)), - onTap: () { - launchUrl( - Uri.parse(VersionUtil.emailUrl), - mode: LaunchMode.externalApplication, - ); - }, - ), - ListTile( - leading: const Icon(CustomIcons.github_circled, size: 32), - title: Text(S.of(context).github), - subtitle: const Text(VersionUtil.githubUrl), - onTap: () { - launchUrl( - Uri.parse(VersionUtil.githubUrl), - mode: LaunchMode.externalApplication, - ); - }, - ), ], ), ); diff --git a/lib/pages/contact/view.dart b/lib/pages/contact/view.dart new file mode 100644 index 00000000..22d4cef5 --- /dev/null +++ b/lib/pages/contact/view.dart @@ -0,0 +1,65 @@ +import 'package:flutter/services.dart'; +import 'package:pure_live/common/index.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class ContactPage extends StatefulWidget { + const ContactPage({Key? key}) : super(key: key); + + @override + State createState() => _ContactPageState(); +} + +class _ContactPageState extends State { + void clipboard(String text) { + Clipboard.setData(ClipboardData(text: text)) + .then((value) => SnackBarUtil.success(context, '已复制到剪贴板')); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(), + body: ListView( + physics: const BouncingScrollPhysics(), + children: [ + SectionTitle(title: S.of(context).contact), + ListTile( + leading: const Icon(CustomIcons.telegram, size: 32), + title: Text(S.of(context).telegram), + subtitle: const Text(VersionUtil.telegramGroup), + onLongPress: () => clipboard(VersionUtil.telegramGroup), + onTap: () { + launchUrl( + Uri.parse(VersionUtil.telegramGroupUrl), + mode: LaunchMode.externalApplication, + ); + }, + ), + ListTile( + leading: const Icon(CustomIcons.mail_squared, size: 34), + title: Text(S.of(context).email), + subtitle: const Text(VersionUtil.email), + onLongPress: () => clipboard(VersionUtil.email), + onTap: () { + launchUrl( + Uri.parse(VersionUtil.emailUrl), + mode: LaunchMode.externalApplication, + ); + }, + ), + ListTile( + leading: const Icon(CustomIcons.github_circled, size: 32), + title: Text(S.of(context).github), + subtitle: const Text(VersionUtil.githubUrl), + onTap: () { + launchUrl( + Uri.parse(VersionUtil.githubUrl), + mode: LaunchMode.externalApplication, + ); + }, + ), + ], + ), + ); + } +} diff --git a/lib/pages/index.dart b/lib/pages/index.dart index e0873884..f155117f 100644 --- a/lib/pages/index.dart +++ b/lib/pages/index.dart @@ -9,3 +9,4 @@ export 'search/view.dart'; export 'live_play/view.dart'; export 'area_rooms/view.dart'; export 'about/view.dart'; +export 'contact/view.dart';