Created
February 16, 2019 13:13
-
-
Save D-sense/b49f1399db40214b2e050a81291e890c to your computer and use it in GitHub Desktop.
Revisions
-
D-sense created this gist
Feb 16, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,69 @@ 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); }, ); }); }