From 0b359c9cdb9b140cf936abf0e5a2f7edcd137ef1 Mon Sep 17 00:00:00 2001 From: estevez Date: Mon, 17 Sep 2018 01:03:34 +0300 Subject: [PATCH] Partially #18. App name and app version as global const --- lib/main.dart | 13 ++++++++----- pubspec.lock | 7 +++++++ pubspec.yaml | 3 ++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index f012734..ab52f61 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,11 +9,14 @@ import 'package:web_socket_channel/status.dart' as socketStatus; import 'package:progress_indicators/progress_indicators.dart'; import 'package:event_bus/event_bus.dart'; import 'package:flutter/widgets.dart'; +import 'package:package_info/package_info.dart'; part 'settings.dart'; part 'data_model.dart'; EventBus eventBus = new EventBus(); +const String appName = "Home Assistant Client"; +const appVersion = "0.0.5"; void main() => runApp(new HassClientApp()); @@ -22,7 +25,7 @@ class HassClientApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( - title: 'Hass Client', + title: appName, theme: new ThemeData( primarySwatch: Colors.blue, ), @@ -88,7 +91,7 @@ class _MainPageState extends State with WidgetsBindingObserver { "/api/websocket"; String _hassioPassword = prefs.getString('hassio-password'); _dataModel = HassioDataModel(_hassioAPIEndpoint, _hassioPassword); - await _refreshData(); + _refreshData(); eventBus.on().listen((event) { debugPrint("State change event for ${event.entityId}"); setState(() { @@ -255,7 +258,7 @@ class _MainPageState extends State with WidgetsBindingObserver { Widget _buildTitle() { Row titleRow = Row( - children: [Text(_instanceConfig != null ? _instanceConfig["location_name"] : "...")], + children: [Text(_instanceConfig != null ? _instanceConfig["location_name"] : "")], ); if (loading) { titleRow.children.add(Padding( @@ -286,8 +289,8 @@ class _MainPageState extends State with WidgetsBindingObserver { }, ), new AboutListTile( - applicationName: "Hass Client", - applicationVersion: "0.1", + applicationName: appName, + applicationVersion: appVersion, applicationLegalese: "Keyboard Crumbs", ) ], diff --git a/pubspec.lock b/pubspec.lock index d1c4b37..7255e1b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -207,6 +207,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.5" + package_info: + dependency: "direct main" + description: + name: package_info + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.2" package_resolver: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 800bd32..afc4caa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ description: Home Assistant Android Client # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. # Read more about versioning at semver.org. -version: 0.0.5 +version: 0.0.5+14 environment: sdk: ">=2.0.0-dev.68.0 <3.0.0" @@ -18,6 +18,7 @@ dependencies: shared_preferences: any progress_indicators: ^0.1.2 event_bus: ^1.0.1 + package_info: ^0.3.2 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons.