Merge branch 'development_sikander' into 'master'

loading icon added

See merge request mirza.shafique/mohem_flutter_app!9
merge-requests/1/merge
Sikander Saleem 4 years ago
commit d484c44edc

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

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