build method
dynamic
build
(- dynamic context
)
Implementation
@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: BorderRadius.vertical(
top: Radius.circular(20.0),
),
child: BlocBuilder<ScheduleBloc, ScheduleState>(
builder: (context, state) {
if (state is ScheduleTimelineState) {
return Scaffold(
appBar: panelAppBar(state.isShuttle, this.widget.panelController,
_tabController, _tabs),
body: TabBarView(
controller: _tabController,
children: <Widget>[
ShuttleTimeline(),
BusTimeline(),
],
),
floatingActionButton: FloatingActionButton(
heroTag: "Filter",
child: Icon(Icons.toc),
elevation: 5.0,
onPressed: () {
BlocProvider.of<ScheduleBloc>(context)
.add(ScheduleTableEvent());
},
),
);
} else if (state is ScheduleTableState) {
return Scaffold(
appBar: panelAppBar(state.isShuttle, this.widget.panelController,
_tabController, _tabs),
body: TabBarView(
controller: _tabController,
children: <Widget>[
ShuttleTable(),
BusTable(),
],
),
floatingActionButton: FloatingActionButton(
heroTag: "Filter",
child: Icon(Icons.timeline),
elevation: 5.0,
onPressed: () {
BlocProvider.of<ScheduleBloc>(context)
.add(ScheduleTimelineEvent());
},
),
);
} else if (state is ScheduleTransitionState){
BlocProvider.of<ScheduleBloc>(context).add(ScheduleChangeEvent());
return Scaffold(
appBar: panelAppBar(state.isShuttle, this.widget.panelController,
_tabController, _tabs),
body: TabBarView(
controller: _tabController,
children: <Widget>[
state.currentState is ScheduleTableState ? ShuttleTable() : ShuttleTimeline(),
state.currentState is ScheduleTableState ? BusTable() : BusTimeline(),
],
),
floatingActionButton: FloatingActionButton(
heroTag: "Filter",
child: state.currentState is ScheduleTableState ? Icon(Icons.timeline) : Icon(Icons.toc),
elevation: 5.0,
onPressed: () {
BlocProvider.of<ScheduleBloc>(context)
.add(ScheduleTableEvent());
},
),
);
}
else{
return Center(child: CircularProgressIndicator());
}
},
));
}