flutter news app
this example uses a customscrollview, json rest api, bottonnavigationbar,sliverlist, cliprrect, card, progress indicator, networkimage, card, column, row, container, inkwell, boxdecoration.
library
- rxdart
- http
- webview_flutter
- shared_preferences
- share
- cloud_firestore
- uuid
- dynamic_theme
- flutter_picker
- flutter_material_color_picker
bloc pattern
i used this pattern to design this application.
class newsbloc {
final _repository = repository();
final _newsfetcher = publishsubject<newsmodel>();
final _newssearchfetcher = publishsubject<newsmodel>();
final _newslikefetcher = publishsubject<newsmodel>();
observable<newsmodel> get allnews => _newsfetcher.stream;
observable<newsmodel> get searchnews => _newssearchfetcher.stream;
observable<newsmodel> get likenews => _newslikefetcher.stream;
fetchlikednews() async {
newsmodel newsmodel = await _repository.fetchlikednews();
_newslikefetcher.sink.add(newsmodel);
}
fetchallnews() async {
newsmodel newsmodel = await _repository.fetchallnews();
_newsfetcher.sink.add(newsmodel);
}
fetchsearchnews() async {
newsmodel newsmodel = await _repository.fetchsearchnews();
_newssearchfetcher.sink.add(newsmodel);
}
// set and delete from firestore liked
addfavorit(val) async => _repository.addfavorit(val);
delitefavorit(val) async => _repository.delitefavorit(val);
dispose() {
_newslikefetcher.close();
_newsfetcher.close();
_newssearchfetcher.close();
}
}
final bloc = newsbloc();
Comments are closed.