This commit is contained in:
Efril 2026-05-14 15:05:04 +07:00
parent c4618bbc1b
commit 96526c1972
4 changed files with 19 additions and 3 deletions

View File

@ -14,7 +14,7 @@ class DashboardAnalyticLoaderState with _$DashboardAnalyticLoaderState {
DashboardAnalyticLoaderState( DashboardAnalyticLoaderState(
dashboardAnalytic: DashboardAnalytic.empty(), dashboardAnalytic: DashboardAnalytic.empty(),
failureOptionDashboardAnalytic: none(), failureOptionDashboardAnalytic: none(),
dateFrom: DateTime.now().subtract(const Duration(days: 30)), dateFrom: DateTime.now(),
dateTo: DateTime.now(), dateTo: DateTime.now(),
); );
} }

View File

@ -18,7 +18,7 @@ class OrderLoaderState with _$OrderLoaderState {
factory OrderLoaderState.initial() => OrderLoaderState( factory OrderLoaderState.initial() => OrderLoaderState(
orders: [], orders: [],
failureOptionOrder: none(), failureOptionOrder: none(),
dateFrom: DateTime.now().subtract(const Duration(days: 30)), dateFrom: DateTime.now(),
dateTo: DateTime.now(), dateTo: DateTime.now(),
status: 'all', status: 'all',
); );

View File

@ -91,6 +91,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
child: Scaffold( child: Scaffold(
backgroundColor: AppColor.background, backgroundColor: AppColor.background,
body: RefreshIndicator( body: RefreshIndicator(
backgroundColor: AppColor.white,
color: AppColor.primary,
onRefresh: () { onRefresh: () {
_refetchDashboard(context); _refetchDashboard(context);
return Future.value(); return Future.value();

View File

@ -107,7 +107,20 @@ class _ReportPageState extends State<ReportPage> with TickerProviderStateMixin {
DashboardAnalyticLoaderState DashboardAnalyticLoaderState
>( >(
builder: (context, state) { builder: (context, state) {
return CustomScrollView( return RefreshIndicator(
color: AppColor.primary,
onRefresh: () async {
context.read<DashboardAnalyticLoaderBloc>().add(
DashboardAnalyticLoaderEvent.fetched(),
);
// tunggu sampai fetching selesai
await context
.read<DashboardAnalyticLoaderBloc>()
.stream
.firstWhere((s) => !s.isFetching);
},
child: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(),
slivers: [ slivers: [
SliverAppBar( SliverAppBar(
expandedHeight: 120, expandedHeight: 120,
@ -197,6 +210,7 @@ class _ReportPageState extends State<ReportPage> with TickerProviderStateMixin {
), ),
), ),
], ],
),
); );
}, },
), ),