[#23] Add pull-to-refresh
This commit is contained in:
parent
de5321565d
commit
d2d1398f89
@ -265,13 +265,20 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ListView> buildUIViews() {
|
List<Widget> buildUIViews() {
|
||||||
List<ListView> result = [];
|
List<Widget> result = [];
|
||||||
if ((_entitiesData != null) && (_uiStructure != null)) {
|
if ((_entitiesData != null) && (_uiStructure != null)) {
|
||||||
_uiStructure.forEach((viewId, structure) {
|
_uiStructure.forEach((viewId, structure) {
|
||||||
result.add(ListView(
|
result.add(
|
||||||
children: buildSingleView(structure),
|
RefreshIndicator(
|
||||||
));
|
color: Colors.amber,
|
||||||
|
child: ListView(
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
children: buildSingleView(structure),
|
||||||
|
),
|
||||||
|
onRefresh: () => _refreshData(),
|
||||||
|
)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -470,11 +477,6 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
|
|||||||
body: TabBarView(
|
body: TabBarView(
|
||||||
children: buildUIViews()
|
children: buildUIViews()
|
||||||
),
|
),
|
||||||
floatingActionButton: new FloatingActionButton(
|
|
||||||
onPressed: _refreshData,
|
|
||||||
tooltip: 'Increment',
|
|
||||||
child: new Icon(Icons.refresh),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user