mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Display current build version on startup screen
This commit is contained in:
parent
2519adeef4
commit
54e37b3e69
16
lib/helpers/version_helper.dart
Normal file
16
lib/helpers/version_helper.dart
Normal file
@ -0,0 +1,16 @@
|
||||
import 'package:package_info/package_info.dart';
|
||||
|
||||
/// Application version helper
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
class VersionHelper {
|
||||
static PackageInfo _info;
|
||||
|
||||
static Future<void> ensureLoaded() async {
|
||||
_info = await PackageInfo.fromPlatform();
|
||||
}
|
||||
|
||||
/// Get current version information
|
||||
static PackageInfo get info => _info;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import 'package:comunic/helpers/account_helper.dart';
|
||||
import 'package:comunic/helpers/database/database_helper.dart';
|
||||
import 'package:comunic/helpers/preferences_helper.dart';
|
||||
import 'package:comunic/helpers/version_helper.dart';
|
||||
import 'package:comunic/ui/widgets/init_widget.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -12,6 +13,9 @@ import 'package:flutter/material.dart';
|
||||
void subMain() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// Load package information
|
||||
await VersionHelper.ensureLoaded();
|
||||
|
||||
// Connect to database
|
||||
await DatabaseHelper.open();
|
||||
await DatabaseHelper.cleanUpDatabase();
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:comunic/helpers/account_helper.dart';
|
||||
import 'package:comunic/helpers/events_helper.dart';
|
||||
import 'package:comunic/helpers/server_config_helper.dart';
|
||||
import 'package:comunic/helpers/version_helper.dart';
|
||||
import 'package:comunic/helpers/websocket_helper.dart';
|
||||
import 'package:comunic/ui/routes/login_route.dart';
|
||||
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||
@ -123,6 +124,11 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
|
||||
Spacer(
|
||||
flex: 2,
|
||||
),
|
||||
Text(tr("Version %version% - Build %build%", args: {
|
||||
"version": VersionHelper.info.version.toString(),
|
||||
"build": VersionHelper.info.buildNumber.toString()
|
||||
})),
|
||||
Spacer(flex: 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -332,7 +332,7 @@ packages:
|
||||
source: hosted
|
||||
version: "0.3.0"
|
||||
package_info:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: package_info
|
||||
url: "https://pub.dartlang.org"
|
||||
|
@ -85,6 +85,9 @@ dependencies:
|
||||
# Pick any kind of file
|
||||
file_picker_cross: ^4.2.8
|
||||
|
||||
# Get information about current version
|
||||
package_info: ^0.4.3+4
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
Loading…
Reference in New Issue
Block a user