diff --git a/lib/logPage.dart b/lib/logPage.dart index 9bf7fd2..4355e82 100644 --- a/lib/logPage.dart +++ b/lib/logPage.dart @@ -15,6 +15,7 @@ class _LogViewPageState extends State { String _hassioPassword = ""; String _socketProtocol = "wss"; String _authType = "access_token"; + String _logData; @override void initState() { @@ -23,7 +24,7 @@ class _LogViewPageState extends State { } _loadLog() async { - // + _logData = TheLogger.getLog(); } @override @@ -36,12 +37,28 @@ class _LogViewPageState extends State { // Here we take the value from the MyHomePage object that was created by // the App.build method, and use it to set our appbar title. title: new Text(widget.title), + actions: [ + IconButton( + icon: Icon(Icons.content_copy), + onPressed: () { + Clipboard.setData(new ClipboardData(text: _logData)); + }, + ), + IconButton( + icon: Icon(MaterialDesignIcons.createIconDataFromIconName("mdi:github-circle")), + onPressed: () { + String body = "```\n$_logData```"; + String encodedBody = "${Uri.encodeFull(body)}"; + haUtils.launchURL("https://github.com/estevez-dev/ha_client_pub/issues/new?body=$encodedBody"); + }, + ), + ], ), body: TextField( maxLines: null, controller: TextEditingController( - text: TheLogger.getLog() + text: _logData ), ) ); diff --git a/lib/main.dart b/lib/main.dart index 9e3d6a6..b4b6aa5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,6 +9,7 @@ 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'; +import 'package:flutter/services.dart'; part 'settingsPage.dart'; part 'data_model.dart';