From 60793dbf8914ce91abb26698ff0690d482aaad3f Mon Sep 17 00:00:00 2001 From: estevez Date: Mon, 24 Sep 2018 22:12:56 +0300 Subject: [PATCH] Add link to github in app drawer --- lib/main.dart | 9 +++++++++ lib/utils.dart | 11 +++++++++++ pubspec.lock | 7 +++++++ pubspec.yaml | 1 + 4 files changed, 28 insertions(+) create mode 100644 lib/utils.dart diff --git a/lib/main.dart b/lib/main.dart index 2920002..7743503 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -8,10 +8,12 @@ import 'package:progress_indicators/progress_indicators.dart'; import 'package:event_bus/event_bus.dart'; import 'package:flutter/widgets.dart'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:url_launcher/url_launcher.dart'; part 'settingsPage.dart'; part 'data_model.dart'; part 'logPage.dart'; +part 'utils.dart'; EventBus eventBus = new EventBus(); const String appName = "HA Client"; @@ -539,6 +541,13 @@ class _MainPageState extends State with WidgetsBindingObserver { Navigator.pushNamed(context, '/log-view'); }, ), + new ListTile( + leading: Icon(MaterialDesignIcons.createIconDataFromIconName("mdi:github-circle")), + title: Text("Reprot issue"), + onTap: () { + haUtils.launchURL("https://github.com/estevez-dev/ha_client_pub/issues/new"); + }, + ), new AboutListTile( applicationName: appName, applicationVersion: appVersion, diff --git a/lib/utils.dart b/lib/utils.dart new file mode 100644 index 0000000..183a9d9 --- /dev/null +++ b/lib/utils.dart @@ -0,0 +1,11 @@ +part of 'main.dart'; + +class haUtils { + static void launchURL(String url) async { + if (await canLaunch(url)) { + await launch(url); + } else { + TheLogger.log("Error", "Could not launch $url"); + } + } +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 94bf4b2..0f4e6b7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -424,6 +424,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.3" utf: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 6816d4c..5a6ba78 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,6 +15,7 @@ dependencies: package_info: ^0.3.2 flutter_launcher_icons: ^0.6.1 cached_network_image: ^0.4.1 + url_launcher: ^3.0.3 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons.