Guest User

Untitled

a guest
Jun 26th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. class RootContainer extends StatelessWidget {
  2. final Widget child;
  3.  
  4. RootContainer({this.child});
  5.  
  6. @override
  7. Widget build(BuildContext context) {
  8. return StreamBuilder<OverlayAlert>(
  9. stream: ApiService.ThrottledException.stream,
  10. builder: (context, snapshot) {
  11.  
  12. if (snapshot.connectionState == ConnectionState.active) {
  13. Future.delayed(Duration.zero, () => showAlert(context, snapshot));
  14. }
  15.  
  16. return this.child;
  17. },
  18. );
  19. }
  20.  
  21. void showAlert(BuildContext context, snapshot) {
  22. print("showing dialog");
  23. showDialog(
  24. context: context,
  25. builder: (context) => OverlayAlertDialog(snapshot),
  26. );
  27. }
Advertisement
Add Comment
Please, Sign In to add comment