Skip to content

Commit

Permalink
[#16] implement Refresh survey
Browse files Browse the repository at this point in the history
  • Loading branch information
nkhanh44 committed Aug 24, 2023
1 parent 8b31157 commit e081b79
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions lib/screens/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,39 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
);
}
return Scaffold(
body: Stack(
children: [
if (surveys.isNotEmpty) ...[
HomePagesWidget(
surveys: surveys,
currentPage: _currentPage,
),
const HomeHeaderWidget(),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(bottom: 220),
child: HomePageIndicatorWidget(
surveysLength: surveys.length,
body: RefreshIndicator(
color: Colors.white,
backgroundColor: Colors.black,
onRefresh:() => ref.read(homeViewModelProvider.notifier).loadSurveys(isRefreshing: true),
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: SizedBox(
height: MediaQuery.of(context).size.height,
child: Stack(
children: [
if (surveys.isNotEmpty) ...[
HomePagesWidget(
surveys: surveys,
currentPage: _currentPage,
),
),
)
],
if (surveys.isEmpty || isLoading) _buildShimmerLoading(),
],
const HomeHeaderWidget(),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(bottom: 220),
child: HomePageIndicatorWidget(
surveysLength: surveys.length,
currentPage: _currentPage,
),
),
)
],
if (surveys.isEmpty || isLoading) _buildShimmerLoading(),
],
),
),
),
);
));
}

Widget _buildShimmerLoading() {
Expand Down

0 comments on commit e081b79

Please sign in to comment.