Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Widget progressWidget() {
- if (_apiCall)
- // jika masih proses kirim API
- return AlertDialog(
- content: new Column(
- children: <Widget>[
- CircularProgressIndicator(),
- Text("Please wait")
- ],
- ),
- );
- else
- // jika sudah selesai kirim API
- return Center(
- child: Text(
- _response,
- style: new TextStyle(fontSize: 15.0),
- ),
- );
- }
- Future<bool> getLoginStatus() async{
- final prefs = await SharedPreferences.getInstance();
- bool loginStatus = prefs.getBool('login') ?? false;
- print('login status $loginStatus');
- return loginStatus;
- }
- @override
- Widget build(BuildContext context) {
- return FutureBuilder<bool>(
- future: getLoginStatus(),
- builder: (context, snapshot) {
- return (snapshot.data) ?
- // jika sudah login tampilkan list siswa
- new ListSiswa() :
- // jika belum login tampilkan form login
- loginForm();
- },
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment