loading icon added

merge-requests/1/merge
Sikander Saleem 4 years ago
parent f1beefbc46
commit e3d331a223

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

@ -3,6 +3,7 @@ import 'package:fluttertoast/fluttertoast.dart';
// import 'package:fluttertoast/fluttertoast.dart'; // import 'package:fluttertoast/fluttertoast.dart';
import 'package:mohem_flutter_app/exceptions/api_exception.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.dart';
import 'package:mohem_flutter_app/widgets/loading_dialog.dart';
class Utils { class Utils {
static bool _isLoadingVisible = false; static bool _isLoadingVisible = false;
@ -33,13 +34,13 @@ class Utils {
static void showLoading(BuildContext context) { static void showLoading(BuildContext context) {
WidgetsBinding.instance?.addPostFrameCallback((_) { WidgetsBinding.instance?.addPostFrameCallback((_) {
_isLoadingVisible = true; _isLoadingVisible = true;
// showDialog( showDialog(
// context: context, context: context,
// barrierColor: ColorConsts.primaryBlack.withOpacity(0.5), barrierColor: Colors.black.withOpacity(0.5),
// builder: (BuildContext context) => LoadingDialog(), builder: (BuildContext context) => LoadingDialog(),
// ).then((value) { ).then((value) {
// _isLoadingVisible = false; _isLoadingVisible = false;
// }); });
}); });
} }

@ -44,19 +44,19 @@ class _LoginScreenState extends State<LoginScreen> {
} }
void performLogin() async { void performLogin() async {
// Utils.showLoading(context); Utils.showLoading(context);
try { try {
_checkMobileAppVersion = await LoginApiClient().checkMobileAppVersion(); _checkMobileAppVersion = await LoginApiClient().checkMobileAppVersion();
_memberLoginList = await LoginApiClient().memberLogin(username.text, password.text); _memberLoginList = await LoginApiClient().memberLogin(username.text, password.text);
AppState().setMemberLoginListModel = _memberLoginList; AppState().setMemberLoginListModel = _memberLoginList;
AppState().username = username.text; AppState().username = username.text;
print(_memberLoginList?.toJson()); print(_memberLoginList?.toJson());
// Utils.hideLoading(context); Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.verifyLogin); Navigator.pushNamed(context, AppRoutes.verifyLogin);
} catch (ex) { } catch (ex) {
print(ex); print(ex);
Utils.handleException(ex, null); Utils.handleException(ex, null);
// Utils.hideLoading(context); Utils.hideLoading(context);
} }
} }

@ -0,0 +1,47 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class LoadingDialog extends StatefulWidget {
LoadingDialog({Key? key}) : super(key: key);
@override
_LoadingDialogState createState() {
return _LoadingDialogState();
}
}
class _LoadingDialogState extends State<LoadingDialog> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Dialog(
insetPadding: const EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
elevation: 0,
backgroundColor: Colors.transparent,
child: Directionality(
textDirection: TextDirection.rtl,
child: Center(
child: Image.asset(
"assets/images/logos/loading_mohemm_logo.gif",
height: 96.0,
width: 96.0,
),
),
),
);
}
}
Loading…
Cancel
Save