wildanfuady

Untitled

Nov 14th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. Widget progressWidget() {
  2. if (_apiCall)
  3. // jika masih proses kirim API
  4. return AlertDialog(
  5. content: new Column(
  6. children: <Widget>[
  7. CircularProgressIndicator(),
  8. Text("Please wait")
  9. ],
  10. ),
  11. );
  12. else
  13. // jika sudah selesai kirim API
  14. return Center(
  15. child: Text(
  16. _response,
  17. style: new TextStyle(fontSize: 15.0),
  18. ),
  19. );
  20. }
  21.  
  22. Future<bool> getLoginStatus() async{
  23. final prefs = await SharedPreferences.getInstance();
  24. bool loginStatus = prefs.getBool('login') ?? false;
  25. print('login status $loginStatus');
  26. return loginStatus;
  27. }
  28.  
  29. @override
  30. Widget build(BuildContext context) {
  31. return FutureBuilder<bool>(
  32. future: getLoginStatus(),
  33. builder: (context, snapshot) {
  34. return (snapshot.data) ?
  35. // jika sudah login tampilkan list siswa
  36. new ListSiswa() :
  37. // jika belum login tampilkan form login
  38. loginForm();
  39. },
  40. );
  41. }
Advertisement
Add Comment
Please, Sign In to add comment