feat: new refined about page, update checker only check for same update channel

This commit is contained in:
Kingkor Roy Tirtho 2022-12-09 18:03:41 +06:00
parent 90c1200a08
commit 4cadfa9375
10 changed files with 211 additions and 70 deletions

View File

@ -61,7 +61,7 @@ Following are the features that currently spotube offers:
# Support this project # Support this project
<a href="https://patreon.com/krtirtho"><img src="https://user-images.githubusercontent.com/61944859/180249027-678b01b8-c336-451e-b147-6d84a5b9d0e7.png" width="250"/></a> <a href="https://patreon.com/krtirtho"><img src="https://user-images.githubusercontent.com/61944859/180249027-678b01b8-c336-451e-b147-6d84a5b9d0e7.png" width="250"/></a>
[!["Donate to out Collective"](https://opencollective.com/webpack/donate/button.png?color=blue)](https://opencollective.com/spotube) [!["Donate to out Collective"](https://opencollective.com/spotube/donate/button.png?color=blue)](https://opencollective.com/spotube)
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/krtirtho) [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/krtirtho)
# Installation # Installation

View File

@ -1,6 +1,7 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:spotify/spotify.dart' hide Search; import 'package:spotify/spotify.dart' hide Search;
import 'package:spotube/pages/settings/about.dart';
import 'package:spotube/utils/platform.dart'; import 'package:spotube/utils/platform.dart';
import 'package:spotube/components/shared/spotube_page_route.dart'; import 'package:spotube/components/shared/spotube_page_route.dart';
import 'package:spotube/pages/album/album.dart'; import 'package:spotube/pages/album/album.dart';
@ -54,6 +55,14 @@ final router = GoRouter(
pageBuilder: (context, state) => SpotubePage( pageBuilder: (context, state) => SpotubePage(
child: const SettingsPage(), child: const SettingsPage(),
), ),
routes: [
GoRoute(
path: "about",
pageBuilder: (context, state) => SpotubePage(
child: const AboutSpotube(),
),
),
],
), ),
GoRoute( GoRoute(
path: "/album/:id", path: "/album/:id",

View File

@ -51,7 +51,10 @@ void useUpdateChecker(WidgetRef ref) {
checkUpdate().then((value) { checkUpdate().then((value) {
final currentVersion = value.first; final currentVersion = value.first;
final latestVersion = value.last; final latestVersion = value.last;
if (currentVersion == null || latestVersion == null) return; if (currentVersion == null ||
latestVersion == null ||
(latestVersion.isPreRelease && !currentVersion.isPreRelease) ||
(!latestVersion.isPreRelease && currentVersion.isPreRelease)) return;
if (latestVersion <= currentVersion) return; if (latestVersion <= currentVersion) return;
showPlatformAlertDialog( showPlatformAlertDialog(
context, context,

View File

@ -1,9 +1,185 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:platform_ui/platform_ui.dart'; import 'package:platform_ui/platform_ui.dart';
import 'package:spotube/components/shared/links/hyper_link.dart'; import 'package:spotube/components/shared/page_window_title_bar.dart';
import 'package:spotube/hooks/use_package_info.dart'; import 'package:spotube/hooks/use_package_info.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
class AboutSpotube extends HookConsumerWidget {
const AboutSpotube({Key? key}) : super(key: key);
@override
Widget build(BuildContext context, ref) {
final packageInfo = usePackageInfo();
return PlatformScaffold(
appBar: PageWindowTitleBar(
leading: const PlatformBackButton(),
title: const PlatformText("About Wives"),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
children: [
Image.asset(
"assets/spotube-logo.png",
height: 200,
width: 200,
),
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PlatformText.headline(
"Spotube, a light-weight, cross-platform, free-for-all spotify client",
),
const SizedBox(height: 20),
Row(
mainAxisSize: MainAxisSize.min,
children: [
PlatformText.subheading(
"Founder: Kingkor Roy Tirtho",
),
const SizedBox(width: 5),
CircleAvatar(
radius: 20,
child: ClipOval(
child: Image.network(
"https://avatars.githubusercontent.com/u/61944859?v=4",
),
),
),
],
),
const SizedBox(height: 5),
PlatformText(
"Version: v${packageInfo.version}",
),
const SizedBox(height: 5),
InkWell(
onTap: () {
launchUrlString(
"https://github.com/KRTirtho/spotube",
mode: LaunchMode.externalApplication,
);
},
child: const PlatformText(
"Repository: https://github.com/KRTirtho/spotube",
),
),
const SizedBox(height: 5),
InkWell(
onTap: () {
launchUrlString(
"https://raw.githubusercontent.com/KRTirtho/spotube/main/LICENSE",
mode: LaunchMode.externalApplication,
);
},
child: const PlatformText(
"License: BSD-4-Clause",
),
),
const SizedBox(height: 5),
InkWell(
onTap: () {
launchUrlString(
"https://github.com/KRTirtho/spotube/issues",
mode: LaunchMode.externalApplication,
);
},
child: const PlatformText(
"Bugs+Issues: https://github.com/KRTirtho/spotube/issues",
),
),
],
),
),
const SizedBox(height: 20),
Wrap(
runSpacing: 20,
spacing: 20,
alignment: WrapAlignment.center,
crossAxisAlignment: WrapCrossAlignment.center,
runAlignment: WrapAlignment.center,
children: [
MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
launchUrl(
Uri.parse("https://www.buymeacoffee.com/krtirtho"),
mode: LaunchMode.externalApplication,
);
},
child: SvgPicture.network(
"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=krtirtho&button_colour=FF5F5F&font_colour=ffffff&font_family=Inter&outline_colour=000000&coffee_colour=FFDD00",
height: 45,
),
),
),
MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
launchUrl(
Uri.parse(
"https://opencollective.com/spotube",
),
mode: LaunchMode.externalApplication,
);
},
child: Image.network(
"https://opencollective.com/spotube/donate/button.png?color=blue",
height: 45,
),
),
),
MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
launchUrl(
Uri.parse("https://patreon.com/krtirtho"),
mode: LaunchMode.externalApplication,
);
},
child: Image.network(
"https://user-images.githubusercontent.com/61944859/180249027-678b01b8-c336-451e-b147-6d84a5b9d0e7.png",
height: 45,
),
),
),
],
),
const SizedBox(height: 20),
PlatformText.caption(
"Made with ❤️ in Bangladesh🇧🇩",
textAlign: TextAlign.center,
),
PlatformText.caption(
"© 2021-${DateTime.now().year} Kingkor Roy Tirtho",
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 750),
child: PlatformText.caption(
licenseText,
textAlign: TextAlign.justify,
),
),
],
),
),
),
);
}
}
const licenseText = """ const licenseText = """
BSD-4-Clause License BSD-4-Clause License
@ -18,68 +194,3 @@ This product includes software developed by Kingkor Roy Tirtho.
4. Neither the name of the Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 4. Neither the name of the Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY KINGKOR ROY TIRTHO AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KINGKOR ROY TIRTHO AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE IS PROVIDED BY KINGKOR ROY TIRTHO AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KINGKOR ROY TIRTHO AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""; """;
class About extends HookWidget {
const About({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final info = usePackageInfo(
appName: "Spotube",
packageName: "oss.krtirtho.Spotube",
version: "2.5.0",
);
return PlatformListTile(
leading: const Icon(Icons.info_outline_rounded),
title: PlatformText(
"About Spotube",
style: PlatformTextTheme.of(context).body,
),
onTap: () {
showAboutDialog(
context: context,
applicationIcon:
CircleAvatar(child: Image.asset("assets/spotube-logo.png")),
applicationName: "Spotube",
applicationVersion: info.version,
applicationLegalese: licenseText,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
PlatformText("Author: "),
Hyperlink(
"Kingkor Roy Tirtho",
"https://github.com/KRTirtho",
),
],
),
const SizedBox(height: 20),
Wrap(
alignment: WrapAlignment.center,
children: const [
Hyperlink(
"💚 Sponsor/Donate 💚",
"https://opencollective.com/spotube",
),
PlatformText(""),
Hyperlink(
"BSD-4-Clause LICENSE",
"https://github.com/KRTirtho/spotube/blob/master/LICENSE",
),
PlatformText(""),
Hyperlink(
"Bug Report",
"https://github.com/KRTirtho/spotube/issues/new?assignees=&labels=bug&template=bug_report.md&title=",
),
],
),
const SizedBox(height: 10),
const Center(
child: PlatformText("© Spotube 2022. All rights reserved"))
]);
},
);
}
}

View File

@ -535,7 +535,14 @@ class SettingsPage extends HookConsumerWidget {
preferences.setCheckUpdate(checked), preferences.setCheckUpdate(checked),
), ),
), ),
const About() PlatformListTile(
leading: const Icon(Icons.info_outline_rounded),
title: const PlatformText("About Spotube"),
trailing: const Icon(Icons.arrow_forward_ios_rounded),
onTap: () {
GoRouter.of(context).push("/settings/about");
},
),
], ],
), ),
), ),

View File

@ -8,6 +8,7 @@
#include <audioplayers_linux/audioplayers_linux_plugin.h> #include <audioplayers_linux/audioplayers_linux_plugin.h>
#include <bitsdojo_window_linux/bitsdojo_window_plugin.h> #include <bitsdojo_window_linux/bitsdojo_window_plugin.h>
#include <flutter_acrylic/flutter_acrylic_plugin.h>
#include <metadata_god/metadata_god_plugin.h> #include <metadata_god/metadata_god_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
@ -18,6 +19,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) bitsdojo_window_linux_registrar = g_autoptr(FlPluginRegistrar) bitsdojo_window_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "BitsdojoWindowPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "BitsdojoWindowPlugin");
bitsdojo_window_plugin_register_with_registrar(bitsdojo_window_linux_registrar); bitsdojo_window_plugin_register_with_registrar(bitsdojo_window_linux_registrar);
g_autoptr(FlPluginRegistrar) flutter_acrylic_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterAcrylicPlugin");
flutter_acrylic_plugin_register_with_registrar(flutter_acrylic_registrar);
g_autoptr(FlPluginRegistrar) metadata_god_registrar = g_autoptr(FlPluginRegistrar) metadata_god_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "MetadataGodPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "MetadataGodPlugin");
metadata_god_plugin_register_with_registrar(metadata_god_registrar); metadata_god_plugin_register_with_registrar(metadata_god_registrar);

View File

@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
audioplayers_linux audioplayers_linux
bitsdojo_window_linux bitsdojo_window_linux
flutter_acrylic
metadata_god metadata_god
url_launcher_linux url_launcher_linux
) )

View File

@ -10,6 +10,7 @@ import audio_session
import audioplayers_darwin import audioplayers_darwin
import bitsdojo_window_macos import bitsdojo_window_macos
import connectivity_plus_macos import connectivity_plus_macos
import flutter_acrylic
import macos_ui import macos_ui
import metadata_god import metadata_god
import package_info_plus_macos import package_info_plus_macos
@ -24,6 +25,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin")) AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin")) BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin"))
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
FlutterAcrylicPlugin.register(with: registry.registrar(forPlugin: "FlutterAcrylicPlugin"))
MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin")) MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin"))
MetadataGodPlugin.register(with: registry.registrar(forPlugin: "MetadataGodPlugin")) MetadataGodPlugin.register(with: registry.registrar(forPlugin: "MetadataGodPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))

View File

@ -9,6 +9,7 @@
#include <audioplayers_windows/audioplayers_windows_plugin.h> #include <audioplayers_windows/audioplayers_windows_plugin.h>
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h> #include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
#include <connectivity_plus_windows/connectivity_plus_windows_plugin.h> #include <connectivity_plus_windows/connectivity_plus_windows_plugin.h>
#include <flutter_acrylic/flutter_acrylic_plugin.h>
#include <metadata_god/metadata_god_plugin_c_api.h> #include <metadata_god/metadata_god_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h> #include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
@ -20,6 +21,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("BitsdojoWindowPlugin")); registry->GetRegistrarForPlugin("BitsdojoWindowPlugin"));
ConnectivityPlusWindowsPluginRegisterWithRegistrar( ConnectivityPlusWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
FlutterAcrylicPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterAcrylicPlugin"));
MetadataGodPluginCApiRegisterWithRegistrar( MetadataGodPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("MetadataGodPluginCApi")); registry->GetRegistrarForPlugin("MetadataGodPluginCApi"));
PermissionHandlerWindowsPluginRegisterWithRegistrar( PermissionHandlerWindowsPluginRegisterWithRegistrar(

View File

@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
audioplayers_windows audioplayers_windows
bitsdojo_window_windows bitsdojo_window_windows
connectivity_plus_windows connectivity_plus_windows
flutter_acrylic
metadata_god metadata_god
permission_handler_windows permission_handler_windows
url_launcher_windows url_launcher_windows