Skip to content

Commit e081b79

Browse files
committed
[#16] implement Refresh survey
1 parent 8b31157 commit e081b79

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

lib/screens/home/home_screen.dart

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,29 +68,39 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
6868
);
6969
}
7070
return Scaffold(
71-
body: Stack(
72-
children: [
73-
if (surveys.isNotEmpty) ...[
74-
HomePagesWidget(
75-
surveys: surveys,
76-
currentPage: _currentPage,
77-
),
78-
const HomeHeaderWidget(),
79-
Align(
80-
alignment: Alignment.bottomCenter,
81-
child: Padding(
82-
padding: const EdgeInsets.only(bottom: 220),
83-
child: HomePageIndicatorWidget(
84-
surveysLength: surveys.length,
71+
body: RefreshIndicator(
72+
color: Colors.white,
73+
backgroundColor: Colors.black,
74+
onRefresh:() => ref.read(homeViewModelProvider.notifier).loadSurveys(isRefreshing: true),
75+
child: SingleChildScrollView(
76+
physics: const AlwaysScrollableScrollPhysics(),
77+
child: SizedBox(
78+
height: MediaQuery.of(context).size.height,
79+
child: Stack(
80+
children: [
81+
if (surveys.isNotEmpty) ...[
82+
HomePagesWidget(
83+
surveys: surveys,
8584
currentPage: _currentPage,
8685
),
87-
),
88-
)
89-
],
90-
if (surveys.isEmpty || isLoading) _buildShimmerLoading(),
91-
],
86+
const HomeHeaderWidget(),
87+
Align(
88+
alignment: Alignment.bottomCenter,
89+
child: Padding(
90+
padding: const EdgeInsets.only(bottom: 220),
91+
child: HomePageIndicatorWidget(
92+
surveysLength: surveys.length,
93+
currentPage: _currentPage,
94+
),
95+
),
96+
)
97+
],
98+
if (surveys.isEmpty || isLoading) _buildShimmerLoading(),
99+
],
100+
),
101+
),
92102
),
93-
);
103+
));
94104
}
95105

96106
Widget _buildShimmerLoading() {

0 commit comments

Comments
 (0)