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"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
<queries>
<intent> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" /> <data android:scheme="https" />
</intent> </intent-filter>
<intent> <intent-filter>
<action android:name="android.intent.action.DIAL" /> <action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" /> <data android:scheme="tel" />
</intent> </intent-filter>
<intent> <intent-filter>
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" /> <data android:mimeType="*/*" />
</intent> </intent-filter>
</queries>
</activity> </activity>
<!-- Don't delete the meta-data below. <!-- 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/calendar.dart';
import 'pages/day.dart'; import 'pages/day.dart';
import 'pages/settings.dart'; import 'pages/settings.dart';
import 'pages/test.dart';
import 'utils/scroll.dart'; import 'utils/scroll.dart';
@ -104,7 +103,7 @@ class _MyHomePageState extends State<MyHomePage> {
visible: true, visible: true,
child: Column( child: Column(
children: [ children: [
SvgPicture.asset(iconPath, semanticsLabel: 'Acme Logo'), SvgPicture.asset(iconPath, semanticsLabel: 'Date Calculator Logo'),
const Text( const Text(
"Date Calculator", "Date Calculator",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30.0), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30.0),
@ -143,7 +142,7 @@ class _MyHomePageState extends State<MyHomePage> {
NavigationDestination( NavigationDestination(
icon: Icon(Icons.settings_outlined), icon: Icon(Icons.settings_outlined),
selectedIcon: Icon(Icons.settings), selectedIcon: Icon(Icons.settings),
label: 'Day', label: 'Settings',
), ),
]) ])
: null, : null,
@ -177,11 +176,6 @@ class _MyHomePageState extends State<MyHomePage> {
selectedIcon: Icon(Icons.settings), selectedIcon: Icon(Icons.settings),
label: Text('Settings'), label: Text('Settings'),
), ),
NavigationRailDestination(
icon: Icon(Icons.edit),
selectedIcon: Icon(Icons.edit),
label: Text('Edit'),
)
], ],
selectedIndex: _selectedTab, selectedIndex: _selectedTab,
onDestinationSelected: (value) { onDestinationSelected: (value) {
@ -212,8 +206,6 @@ Widget _getScreen(BuildContext context, int index) {
return const DayScreen(); return const DayScreen();
case 2: case 2:
return const SettingsScreen(); return const SettingsScreen();
case 3:
return const TestScreen();
default: default:
return const Text('Something went wrong'); 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:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../widgets/dialogs/about.dart'; import '../widgets/dialogs/about.dart';
import '../widgets/dialogs/community.dart';
class SettingsScreen extends StatelessWidget { class SettingsScreen extends StatelessWidget {
const SettingsScreen({Key? key}) : super(key: key); 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 'package:flutter/material.dart';
import '../license.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../constants/info.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) { Future<void> communityDialogBuilder(BuildContext context) {
return showDialog<void>( return showDialog<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return SimpleDialog(
title: Row(children: <Widget>[ title: const Text('Join our community!'),
Container( children: <Widget>[
width: 80, SimpleDialogOption(
height: 80, onPressed: () async {
decoration: const BoxDecoration( await launchUrl(Uri.parse('https://discord.gg/WDxuJRsBPp'),
image: DecorationImage( mode: LaunchMode.externalApplication);
alignment: Alignment.centerLeft, },
image: ExactAssetImage('assets/app_icons/icon.png'))), child: Row(
), children: <Widget>[
Container( Expanded(
child: const Column( child: SvgPicture.asset(
crossAxisAlignment: CrossAxisAlignment.start, discordSVG,
children: [ semanticsLabel: 'Discord Logo',
Text("Date Calculator"), colorFilter:
Text("v$versionString", style: TextStyle(fontSize: 14)), 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( SimpleDialogOption(
style: TextButton.styleFrom( onPressed: () async {
textStyle: Theme.of(context).textTheme.labelLarge, await launchUrl(
), Uri.parse('matrix.to/#/#datecalc:matrix.winscloud.net'),
child: const Text('Close'), mode: LaunchMode.externalApplication);
onPressed: () {
Navigator.of(context).pop();
}, },
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:
- assets/app_icons/icon.png - assets/app_icons/icon.png
- assets/app_icons/net.winscloud.Datecalculator.svg - 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 # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see