From f5181822a84bc3339180261177b2873ce4ce1a03 Mon Sep 17 00:00:00 2001 From: infiniteoverflow Date: Thu, 7 Oct 2021 21:25:17 +0530 Subject: [PATCH 1/4] Fixed continuos loading bug in auth screen --- lib/screens/auth_screen.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index 3fed7f00d..02ac7057f 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -148,7 +148,12 @@ class _AuthCardState extends State { } on WgerHttpException catch (error) { showHttpExceptionErrorDialog(error, context); } catch (error) { - showErrorDialog(error, context); + final statusCode = await showErrorDialog(error, context); + if(statusCode == false) { + setState(() { + _isLoading = false; + }); + } } } From 9258810e00c1a65e25da45011a1e72f510223abf Mon Sep 17 00:00:00 2001 From: infiniteoverflow Date: Thu, 7 Oct 2021 21:27:48 +0530 Subject: [PATCH 2/4] Fixed continuos loading bug in auth screen --- lib/helpers/ui.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/helpers/ui.dart b/lib/helpers/ui.dart index cf305dd31..5ca809222 100644 --- a/lib/helpers/ui.dart +++ b/lib/helpers/ui.dart @@ -22,12 +22,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:wger/exceptions/http_exception.dart'; -void showErrorDialog(dynamic exception, BuildContext context) { +Future showErrorDialog(dynamic exception, BuildContext context) async{ log('showErrorDialog: '); log(exception.toString()); log('====================='); - showDialog( + final statusCode = await showDialog( context: context, builder: (ctx) => AlertDialog( title: Text(AppLocalizations.of(context).anErrorOccurred), @@ -36,12 +36,18 @@ void showErrorDialog(dynamic exception, BuildContext context) { TextButton( child: Text(MaterialLocalizations.of(context).closeButtonLabel), onPressed: () { - Navigator.of(ctx).pop(); + Navigator.of(ctx).pop(-1); }, ) ], ), ); + + if(statusCode == -1) { + return false; + } else { + return true; + } } void showHttpExceptionErrorDialog(WgerHttpException exception, BuildContext context) async { From 555e873a2f3580d6c289fe5be3c66fbdbd4b4ad5 Mon Sep 17 00:00:00 2001 From: infiniteoverflow Date: Thu, 7 Oct 2021 21:33:39 +0530 Subject: [PATCH 3/4] Fixed the infinite loader bug --- lib/helpers/ui.dart | 12 +++--------- lib/screens/auth_screen.dart | 10 ++++------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/lib/helpers/ui.dart b/lib/helpers/ui.dart index 5ca809222..cf305dd31 100644 --- a/lib/helpers/ui.dart +++ b/lib/helpers/ui.dart @@ -22,12 +22,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:wger/exceptions/http_exception.dart'; -Future showErrorDialog(dynamic exception, BuildContext context) async{ +void showErrorDialog(dynamic exception, BuildContext context) { log('showErrorDialog: '); log(exception.toString()); log('====================='); - final statusCode = await showDialog( + showDialog( context: context, builder: (ctx) => AlertDialog( title: Text(AppLocalizations.of(context).anErrorOccurred), @@ -36,18 +36,12 @@ Future showErrorDialog(dynamic exception, BuildContext context) async{ TextButton( child: Text(MaterialLocalizations.of(context).closeButtonLabel), onPressed: () { - Navigator.of(ctx).pop(-1); + Navigator.of(ctx).pop(); }, ) ], ), ); - - if(statusCode == -1) { - return false; - } else { - return true; - } } void showHttpExceptionErrorDialog(WgerHttpException exception, BuildContext context) async { diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index 02ac7057f..4a5545977 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -148,12 +148,10 @@ class _AuthCardState extends State { } on WgerHttpException catch (error) { showHttpExceptionErrorDialog(error, context); } catch (error) { - final statusCode = await showErrorDialog(error, context); - if(statusCode == false) { - setState(() { - _isLoading = false; - }); - } + showErrorDialog(error, context); + setState(() { + _isLoading = false; + }); } } From 3ca8a2ca7c3cac1501a4ff74de87ea2ae58f4fb1 Mon Sep 17 00:00:00 2001 From: infiniteoverflow Date: Thu, 7 Oct 2021 21:35:32 +0530 Subject: [PATCH 4/4] Fixed the infinite loader bug --- lib/screens/auth_screen.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index 4a5545977..153ff330a 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -147,6 +147,9 @@ class _AuthCardState extends State { }); } on WgerHttpException catch (error) { showHttpExceptionErrorDialog(error, context); + setState(() { + _isLoading = false; + }); } catch (error) { showErrorDialog(error, context); setState(() {