-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Discord as support option (#647)
https://user-images.githubusercontent.com/24459435/236478478-cef65d09-5e00-4018-9846-3b49f9dacabd.mov Closes #395
- Loading branch information
1 parent
1a18eba
commit 41c48af
Showing
1 changed file
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
|
||
import 'package:build_context/build_context.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_markdown/flutter_markdown.dart'; | ||
import 'package:sharezone/widgets/avatar_card.dart'; | ||
import 'package:sharezone_widgets/sharezone_widgets.dart'; | ||
import 'package:url_launcher/url_launcher.dart'; | ||
|
@@ -28,6 +29,7 @@ class SupportPage extends StatelessWidget { | |
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
_Header(), | ||
_DiscordTile(), | ||
_EmailTile(), | ||
], | ||
), | ||
|
@@ -110,8 +112,8 @@ class _EmailTile extends StatelessWidget { | |
'assets/icons/email.svg', | ||
color: context.primaryColor, | ||
), | ||
title: '[email protected]', | ||
subtitle: 'E-Mail', | ||
title: 'E-Mail', | ||
subtitle: '[email protected]', | ||
onPressed: () async { | ||
final url = Uri.parse(Uri.encodeFull( | ||
'mailto:[email protected]?subject=Ich brauche eure Hilfe! 😭')); | ||
|
@@ -127,3 +129,63 @@ class _EmailTile extends StatelessWidget { | |
); | ||
} | ||
} | ||
|
||
class _DiscordTile extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return _SupportCard( | ||
icon: PlatformSvg.asset( | ||
'assets/icons/discord.svg', | ||
color: context.primaryColor, | ||
), | ||
title: 'Discord', | ||
subtitle: 'Community-Support', | ||
onPressed: () async { | ||
final confirmed = await showDialog<bool>( | ||
context: context, | ||
builder: (_) => _NoteAboutPrivacyPolicy(), | ||
); | ||
|
||
if (confirmed == true) { | ||
final url = | ||
Uri.parse(Uri.encodeFull('https://sharezone.net/discord')); | ||
if (await canLaunchUrl(url)) { | ||
launchUrl(url); | ||
} else { | ||
showSnackSec( | ||
context: context, | ||
text: 'www.sharezone.net/discord', | ||
); | ||
} | ||
} | ||
}, | ||
); | ||
} | ||
} | ||
|
||
class _NoteAboutPrivacyPolicy extends StatelessWidget { | ||
const _NoteAboutPrivacyPolicy({Key key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AlertDialog( | ||
title: Text("Discord Datenschutz"), | ||
content: MarkdownBody( | ||
data: | ||
"Bitte beachte, dass bei der Nutzung von Discord dessen [Datenschutzbestimmungen](https://discord.com/privacy) gelten.", | ||
styleSheet: MarkdownStyleSheet(a: linkStyle(context, 14)), | ||
onTapLink: (_, url, __) => launchUrl(Uri.parse(url)), | ||
), | ||
actions: [ | ||
TextButton( | ||
onPressed: () => Navigator.of(context).pop(), | ||
child: const Text("ABBRECHEN"), | ||
), | ||
TextButton( | ||
onPressed: () => Navigator.of(context).pop(true), | ||
child: const Text("WEITER"), | ||
), | ||
], | ||
); | ||
} | ||
} |