Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // _SearchBar Implementation
- class _SearchBody extends StatelessWidget {
- final GithubSearchBloc githubSearchBloc;
- const _SearchBody({Key key, this.githubSearchBloc}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return BlocBuilder<GithubSearchEvent, GithubSearchState>(
- bloc: githubSearchBloc,
- builder: (BuildContext context, GithubSearchState state) {
- if (state is SearchStateEmpty) {
- return Text('Please enter a term to begin');
- }
- if (state is SearchStateLoading) {
- return CircularProgressIndicator();
- }
- if (state is SearchStateError) {
- return Text(state.error);
- }
- if (state is SearchStateSuccess) {
- return state.items.isEmpty
- ? Text('No Results')
- : Expanded(child: _SearchResults(items: state.items));
- }
- },
- );
- }
- }
Add Comment
Please, Sign In to add comment