Refactor profile data handling and update UI components
- Changed references from companyProfileData to profileData across multiple profile page views for consistency. - Updated UI elements to display user-specific information such as username, email, role, department, and position. - Modified the profile screen to fetch user profile data instead of company profile data. - Added new string constants for user-related fields in ProfileStrings.
This commit is contained in:
@@ -46,6 +46,8 @@ app.*.map.json
|
|||||||
|
|
||||||
# FVM Version Cache
|
# FVM Version Cache
|
||||||
.fvm/
|
.fvm/
|
||||||
|
.fvmrc
|
||||||
|
.vscode/
|
||||||
|
|
||||||
# Firebase Configuration (sensitive files - should not be in version control)
|
# Firebase Configuration (sensitive files - should not be in version control)
|
||||||
**/android/app/google-services.json
|
**/android/app/google-services.json
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewModel.companyProfileData == null) {
|
if (viewModel.profileData == null) {
|
||||||
return const Expanded(
|
return const Expanded(
|
||||||
child: Center(child: Text(CommonStrings.noData)),
|
child: Center(child: Text(CommonStrings.noData)),
|
||||||
);
|
);
|
||||||
@@ -89,29 +89,27 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> {
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(height: 36.0.h()),
|
SizedBox(height: 36.0.h()),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.companyName,
|
title: ProfileStrings.username,
|
||||||
description: viewModel.companyProfileData!.name!,
|
|
||||||
),
|
|
||||||
TitleDescription(
|
|
||||||
title: ProfileStrings.nationalId,
|
|
||||||
description: viewModel.companyProfileData!.id!,
|
|
||||||
),
|
|
||||||
TitleDescription(
|
|
||||||
title: ProfileStrings.registrationNumber,
|
|
||||||
description:
|
description:
|
||||||
viewModel
|
viewModel.profileData!.username ?? '',
|
||||||
.companyProfileData!
|
|
||||||
.registrationNumber!,
|
|
||||||
),
|
|
||||||
const TitleDescription(
|
|
||||||
title: ProfileStrings.businessType,
|
|
||||||
description: '-',
|
|
||||||
),
|
),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.founded,
|
title: ProfileStrings.email,
|
||||||
|
description: viewModel.profileData!.email ?? '',
|
||||||
|
),
|
||||||
|
TitleDescription(
|
||||||
|
title: ProfileStrings.role,
|
||||||
|
description: viewModel.profileData!.role ?? '',
|
||||||
|
),
|
||||||
|
TitleDescription(
|
||||||
|
title: ProfileStrings.department,
|
||||||
description:
|
description:
|
||||||
viewModel.companyProfileData!.foundedYear!
|
viewModel.profileData!.department ?? '',
|
||||||
.toString(),
|
),
|
||||||
|
TitleDescription(
|
||||||
|
title: ProfileStrings.position,
|
||||||
|
description:
|
||||||
|
viewModel.profileData!.position ?? '',
|
||||||
),
|
),
|
||||||
SizedBox(height: 24.0.h()),
|
SizedBox(height: 24.0.h()),
|
||||||
// Theme Toggle
|
// Theme Toggle
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class _MobileProfilePageState extends State<MobileProfilePage> {
|
|||||||
return Center(child: Text(viewModel.errorMessage!));
|
return Center(child: Text(viewModel.errorMessage!));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewModel.companyProfileData == null) {
|
if (viewModel.profileData == null) {
|
||||||
return const Center(child: Text(CommonStrings.noData));
|
return const Center(child: Text(CommonStrings.noData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,26 +92,24 @@ class _MobileProfilePageState extends State<MobileProfilePage> {
|
|||||||
|
|
||||||
SizedBox(height: 24.0.h()),
|
SizedBox(height: 24.0.h()),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.companyName,
|
title: ProfileStrings.username,
|
||||||
description: viewModel.companyProfileData!.name!,
|
description: viewModel.profileData!.username ?? '',
|
||||||
),
|
),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.nationalId,
|
title: ProfileStrings.email,
|
||||||
description: viewModel.companyProfileData!.id!,
|
description: viewModel.profileData!.email ?? '',
|
||||||
),
|
),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.registrationNumber,
|
title: ProfileStrings.role,
|
||||||
description:
|
description: viewModel.profileData!.role ?? '',
|
||||||
viewModel.companyProfileData!.registrationNumber!,
|
|
||||||
),
|
|
||||||
const TitleDescription(
|
|
||||||
title: ProfileStrings.businessType,
|
|
||||||
description: '-',
|
|
||||||
),
|
),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.founded,
|
title: ProfileStrings.department,
|
||||||
description:
|
description: viewModel.profileData!.department ?? '',
|
||||||
viewModel.companyProfileData!.foundedYear!.toString(),
|
),
|
||||||
|
TitleDescription(
|
||||||
|
title: ProfileStrings.position,
|
||||||
|
description: viewModel.profileData!.position ?? '',
|
||||||
),
|
),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
Align(
|
Align(
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
_tabService.addListener(_onTabChanged);
|
_tabService.addListener(_onTabChanged);
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_viewModel.getCompanyProfile();
|
// _viewModel.getCompanyProfile();
|
||||||
|
_viewModel.getProfile();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
void _onTabChanged() {
|
void _onTabChanged() {
|
||||||
// Tab index 2 is Profile
|
// Tab index 2 is Profile
|
||||||
if (_tabService.currentTabIndex == 2 && mounted) {
|
if (_tabService.currentTabIndex == 2 && mounted) {
|
||||||
_viewModel.getCompanyProfile();
|
_viewModel.getProfile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
|
|||||||
return Center(child: Text(viewModel.errorMessage!));
|
return Center(child: Text(viewModel.errorMessage!));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewModel.companyProfileData == null) {
|
if (viewModel.profileData == null) {
|
||||||
return const Center(child: Text(CommonStrings.noData));
|
return const Center(child: Text(CommonStrings.noData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,27 +86,47 @@ class _TabletProfilePageState extends State<TabletProfilePage> {
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(height: 128.0.h()),
|
SizedBox(height: 128.0.h()),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.companyName,
|
title: ProfileStrings.username,
|
||||||
description: viewModel.companyProfileData!.name!,
|
description: viewModel.profileData!.username ?? '',
|
||||||
),
|
),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.nationalId,
|
title: ProfileStrings.email,
|
||||||
description: viewModel.companyProfileData!.id!,
|
description: viewModel.profileData!.email ?? '',
|
||||||
),
|
),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.registrationNumber,
|
title: ProfileStrings.role,
|
||||||
description:
|
description: viewModel.profileData!.role ?? '',
|
||||||
viewModel.companyProfileData!.registrationNumber!,
|
|
||||||
),
|
|
||||||
const TitleDescription(
|
|
||||||
title: ProfileStrings.businessType,
|
|
||||||
description: '-',
|
|
||||||
),
|
),
|
||||||
TitleDescription(
|
TitleDescription(
|
||||||
title: ProfileStrings.founded,
|
title: ProfileStrings.department,
|
||||||
description:
|
description: viewModel.profileData!.department ?? '',
|
||||||
viewModel.companyProfileData!.foundedYear!.toString(),
|
|
||||||
),
|
),
|
||||||
|
TitleDescription(
|
||||||
|
title: ProfileStrings.position,
|
||||||
|
description: viewModel.profileData!.position ?? '',
|
||||||
|
),
|
||||||
|
// TitleDescription(
|
||||||
|
// title: ProfileStrings.companyName,
|
||||||
|
// description: viewModel.companyProfileData!.name!,
|
||||||
|
// ),
|
||||||
|
// TitleDescription(
|
||||||
|
// title: ProfileStrings.nationalId,
|
||||||
|
// description: viewModel.companyProfileData!.id!,
|
||||||
|
// ),
|
||||||
|
// TitleDescription(
|
||||||
|
// title: ProfileStrings.registrationNumber,
|
||||||
|
// description:
|
||||||
|
// viewModel.companyProfileData!.registrationNumber!,
|
||||||
|
// ),
|
||||||
|
// const TitleDescription(
|
||||||
|
// title: ProfileStrings.businessType,
|
||||||
|
// description: '-',
|
||||||
|
// ),
|
||||||
|
// TitleDescription(
|
||||||
|
// title: ProfileStrings.founded,
|
||||||
|
// description:
|
||||||
|
// viewModel.companyProfileData!.foundedYear!.toString(),
|
||||||
|
// ),
|
||||||
SizedBox(height: 24.0.h()),
|
SizedBox(height: 24.0.h()),
|
||||||
// Theme Toggle
|
// Theme Toggle
|
||||||
Align(
|
Align(
|
||||||
|
|||||||
@@ -13,4 +13,9 @@ class ProfileStrings {
|
|||||||
static const String logout = 'Log out';
|
static const String logout = 'Log out';
|
||||||
static const String contracts = 'Contracts';
|
static const String contracts = 'Contracts';
|
||||||
static const String notifications = 'Notifications';
|
static const String notifications = 'Notifications';
|
||||||
|
static const String username = 'User Name';
|
||||||
|
static const String email = 'email';
|
||||||
|
static const String role = 'role';
|
||||||
|
static const String department = 'department';
|
||||||
|
static const String position = 'position';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user