mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Press to retry server connection
This commit is contained in:
parent
37cdf23ae1
commit
31fc5cb80b
1 changed files with 15 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue