2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Press to retry server connection

This commit is contained in:
Oliver Walters 2020-04-06 22:37:40 +10:00
parent 37cdf23ae1
commit 31fc5cb80b

View File

@ -151,6 +151,13 @@ class _MyHomePageState extends State<MyHomePage> {
_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<MyHomePage> {
onConnectFailure(fault);
});
// Update widget state
setState(() {});
}
void _search() {
@ -358,6 +368,11 @@ class _MyHomePageState extends State<MyHomePage> {
style: TextStyle(color: _serverStatusColor),
),
leading: _serverIcon,
onTap: () {
if (!_serverConnection) {
_checkServerConnection();
}
},
),
),
],