From 31fc5cb80b2fe0eebd18fc7706c5f922cee61c98 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 6 Apr 2020 22:37:40 +1000 Subject: [PATCH] Press to retry server connection --- lib/main.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/main.dart b/lib/main.dart index ac1cc7a2..555639b3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -151,6 +151,13 @@ class _MyHomePageState extends State { _serverAddress = prefs.getString("server"); + // Reset the connection status variables + _serverStatus = "Connecting to server"; + _serverMessage = ""; + _serverConnection = false; + _serverIcon = new FaIcon(FontAwesomeIcons.spinner); + _serverStatusColor = Color.fromARGB(255, 50, 50, 250); + InvenTreeAPI().connect().then((bool result) { if (result) { @@ -176,6 +183,9 @@ class _MyHomePageState extends State { onConnectFailure(fault); }); + + // Update widget state + setState(() {}); } void _search() { @@ -358,6 +368,11 @@ class _MyHomePageState extends State { style: TextStyle(color: _serverStatusColor), ), leading: _serverIcon, + onTap: () { + if (!_serverConnection) { + _checkServerConnection(); + } + }, ), ), ],