From 5deaf6d4a8d8dc351ff36dfe574d07322a153ca3 Mon Sep 17 00:00:00 2001 From: mhmdanas Date: Sun, 3 Jul 2022 16:42:38 +0300 Subject: [PATCH] [ui] remove `package_info_plus` dependency Benefits: - Fewer dependencies (yay!) - We now need to update the app version on new releases only in two places: `pubspec.yaml` and `lib/constants.dart`. I plan to create a release guide so we don't forget either when creating a new release[1]. [1]: https://github.com/Lacerte/clima/issues/285 --- lib/constants.dart | 7 ++++++ lib/ui/screens/about_screen.dart | 14 +++++------ pubspec.lock | 42 -------------------------------- pubspec.yaml | 1 - 4 files changed, 13 insertions(+), 51 deletions(-) create mode 100644 lib/constants.dart diff --git a/lib/constants.dart b/lib/constants.dart new file mode 100644 index 00000000..8c32e7db --- /dev/null +++ b/lib/constants.dart @@ -0,0 +1,7 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +const appVersion = '2.0.1'; diff --git a/lib/ui/screens/about_screen.dart b/lib/ui/screens/about_screen.dart index 4073c4b8..0d8ec843 100644 --- a/lib/ui/screens/about_screen.dart +++ b/lib/ui/screens/about_screen.dart @@ -4,6 +4,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +import 'package:clima/constants.dart'; import 'package:clima/ui/build_flavor.dart'; import 'package:clima/ui/widgets/dialogs/credits_dialog.dart'; import 'package:clima/ui/widgets/dialogs/help_and_feedback_dialog.dart'; @@ -12,7 +13,6 @@ import 'package:clima/ui/widgets/settings/settings_header.dart'; import 'package:clima/ui/widgets/settings/settings_tile.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:package_info_plus/package_info_plus.dart'; import 'package:url_launcher/url_launcher.dart'; class AboutScreen extends StatelessWidget { @@ -43,14 +43,14 @@ class AboutScreen extends StatelessWidget { ), SettingsTile( title: 'Changelog', - subtitle: 'Version 2.0.1', + subtitle: 'Version $appVersion', leading: Icon( Icons.new_releases_outlined, color: Theme.of(context).iconTheme.color, ), onTap: () => launchUrl( Uri.parse( - 'https://github.com/lacerte/clima/releases/tag/v2.0.1', + 'https://github.com/lacerte/clima/releases/tag/v$appVersion', ), ), ), @@ -75,13 +75,11 @@ class AboutScreen extends StatelessWidget { Icons.source_outlined, color: Theme.of(context).iconTheme.color, ), - onTap: () async { - final PackageInfo packageInfo = - await PackageInfo.fromPlatform(); + onTap: () { showLicensePage( context: context, - applicationName: packageInfo.appName, - applicationVersion: packageInfo.version, + applicationName: 'Clima', + applicationVersion: appVersion, ); }, ), diff --git a/pubspec.lock b/pubspec.lock index e483dee0..4b55e7da 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -478,48 +478,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" - package_info_plus: - dependency: "direct main" - description: - name: package_info_plus - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.2" - package_info_plus_linux: - dependency: transitive - description: - name: package_info_plus_linux - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.5" - package_info_plus_macos: - dependency: transitive - description: - name: package_info_plus_macos - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - package_info_plus_platform_interface: - dependency: transitive - description: - name: package_info_plus_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - package_info_plus_web: - dependency: transitive - description: - name: package_info_plus_web - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.5" - package_info_plus_windows: - dependency: transitive - description: - name: package_info_plus_windows - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.5" path: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 92250158..1367f485 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,7 +20,6 @@ dependencies: git: url: https://github.com/CentaurusApps/material_floating_search_bar.git ref: 07b2980ad304dacaa5688e56483adcec36fb08ab - package_info_plus: 1.4.2 riverpod: 1.0.3 shared_preferences: 2.0.15 font_awesome_flutter: 10.1.0