Skip to content

Commit

Permalink
Feat: add contact page
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackiu1997 committed Feb 2, 2023
1 parent ba35428 commit 4d98ca8
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 41 deletions.
6 changes: 3 additions & 3 deletions lib/common/widgets/menu_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class MenuButton extends StatelessWidget {
final menuRoutes = const [
SettingsPage(),
AboutPage(),
AboutPage(),
ContactPage(),
];

@override
Expand Down Expand Up @@ -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,
),
),
],
Expand Down
38 changes: 0 additions & 38 deletions lib/pages/about/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,44 +82,6 @@ class _AboutPageState extends State<AboutPage> {
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,
);
},
),
],
),
);
Expand Down
65 changes: 65 additions & 0 deletions lib/pages/contact/view.dart
Original file line number Diff line number Diff line change
@@ -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<ContactPage> createState() => _ContactPageState();
}

class _ContactPageState extends State<ContactPage> {
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,
);
},
),
],
),
);
}
}
1 change: 1 addition & 0 deletions lib/pages/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

0 comments on commit 4d98ca8

Please sign in to comment.