Role Guard Widget
Component Detail
User Interface
low complexity
Shared Component
mobile
2
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
A reusable Flutter widget wrapper that conditionally renders or hides child widgets based on the current user's active role and required permissions. Used throughout the app to hide coordinator-only UI elements from Peer Mentors without requiring per-screen logic.
role-guard-widget
Responsibilities
- Accept a list of permitted roles as configuration
- Read the active role from the Role Guard BLoC
- Render children only when the active role is permitted
- Render an empty widget or fallback when access is denied
Interfaces
RoleGuardWidget({required List<UserRole> allowedRoles, required Widget child, Widget? fallback})
build(BuildContext context)
Relationships
Dependencies (2)
Components this component depends on