feat: pull to refresh on home

This commit is contained in:
efrilm 2025-08-20 13:57:00 +07:00
parent 5a83bc4049
commit 3f75bffd09
2 changed files with 117 additions and 106 deletions

View File

@ -67,7 +67,12 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColor.background,
body: BlocBuilder<HomeBloc, HomeState>(
body: RefreshIndicator(
onRefresh: () {
context.read<HomeBloc>().add(HomeEvent.fetchedDashboard());
return Future.value();
},
child: BlocBuilder<HomeBloc, HomeState>(
builder: (context, state) {
return CustomScrollView(
physics: const BouncingScrollPhysics(
@ -100,7 +105,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
return FlexibleSpaceBar(
title: Opacity(
opacity: collapseProgress, // Title muncul saat collapse
opacity:
collapseProgress, // Title muncul saat collapse
child: Row(
children: [
Expanded(
@ -181,6 +187,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
);
},
),
),
);
}
}

View File

@ -13,6 +13,10 @@ class HomeTopProduct extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (products.isEmpty) {
return const SizedBox.shrink();
}
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 24,