Guest User

Untitled

a guest
Jan 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // _SearchBar Implementation
  2.  
  3. class _SearchBody extends StatelessWidget {
  4. final GithubSearchBloc githubSearchBloc;
  5.  
  6. const _SearchBody({Key key, this.githubSearchBloc}) : super(key: key);
  7.  
  8. @override
  9. Widget build(BuildContext context) {
  10. return BlocBuilder<GithubSearchEvent, GithubSearchState>(
  11. bloc: githubSearchBloc,
  12. builder: (BuildContext context, GithubSearchState state) {
  13. if (state is SearchStateEmpty) {
  14. return Text('Please enter a term to begin');
  15. }
  16. if (state is SearchStateLoading) {
  17. return CircularProgressIndicator();
  18. }
  19. if (state is SearchStateError) {
  20. return Text(state.error);
  21. }
  22. if (state is SearchStateSuccess) {
  23. return state.items.isEmpty
  24. ? Text('No Results')
  25. : Expanded(child: _SearchResults(items: state.items));
  26. }
  27. },
  28. );
  29. }
  30. }
Add Comment
Please, Sign In to add comment