Redo navbar - modified settings page - added community page

This commit is contained in:
Win 2024-03-03 20:17:13 +07:00
parent 668661df4b
commit b4e912dd75
6 changed files with 87 additions and 94 deletions

View File

@ -23,21 +23,20 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<queries>
<intent>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
<intent>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<intent>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>
</queries>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.

View File

@ -6,7 +6,6 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'pages/calendar.dart';
import 'pages/day.dart';
import 'pages/settings.dart';
import 'pages/test.dart';
import 'utils/scroll.dart';
@ -104,7 +103,7 @@ class _MyHomePageState extends State<MyHomePage> {
visible: true,
child: Column(
children: [
SvgPicture.asset(iconPath, semanticsLabel: 'Acme Logo'),
SvgPicture.asset(iconPath, semanticsLabel: 'Date Calculator Logo'),
const Text(
"Date Calculator",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30.0),
@ -143,7 +142,7 @@ class _MyHomePageState extends State<MyHomePage> {
NavigationDestination(
icon: Icon(Icons.settings_outlined),
selectedIcon: Icon(Icons.settings),
label: 'Day',
label: 'Settings',
),
])
: null,
@ -177,11 +176,6 @@ class _MyHomePageState extends State<MyHomePage> {
selectedIcon: Icon(Icons.settings),
label: Text('Settings'),
),
NavigationRailDestination(
icon: Icon(Icons.edit),
selectedIcon: Icon(Icons.edit),
label: Text('Edit'),
)
],
selectedIndex: _selectedTab,
onDestinationSelected: (value) {
@ -212,8 +206,6 @@ Widget _getScreen(BuildContext context, int index) {
return const DayScreen();
case 2:
return const SettingsScreen();
case 3:
return const TestScreen();
default:
return const Text('Something went wrong');
}

View File

@ -1,8 +1,8 @@
import 'package:dateapp/widgets/dialogs/community.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import '../widgets/dialogs/about.dart';
import '../widgets/dialogs/community.dart';
class SettingsScreen extends StatelessWidget {
const SettingsScreen({Key? key}) : super(key: key);

View File

@ -1,37 +0,0 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
final Uri _url = Uri.parse('https://flutter.dev');
class TestScreen extends StatelessWidget {
const TestScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Scaffold(
body: _Body(),
);
}
}
class _Body extends StatelessWidget {
const _Body();
@override
Widget build(BuildContext context) {
return const Center(
child: Center(
child: ElevatedButton(
onPressed: _launchUrl,
child: Text('Show Flutter homepage'),
),
),
);
}
}
Future<void> _launchUrl() async {
if (!await launchUrl(_url)) {
throw Exception('Could not launch $_url');
}
}

View File

@ -1,51 +1,87 @@
import 'package:flutter/material.dart';
import '../license.dart';
import '../../constants/info.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";
Future<void> communityDialogBuilder(BuildContext context) {
return showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Row(children: <Widget>[
Container(
width: 80,
height: 80,
decoration: const BoxDecoration(
image: DecorationImage(
alignment: Alignment.centerLeft,
image: ExactAssetImage('assets/app_icons/icon.png'))),
),
Container(
child: const Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Date Calculator"),
Text("v$versionString", style: TextStyle(fontSize: 14)),
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',
colorFilter:
const ColorFilter.mode(Colors.white, BlendMode.srcIn),
width: 50,
height: 50,
),
),
const Expanded(
child: Text('Discord', textAlign: TextAlign.center),
),
],
),
)
]),
content: const Text('Date Calculator by WinsDominoes and AtiusAmy'),
actions: <Widget>[
TextButton(
style: TextButton.styleFrom(
textStyle: Theme.of(context).textTheme.labelLarge,
),
child: const Text('View Licenses'),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => LicensePageCustom()));
},
),
TextButton(
style: TextButton.styleFrom(
textStyle: Theme.of(context).textTheme.labelLarge,
),
child: const Text('Close'),
onPressed: () {
Navigator.of(context).pop();
SimpleDialogOption(
onPressed: () async {
await launchUrl(
Uri.parse('matrix.to/#/#datecalc:matrix.winscloud.net'),
mode: LaunchMode.externalApplication);
},
child: Row(
children: <Widget>[
Expanded(
child: SvgPicture.asset(
matrixSVG,
semanticsLabel: 'Matrix Logo',
colorFilter:
const ColorFilter.mode(Colors.white, BlendMode.srcIn),
width: 50,
height: 50,
),
),
const Expanded(
child: Text('Matrix', textAlign: TextAlign.center),
),
],
),
),
SimpleDialogOption(
onPressed: () async {
await launchUrl(Uri.parse('https://t.me/datecalc'),
mode: LaunchMode.externalApplication);
},
child: Row(
children: <Widget>[
Expanded(
child: SvgPicture.asset(
telegramSVG,
semanticsLabel: 'Telegram Logo',
colorFilter:
const ColorFilter.mode(Colors.white, BlendMode.srcIn),
width: 50,
height: 50,
),
),
const Expanded(
child: Text('Telegram', textAlign: TextAlign.center),
),
],
),
),
],
);

View File

@ -81,6 +81,9 @@ flutter:
assets:
- assets/app_icons/icon.png
- assets/app_icons/net.winscloud.Datecalculator.svg
- assets/app_icons/external/Discord.svg
- assets/app_icons/external/Matrix.svg
- assets/app_icons/external/Telegram.svg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see