diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index c30cbb8..7a08e92 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; @@ -17,6 +18,20 @@ class SettingsScreen extends StatefulWidget { class _SettingsScreenState extends State { bool _showBatteryVoltage = false; + String _appVersion = '...'; + + @override + void initState() { + super.initState(); + _loadVersionInfo(); + } + + Future _loadVersionInfo() async { + final packageInfo = await PackageInfo.fromPlatform(); + setState(() { + _appVersion = packageInfo.version; + }); + } @override Widget build(BuildContext context) { @@ -240,7 +255,7 @@ class _SettingsScreenState extends State { child: ListTile( leading: const Icon(Icons.info_outline), title: const Text('About'), - subtitle: const Text('MeshCore Open v0.1.0'), + subtitle: Text('MeshCore Open v$_appVersion'), onTap: () => _showAbout(context), ), ); @@ -533,7 +548,7 @@ class _SettingsScreenState extends State { showAboutDialog( context: context, applicationName: 'MeshCore Open', - applicationVersion: '0.1.0', + applicationVersion: _appVersion, applicationLegalese: '2024 MeshCore Open Source Project', children: [ const SizedBox(height: 16), diff --git a/pubspec.lock b/pubspec.lock index 66c8391..d8c54e8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -465,13 +465,13 @@ packages: source: hosted version: "2.1.0" package_info_plus: - dependency: transitive + dependency: "direct main" description: name: package_info_plus - sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d + sha256: "16eee997588c60225bda0488b6dcfac69280a6b7a3cf02c741895dd370a02968" url: "https://pub.dev" source: hosted - version: "9.0.0" + version: "8.3.1" package_info_plus_platform_interface: dependency: transitive description: @@ -817,10 +817,10 @@ packages: dependency: "direct main" description: name: wakelock_plus - sha256: "9296d40c9adbedaba95d1e704f4e0b434be446e2792948d0e4aa977048104228" + sha256: "61713aa82b7f85c21c9f4cd0a148abd75f38a74ec645fcb1e446f882c82fd09b" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.3.3" wakelock_plus_platform_interface: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 41b4d24..a7db1bb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ 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: 1.0.0+1 +version: 0.2.0+2 environment: sdk: ^3.9.2 @@ -49,6 +49,7 @@ dependencies: flutter_foreground_task: ^6.1.2 wakelock_plus: ^1.2.8 characters: ^1.4.0 + package_info_plus: ^8.0.0 dev_dependencies: flutter_test: