Created
September 13, 2019 16:09
-
-
Save fayaz07/ac204c2c2fd21ca7322389dd783c3fb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:progress_dialog/progress_dialog.dart'; | |
ProgressDialog pr; | |
void main() { | |
runApp(MaterialApp( | |
home: MyApp(), | |
)); | |
} | |
class MyApp extends StatelessWidget { | |
double percentage = 0.0; | |
@override | |
Widget build(BuildContext context) { | |
pr = new ProgressDialog(context,type: ProgressDialogType.Normal); | |
pr.style(message: 'Showing some progress...'); | |
//Optional | |
pr.style( | |
message: 'Please wait...', | |
borderRadius: 10.0, | |
backgroundColor: Colors.white, | |
progressWidget: CircularProgressIndicator(), | |
elevation: 10.0, | |
insetAnimCurve: Curves.easeInOut, | |
progressTextStyle: TextStyle( | |
color: Colors.black, fontSize: 13.0, fontWeight: FontWeight.w400), | |
messageTextStyle: TextStyle( | |
color: Colors.black, fontSize: 19.0, fontWeight: FontWeight.w600), | |
); | |
return Scaffold( | |
body: Center( | |
child: RaisedButton( | |
child: Text( | |
'Show Dialog', | |
style: TextStyle(color: Colors.white), | |
), | |
color: Colors.blue, | |
onPressed: () { | |
pr.show(); | |
Future.delayed(Duration(seconds: 10)).then((onValue){ | |
print("PR status ${pr.isShowing()}" ); | |
if(pr.isShowing()) | |
pr.hide().then((isHidden) { | |
print(isHidden); | |
}); | |
print("PR status ${pr.isShowing()}" ); | |
}); | |
}), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment