Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Widget build(BuildContext context) {
- final mBloc = BlocProvider.mReportsBloc(context);
- final fBloc = BlocProvider.fReportsBloc(context);
- return DefaultTabController(
- length: 2,
- child: Scaffold(
- appBar: AppBar(
- elevation: 1.5,
- bottom: TabBar(
- tabs: [
- Container(
- child: textWrapper("M reports"),
- ),
- Container(
- child: textWrapper("F reports"),
- ),
- ],
- ),
- title: Text("Pool"),
- ),
- body: TabBarView(
- children: [
- buildMReportList(mBloc),
- buildFReportList(fBloc),
- ],
- ),
- ),
- );
- }
- Widget buildFReportList(ReportsBloc fBloc) {
- return StreamBuilder(
- stream: fBloc.fReports,
- builder: (context, AsyncSnapshot<List<ReportModel>> snapshot) {
- if (!snapshot.hasData) {
- return Center(
- child: CircularProgressIndicator(),
- );
- }
- return ListView.builder(
- itemCount: snapshot.data.length,
- itemBuilder: (context, int index) {
- return _buildCard(snapshot.data[index], context);
- },
- );
- });
- }
- Widget buildMReportList(ReportsBloc mBloc) {
- return StreamBuilder(
- stream: mBloc.mReports,
- builder: (context, AsyncSnapshot<List<ReportModel>> snapshot) {
- if (!snapshot.hasData) {
- return Center(
- child: CircularProgressIndicator(),
- );
- }
- return ListView.builder(
- itemCount: snapshot.data.length,
- itemBuilder: (context, int index) {
- return _buildCard(snapshot.data[index], context);
- },
- );
- });
- }
Add Comment
Please, Sign In to add comment