[#23] Add pull-to-refresh

This commit is contained in:
estevez 2018-09-21 21:22:28 +03:00
parent de5321565d
commit d2d1398f89

View File

@ -265,13 +265,20 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
return result;
}
List<ListView> buildUIViews() {
List<ListView> result = [];
List<Widget> buildUIViews() {
List<Widget> result = [];
if ((_entitiesData != null) && (_uiStructure != null)) {
_uiStructure.forEach((viewId, structure) {
result.add(ListView(
result.add(
RefreshIndicator(
color: Colors.amber,
child: ListView(
physics: const AlwaysScrollableScrollPhysics(),
children: buildSingleView(structure),
));
),
onRefresh: () => _refreshData(),
)
);
});
}
return result;
@ -470,11 +477,6 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
body: TabBarView(
children: buildUIViews()
),
floatingActionButton: new FloatingActionButton(
onPressed: _refreshData,
tooltip: 'Increment',
child: new Icon(Icons.refresh),
),
)
);
}