Resolves #86 #89: Add 'copy to lipboard' and 'post to github' to log

This commit is contained in:
estevez 2018-09-25 22:11:31 +03:00
parent 7e4f744598
commit 5db9d6005f
2 changed files with 20 additions and 2 deletions

View File

@ -15,6 +15,7 @@ class _LogViewPageState extends State<LogViewPage> {
String _hassioPassword = "";
String _socketProtocol = "wss";
String _authType = "access_token";
String _logData;
@override
void initState() {
@ -23,7 +24,7 @@ class _LogViewPageState extends State<LogViewPage> {
}
_loadLog() async {
//
_logData = TheLogger.getLog();
}
@override
@ -36,12 +37,28 @@ class _LogViewPageState extends State<LogViewPage> {
// 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: <Widget>[
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
),
)
);

View File

@ -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';