dateapp/lib/widgets/dialogs/community.dart

100 lines
3.3 KiB
Dart
Raw Normal View History

2024-03-03 18:04:45 +07:00
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_svg/flutter_svg.dart';
const discordSVG = "assets/app_icons/external/Discord.svg";
const matrixSVG = "assets/app_icons/external/Matrix.svg";
const telegramSVG = "assets/app_icons/external/Telegram.svg";
2024-03-03 18:04:45 +07:00
Future<void> communityDialogBuilder(BuildContext context) {
2024-03-04 12:51:10 +07:00
final colorMode = Theme.of(context).colorScheme.primary;
2024-03-04 19:09:36 +07:00
final textTheme = Theme.of(context).textTheme;
2024-03-04 12:51:10 +07:00
2024-03-03 18:04:45 +07:00
return showDialog<void>(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
title: const Text('Join our community!'),
children: <Widget>[
SimpleDialogOption(
onPressed: () async {
await launchUrl(Uri.parse('https://discord.gg/WDxuJRsBPp'),
mode: LaunchMode.externalApplication);
},
child: Row(
children: <Widget>[
Expanded(
child: SvgPicture.asset(
discordSVG,
semanticsLabel: 'Discord Logo',
2024-03-04 12:51:10 +07:00
colorFilter: ColorFilter.mode(colorMode, BlendMode.srcIn),
width: 50,
height: 50,
),
),
2024-03-04 19:09:36 +07:00
Expanded(
child: Text('Discord',
style: TextStyle(fontSize: textTheme.bodyLarge?.fontSize),
textAlign: TextAlign.center),
),
2024-03-03 18:04:45 +07:00
],
),
),
SimpleDialogOption(
onPressed: () async {
await launchUrl(
2024-03-04 09:09:57 +07:00
Uri.parse(
'https://matrix.to/#/#datecalc:matrix.winscloud.net'),
mode: LaunchMode.externalApplication);
},
child: Row(
children: <Widget>[
Expanded(
child: SvgPicture.asset(
matrixSVG,
semanticsLabel: 'Matrix Logo',
2024-03-04 12:51:10 +07:00
colorFilter: ColorFilter.mode(colorMode, BlendMode.srcIn),
width: 50,
height: 50,
),
),
2024-03-04 19:09:36 +07:00
Expanded(
2024-03-04 12:51:10 +07:00
child: Text(
'Matrix',
textAlign: TextAlign.center,
2024-03-04 19:09:36 +07:00
style: TextStyle(fontSize: textTheme.bodyLarge?.fontSize),
2024-03-04 12:51:10 +07:00
),
),
],
2024-03-03 18:04:45 +07:00
),
),
SimpleDialogOption(
onPressed: () async {
await launchUrl(Uri.parse('https://t.me/datecalc'),
mode: LaunchMode.externalApplication);
2024-03-03 18:04:45 +07:00
},
child: Row(
children: <Widget>[
Expanded(
child: SvgPicture.asset(
telegramSVG,
semanticsLabel: 'Telegram Logo',
2024-03-04 12:51:10 +07:00
colorFilter: ColorFilter.mode(colorMode, BlendMode.srcIn),
width: 50,
height: 50,
),
),
2024-03-04 19:09:36 +07:00
Expanded(
child: Text('Telegram',
style: TextStyle(fontSize: textTheme.bodyLarge?.fontSize),
textAlign: TextAlign.center),
),
],
),
2024-03-03 18:04:45 +07:00
),
],
);
},
);
}