Partially #18. App name and app version as global const

This commit is contained in:
estevez 2018-09-17 01:03:34 +03:00
parent b1d426bafd
commit 0b359c9cdb
3 changed files with 17 additions and 6 deletions

View File

@ -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<MainPage> with WidgetsBindingObserver {
"/api/websocket";
String _hassioPassword = prefs.getString('hassio-password');
_dataModel = HassioDataModel(_hassioAPIEndpoint, _hassioPassword);
await _refreshData();
_refreshData();
eventBus.on<StateChangedEvent>().listen((event) {
debugPrint("State change event for ${event.entityId}");
setState(() {
@ -255,7 +258,7 @@ class _MainPageState extends State<MainPage> 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<MainPage> with WidgetsBindingObserver {
},
),
new AboutListTile(
applicationName: "Hass Client",
applicationVersion: "0.1",
applicationName: appName,
applicationVersion: appVersion,
applicationLegalese: "Keyboard Crumbs",
)
],

View File

@ -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:

View File

@ -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.