From d2d1398f8913cb077f0f2a21a4803a3738eb173b Mon Sep 17 00:00:00 2001 From: estevez Date: Fri, 21 Sep 2018 21:22:28 +0300 Subject: [PATCH] [#23] Add pull-to-refresh --- lib/main.dart | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index eed2b09..da4a884 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -265,13 +265,20 @@ class _MainPageState extends State with WidgetsBindingObserver { return result; } - List buildUIViews() { - List result = []; + List buildUIViews() { + List result = []; if ((_entitiesData != null) && (_uiStructure != null)) { _uiStructure.forEach((viewId, structure) { - result.add(ListView( - children: buildSingleView(structure), - )); + 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 with WidgetsBindingObserver { body: TabBarView( children: buildUIViews() ), - floatingActionButton: new FloatingActionButton( - onPressed: _refreshData, - tooltip: 'Increment', - child: new Icon(Icons.refresh), - ), ) ); }