feat: Implement Staff Profile feature with BLoC architecture

- Added ProfileRepositoryInterface for staff profile operations.
- Created StaffProfileUI to represent extended profile information for the UI.
- Developed GetProfileUseCase to fetch staff profiles and map to UI entities.
- Implemented SignOutUseCase for user sign-out functionality.
- Introduced ProfileCubit to manage profile state and loading logic.
- Created ProfileState to represent various states of the profile feature.
- Developed ProfileNavigator for type-safe navigation within the profile feature.
- Built StaffProfilePage to display staff member's profile and statistics.
- Added various widgets for profile display, including reliability stats and menu items.
- Established StaffProfileModule for dependency injection and routing.
- Configured pubspec.yaml for feature package dependencies.
This commit is contained in:
Achintha Isuru
2026-01-24 14:25:17 -05:00
parent 633af6fab0
commit 6c72c2d9fd
23 changed files with 1489 additions and 9 deletions

View File

@@ -9,6 +9,7 @@ library;
export 'src/mocks/auth_repository_mock.dart';
export 'src/mocks/staff_repository_mock.dart';
export 'src/mocks/profile_repository_mock.dart';
export 'src/mocks/event_repository_mock.dart';
export 'src/mocks/skill_repository_mock.dart';
export 'src/mocks/financial_repository_mock.dart';

View File

@@ -0,0 +1,45 @@
import 'package:krow_domain/krow_domain.dart';
/// Mock implementation of profile-related data operations.
///
/// This mock provides hardcoded staff profile data for development and testing.
/// It simulates the behavior of a real backend service without requiring
/// actual API calls or Firebase Data Connect.
///
/// In production, this will be replaced with a real implementation that
/// interacts with Firebase Data Connect.
class ProfileRepositoryMock {
/// Fetches the staff profile for the given user ID.
///
/// Returns a [Staff] entity with mock data.
/// Simulates a network delay to mirror real API behavior.
///
/// Throws an exception if the profile cannot be retrieved.
Future<Staff> getStaffProfile(String userId) async {
// Simulate network delay
await Future.delayed(const Duration(milliseconds: 500));
// Return mock staff profile data
return const Staff(
id: '93673c8f-91aa-405d-8647-f1aac29cc19b',
authProviderId: 't8P3fYh4y1cPoZbbVPXUhfQCsDo3',
name: 'Krower',
email: 'worker@krow.com',
phone: '555-123-4567',
status: StaffStatus.active,
avatar: null,
livePhoto: null,
address: null,
);
}
/// Signs out the current user.
///
/// Simulates the sign-out process with a delay.
/// In a real implementation, this would clear session tokens,
/// update Firebase auth state, etc.
Future<void> signOut() async {
// Simulate processing delay
await Future.delayed(const Duration(milliseconds: 300));
}
}