diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 6906350..d01dc08 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -23,6 +23,22 @@ + + + + + + + + + + + + + + + + diff --git a/assets/app_icons/external/Discord.svg b/assets/app_icons/external/Discord.svg new file mode 100644 index 0000000..c98980b --- /dev/null +++ b/assets/app_icons/external/Discord.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/app_icons/external/Matrix.svg b/assets/app_icons/external/Matrix.svg new file mode 100644 index 0000000..48500aa --- /dev/null +++ b/assets/app_icons/external/Matrix.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/app_icons/external/Telegram.svg b/assets/app_icons/external/Telegram.svg new file mode 100644 index 0000000..494a138 --- /dev/null +++ b/assets/app_icons/external/Telegram.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/constants/info.dart b/lib/constants/info.dart index 04ae5b1..0c6f5f2 100644 --- a/lib/constants/info.dart +++ b/lib/constants/info.dart @@ -1 +1,2 @@ -const String versionString = "0.0.6"; \ No newline at end of file +const String versionString = "0.0.7"; +const String iconPath = "assets/app_icons/net.winscloud.Datecalculator.svg"; diff --git a/lib/main.dart b/lib/main.dart index a3e333f..e65257c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,14 +1,17 @@ import 'package:dynamic_color/dynamic_color.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +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'; +import 'constants/info.dart'; + void main() { runApp(const MyApp()); } @@ -41,16 +44,12 @@ class MyApp extends StatelessWidget { ThemeData lightTheme = ThemeData( colorScheme: lightColorScheme, useMaterial3: true, - navigationRailTheme: NavigationRailThemeData( - backgroundColor: Colors.black.withOpacity(0.03)), ); ThemeData darkTheme = ThemeData( brightness: Brightness.dark, colorScheme: darkColorScheme, useMaterial3: true, - navigationRailTheme: NavigationRailThemeData( - backgroundColor: Colors.white.withOpacity(0.03)), ); return MaterialApp( @@ -87,42 +86,121 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { - return AdaptiveScaffold( - smallBreakpoint: const WidthPlatformBreakpoint(end: 700), - mediumBreakpoint: const WidthPlatformBreakpoint(begin: 700, end: 1000), - largeBreakpoint: const WidthPlatformBreakpoint(begin: 1000), - useDrawer: false, - selectedIndex: _selectedTab, - onSelectedIndexChange: (int index) { - setState(() { - _selectedTab = index; - }); - }, - destinations: const [ - NavigationDestination( - icon: Icon(Icons.calendar_month_outlined), - selectedIcon: Icon(Icons.calendar_month), - label: 'Calendar', - ), - NavigationDestination( - icon: Icon(Icons.calendar_today_outlined), - selectedIcon: Icon(Icons.calendar_today), - label: 'Day', - ), - NavigationDestination( - icon: Icon(Icons.settings_outlined), - selectedIcon: Icon(Icons.settings), - label: 'Settings', - ), - ], - body: (_) => _getScreen(context, _selectedTab), - smallBody: (_) => _getScreen(context, _selectedTab), - // Define a default secondaryBody. - // Override the default secondaryBody during the smallBreakpoint to be - // empty. Must use AdaptiveScaffold.emptyBuilder to ensure it is properly - // overridden. - smallSecondaryBody: AdaptiveScaffold.emptyBuilder, + double screenWidth = MediaQuery.of(context).size.width; + bool extendedValue = true; + NavigationRailLabelType labelType = NavigationRailLabelType.none; + Widget leading = const Visibility( + visible: false, + child: SizedBox.shrink(), ); + + if (screenWidth >= 600 && screenWidth < 800) { + extendedValue = false; + labelType = NavigationRailLabelType.all; + } + + if (screenWidth >= 800) { + leading = Visibility( + visible: true, + child: Column( + children: [ + SvgPicture.asset(iconPath, semanticsLabel: 'Acme Logo'), + const Text( + "Date Calculator", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30.0), + ), + const SizedBox( + height: 5, + ) + ], + ), + ); + } + + return LayoutBuilder(builder: (context, constraints) { + return Scaffold( + bottomNavigationBar: MediaQuery.of(context).size.width < 600 + ? NavigationBar( + onDestinationSelected: (int index) { + setState(() { + _selectedTab = index; + }); + }, + indicatorColor: + Theme.of(context).colorScheme.secondaryContainer, + selectedIndex: _selectedTab, + destinations: const [ + NavigationDestination( + icon: Icon(Icons.calendar_month_outlined), + selectedIcon: Icon(Icons.calendar_month), + label: 'Calendar', + ), + NavigationDestination( + icon: Icon(Icons.calendar_today_outlined), + selectedIcon: Icon(Icons.calendar_today), + label: 'Day', + ), + NavigationDestination( + icon: Icon(Icons.settings_outlined), + selectedIcon: Icon(Icons.settings), + label: 'Day', + ), + ]) + : null, + body: Row( + mainAxisSize: MainAxisSize.max, + children: [ + if (MediaQuery.of(context).size.width >= 600) + SafeArea( + child: NavigationRail( + labelType: labelType, + elevation: 4, + leading: leading, + backgroundColor: ElevationOverlay.applySurfaceTint( + Theme.of(context).cardColor, + Theme.of(context).colorScheme.surfaceTint, + 1), + extended: extendedValue, + destinations: const [ + NavigationRailDestination( + icon: Icon(Icons.calendar_month_outlined), + selectedIcon: Icon(Icons.calendar_month), + label: Text('Calendar'), + ), + NavigationRailDestination( + icon: Icon(Icons.calendar_today_outlined), + selectedIcon: Icon(Icons.calendar_today), + label: Text('Day'), + ), + NavigationRailDestination( + icon: Icon(Icons.settings_outlined), + selectedIcon: Icon(Icons.settings), + label: Text('Settings'), + ), + NavigationRailDestination( + icon: Icon(Icons.edit), + selectedIcon: Icon(Icons.edit), + label: Text('Edit'), + ) + ], + selectedIndex: _selectedTab, + onDestinationSelected: (value) { + setState(() { + _selectedTab = value; + }); + }, + ), + ), + Expanded( + child: Container( + color: Theme.of(context).colorScheme.primaryContainer, + child: _getScreen(context, _selectedTab), + ), + ), + ], + ), + ); + }); } } @@ -134,6 +212,8 @@ 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'); } diff --git a/lib/pages/calendar.dart b/lib/pages/calendar.dart index c0ac9c4..14a695d 100644 --- a/lib/pages/calendar.dart +++ b/lib/pages/calendar.dart @@ -44,11 +44,6 @@ class _CalendarScreenState extends State { DateFormat("dd MMM yyyy").format(endDate).toString(); return Scaffold( - appBar: AppBar( - title: const Text("Calendar Calculator"), - elevation: 4, - shadowColor: Theme.of(context).shadowColor, - ), body: _selectedDateRange == null ? const Padding( padding: EdgeInsets.all(30), diff --git a/lib/pages/day.dart b/lib/pages/day.dart index e7a5c4e..ad34bfc 100644 --- a/lib/pages/day.dart +++ b/lib/pages/day.dart @@ -48,11 +48,6 @@ class _DayScreenState extends State { DateFormat("EEEE, d MMM yyyy").format(DateTime.now()).toString(); return Scaffold( - appBar: AppBar( - title: const Text("Day Calculator"), - elevation: 4, - shadowColor: Theme.of(context).shadowColor, - ), body: _selectedDate == null ? const Padding( padding: EdgeInsets.all(30), diff --git a/lib/pages/settings.dart b/lib/pages/settings.dart index 712670b..219e23f 100644 --- a/lib/pages/settings.dart +++ b/lib/pages/settings.dart @@ -1,6 +1,8 @@ +import 'package:dateapp/widgets/dialogs/community.dart'; import 'package:flutter/material.dart'; -import '../widgets/license.dart'; -import '../constants/info.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import '../widgets/dialogs/about.dart'; class SettingsScreen extends StatelessWidget { const SettingsScreen({Key? key}) : super(key: key); @@ -19,11 +21,6 @@ class _Body extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: const Text("Settings"), - elevation: 4, - shadowColor: Theme.of(context).shadowColor, - ), body: Column( children: [ Expanded( @@ -49,106 +46,64 @@ class _ListItem extends StatelessWidget { @override Widget build(BuildContext context) { - return DecoratedBox( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - ), - child: Column( - children: [ - Card( - elevation: 4.0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0)), - margin: const EdgeInsets.all(8.0), - child: InkWell( - onTap: () => _dialogBuilder(context), - borderRadius: BorderRadius.circular(10.0), + return Column( + children: [ + Card( + elevation: 4.0, + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)), + margin: const EdgeInsets.all(8.0), + child: Column( + children: [ + InkWell( + onTap: () async { + await launchUrl( + Uri.parse( + 'https://git.winscloud.net/WinsDominoes/dateapp'), + mode: LaunchMode.externalApplication); + }, + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(10.0), + topRight: Radius.circular(10.0)), child: const ListTile( - leading: Icon(Icons.info_outlined), - title: Text("About"), - ), - )) - ], - ), - ); - } -} - -class _PageButton extends StatelessWidget { - const _PageButton(); - - @override - Widget build(BuildContext context) { - return SafeArea( - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: ElevatedButton( - onPressed: () {}, - child: const Text("Some Button"), - ), - ), - ); - } -} - -Future _dialogBuilder(BuildContext context) { - return showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Row( - children: [ - 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 - ) + leading: Icon(Icons.code), + title: Text("Source Code"), + trailing: Wrap( + // space between two icons + children: [ + Icon(Icons.open_in_new), // icon-1// icon-2 + ], ), - ], + ), ), - ) - ] - ), - content: const Text( - 'Date Calculator by WinsDominoes and AtiusAmy' - ), - actions: [ - TextButton( - style: TextButton.styleFrom( - textStyle: Theme.of(context).textTheme.labelLarge, - ), - child: const Text('View Licenses'), - onPressed: () { - Navigator.push(context, MaterialPageRoute(builder: (context) => LicensePageCustom())); - }, + const Divider( + height: 1.0, + ), + InkWell( + onTap: () => communityDialogBuilder(context), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(10.0), + bottomRight: Radius.circular(10.0)), + child: const ListTile( + leading: Icon(Icons.people), + title: Text("Join Community"), + )), + ], ), - TextButton( - style: TextButton.styleFrom( - textStyle: Theme.of(context).textTheme.labelLarge, - ), - child: const Text('Close'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }, - ); + ), + Card( + elevation: 4.0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0)), + margin: const EdgeInsets.all(8.0), + child: InkWell( + onTap: () => aboutDialogBuilder(context), + child: const ListTile( + leading: Icon(Icons.info_outlined), + title: Text("About"), + ), + )) + ], + ); + } } - diff --git a/lib/pages/test.dart b/lib/pages/test.dart new file mode 100644 index 0000000..9e6c244 --- /dev/null +++ b/lib/pages/test.dart @@ -0,0 +1,37 @@ +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 _launchUrl() async { + if (!await launchUrl(_url)) { + throw Exception('Could not launch $_url'); + } +} diff --git a/lib/widgets/dialogs/about.dart b/lib/widgets/dialogs/about.dart new file mode 100644 index 0000000..4ad8d16 --- /dev/null +++ b/lib/widgets/dialogs/about.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import '../license.dart'; +import '../../constants/info.dart'; + +Future aboutDialogBuilder(BuildContext context) { + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Row(children: [ + 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)), + ], + ), + ) + ]), + content: const Text('Date Calculator by WinsDominoes and AtiusAmy'), + actions: [ + 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(); + }, + ), + ], + ); + }, + ); +} diff --git a/lib/widgets/dialogs/community.dart b/lib/widgets/dialogs/community.dart new file mode 100644 index 0000000..6db88eb --- /dev/null +++ b/lib/widgets/dialogs/community.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import '../license.dart'; +import '../../constants/info.dart'; + +Future communityDialogBuilder(BuildContext context) { + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Row(children: [ + 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)), + ], + ), + ) + ]), + content: const Text('Date Calculator by WinsDominoes and AtiusAmy'), + actions: [ + 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(); + }, + ), + ], + ); + }, + ); +} diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 675b719..fe56f8d 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -7,9 +7,13 @@ #include "generated_plugin_registrant.h" #include +#include void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) dynamic_color_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 3e303c1..1836621 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST dynamic_color + url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/linux/net.winscloud.DateCalculator.appdata.xml b/linux/net.winscloud.DateCalculator.appdata.xml index 6df51d6..c480b3f 100644 --- a/linux/net.winscloud.DateCalculator.appdata.xml +++ b/linux/net.winscloud.DateCalculator.appdata.xml @@ -5,7 +5,7 @@ Date Calculator The go-to minimal date calculator https://datecalculator.winscloud.net - https://github.com/WinsDominoes/dateapp/issues + https://git.winscloud.net/WinsDominoes/dateapp/issues MIT LGPL-2.1 @@ -42,6 +42,10 @@ + + + + diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 507ed46..6c46e44 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,7 +6,9 @@ import FlutterMacOS import Foundation import dynamic_color +import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) } diff --git a/pubspec.yaml b/pubspec.yaml index 0d2096a..bb669a6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: dateapp description: "An app to calculate differences between two dates" # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -16,10 +16,11 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.0.6 +version: 0.0.7 environment: - sdk: '>=3.2.5 <4.0.0' + flutter: ">=3.13.0" + sdk: ">=3.1.0 <4.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -31,7 +32,7 @@ dependencies: flutter: sdk: flutter flutter_localizations: # Add this line - sdk: flutter # Add this line + sdk: flutter # Add this line # App dynamic color theme dynamic_color: ^1.6.8 @@ -40,9 +41,8 @@ dependencies: cupertino_icons: ^1.0.2 intl: ^0.18.1 flutter_native_splash: ^2.2.17 - sidebar_drawer: ^0.0.1+2 - flutter_adaptive_scaffold: ^0.1.7+2 - adaptive_navigation: ^0.0.4 + flutter_svg: ^2.0.10+1 + url_launcher: 6.2.5 dev_dependencies: flutter_test: @@ -72,7 +72,6 @@ msix_config: # The following section is specific to Flutter packages. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. @@ -80,7 +79,8 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - - assets/app_icons/icon.png + - assets/app_icons/icon.png + - assets/app_icons/net.winscloud.Datecalculator.svg # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index e4899a6..5ec53c0 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,8 +7,11 @@ #include "generated_plugin_registrant.h" #include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { DynamicColorPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 841e8c4..a311f66 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST dynamic_color + url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST