feat(dashboards): ajouter RefreshIndicator pull-to-refresh sur 4 dashboards
Le SuperAdmin dashboard avait déjà RefreshIndicator+Completer. Les 4 autres (OrgAdmin, ActiveMember, SimpleMember, Moderator) n'en avaient pas. Ajout sur chacun : - RefreshIndicator avec couleur thème (gold pour OrgAdmin, unionGreen pour les autres) - AlwaysScrollableScrollPhysics (permet pull-to-refresh même si contenu < écran) - onRefresh dispatche LoadDashboardData avec orgId + userId du contexte courant - Délai 1.2s pour laisser le BLoC recharger avant de masquer l'indicateur
This commit is contained in:
@@ -40,7 +40,19 @@ class ActiveMemberDashboard extends StatelessWidget {
|
||||
: null;
|
||||
final stats = dashboardData?.stats;
|
||||
|
||||
return SingleChildScrollView(
|
||||
return RefreshIndicator(
|
||||
color: UnionFlowColors.unionGreen,
|
||||
onRefresh: () async {
|
||||
final orgCtx = user?.organizationContexts.isNotEmpty == true
|
||||
? user!.organizationContexts.first : null;
|
||||
context.read<DashboardBloc>().add(LoadDashboardData(
|
||||
organizationId: orgCtx?.organizationId ?? '',
|
||||
userId: user?.id ?? '',
|
||||
));
|
||||
await Future.delayed(const Duration(milliseconds: 1200));
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -220,7 +232,8 @@ class ActiveMemberDashboard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
), // SingleChildScrollView
|
||||
); // RefreshIndicator
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -43,7 +43,19 @@ class ModeratorDashboard extends StatelessWidget {
|
||||
: null;
|
||||
final stats = dashboardData?.stats;
|
||||
|
||||
return SingleChildScrollView(
|
||||
return RefreshIndicator(
|
||||
color: UnionFlowColors.unionGreen,
|
||||
onRefresh: () async {
|
||||
final orgCtx = user?.organizationContexts.isNotEmpty == true
|
||||
? user!.organizationContexts.first : null;
|
||||
context.read<DashboardBloc>().add(LoadDashboardData(
|
||||
organizationId: orgCtx?.organizationId ?? '',
|
||||
userId: user?.id ?? '',
|
||||
));
|
||||
await Future.delayed(const Duration(milliseconds: 1200));
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -350,7 +362,8 @@ class ModeratorDashboard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
), // SingleChildScrollView
|
||||
); // RefreshIndicator
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -50,7 +50,17 @@ class OrgAdminDashboard extends StatelessWidget {
|
||||
: null;
|
||||
final stats = dashboardData?.stats;
|
||||
|
||||
return SingleChildScrollView(
|
||||
return RefreshIndicator(
|
||||
color: UnionFlowColors.gold,
|
||||
onRefresh: () async {
|
||||
context.read<DashboardBloc>().add(LoadDashboardData(
|
||||
organizationId: orgContext?.organizationId ?? '',
|
||||
userId: user?.id ?? '',
|
||||
));
|
||||
await Future.delayed(const Duration(milliseconds: 1200));
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -276,7 +286,8 @@ class OrgAdminDashboard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
), // SingleChildScrollView
|
||||
); // RefreshIndicator
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -39,7 +39,19 @@ class SimpleMemberDashboard extends StatelessWidget {
|
||||
: null;
|
||||
final stats = dashboardData?.stats;
|
||||
|
||||
return SingleChildScrollView(
|
||||
return RefreshIndicator(
|
||||
color: UnionFlowColors.unionGreen,
|
||||
onRefresh: () async {
|
||||
final orgCtx = user?.organizationContexts.isNotEmpty == true
|
||||
? user!.organizationContexts.first : null;
|
||||
context.read<DashboardBloc>().add(LoadDashboardData(
|
||||
organizationId: orgCtx?.organizationId ?? '',
|
||||
userId: user?.id ?? '',
|
||||
));
|
||||
await Future.delayed(const Duration(milliseconds: 1200));
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -180,7 +192,8 @@ class SimpleMemberDashboard extends StatelessWidget {
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
), // SingleChildScrollView
|
||||
); // RefreshIndicator
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user