feat: enhance experience management by introducing ExperienceSkill and Industry enums, refactoring related components
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:staff_authentication/src/presentation/widgets/common/section_title_subtitle.dart';
|
||||
import 'package:staff_authentication/staff_authentication.dart';
|
||||
|
||||
@@ -17,28 +18,6 @@ class ProfileSetupExperience extends StatelessWidget {
|
||||
/// Callback for when industries change.
|
||||
final ValueChanged<List<String>> onIndustriesChanged;
|
||||
|
||||
static const List<String> _allSkillKeys = <String>[
|
||||
'food_service',
|
||||
'bartending',
|
||||
'warehouse',
|
||||
'retail',
|
||||
'events',
|
||||
'customer_service',
|
||||
'cleaning',
|
||||
'security',
|
||||
'driving',
|
||||
'cooking',
|
||||
];
|
||||
|
||||
static const List<String> _allIndustryKeys = <String>[
|
||||
'hospitality',
|
||||
'food_service',
|
||||
'warehouse',
|
||||
'events',
|
||||
'retail',
|
||||
'healthcare',
|
||||
];
|
||||
|
||||
/// Creates a [ProfileSetupExperience] widget.
|
||||
const ProfileSetupExperience({
|
||||
super.key,
|
||||
@@ -92,15 +71,15 @@ class ProfileSetupExperience extends StatelessWidget {
|
||||
Wrap(
|
||||
spacing: UiConstants.space2,
|
||||
runSpacing: UiConstants.space2,
|
||||
children: _allSkillKeys.map((String key) {
|
||||
final bool isSelected = skills.contains(key);
|
||||
children: ExperienceSkill.values.map((ExperienceSkill skill) {
|
||||
final bool isSelected = skills.contains(skill.value);
|
||||
// Dynamic translation access
|
||||
final String label = _getSkillLabel(key);
|
||||
final String label = _getSkillLabel(skill);
|
||||
|
||||
return UiChip(
|
||||
label: label,
|
||||
isSelected: isSelected,
|
||||
onTap: () => _toggleSkill(skill: key),
|
||||
onTap: () => _toggleSkill(skill: skill.value),
|
||||
leadingIcon: isSelected ? UiIcons.check : null,
|
||||
variant: UiChipVariant.primary,
|
||||
);
|
||||
@@ -118,14 +97,14 @@ class ProfileSetupExperience extends StatelessWidget {
|
||||
Wrap(
|
||||
spacing: UiConstants.space2,
|
||||
runSpacing: UiConstants.space2,
|
||||
children: _allIndustryKeys.map((String key) {
|
||||
final bool isSelected = industries.contains(key);
|
||||
final String label = _getIndustryLabel(key);
|
||||
children: Industry.values.map((Industry industry) {
|
||||
final bool isSelected = industries.contains(industry.value);
|
||||
final String label = _getIndustryLabel(industry);
|
||||
|
||||
return UiChip(
|
||||
label: label,
|
||||
isSelected: isSelected,
|
||||
onTap: () => _toggleIndustry(industry: key),
|
||||
onTap: () => _toggleIndustry(industry: industry.value),
|
||||
leadingIcon: isSelected ? UiIcons.check : null,
|
||||
variant: isSelected
|
||||
? UiChipVariant.accent
|
||||
@@ -137,72 +116,74 @@ class ProfileSetupExperience extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
String _getSkillLabel(String key) {
|
||||
switch (key) {
|
||||
case 'food_service':
|
||||
String _getSkillLabel(ExperienceSkill skill) {
|
||||
switch (skill) {
|
||||
case ExperienceSkill.foodService:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.skills
|
||||
.food_service;
|
||||
case 'bartending':
|
||||
case ExperienceSkill.bartending:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.skills
|
||||
.bartending;
|
||||
case 'warehouse':
|
||||
case ExperienceSkill.warehouse:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.skills
|
||||
.warehouse;
|
||||
case 'retail':
|
||||
case ExperienceSkill.retail:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.skills
|
||||
.retail;
|
||||
case 'events':
|
||||
// Note: 'events' was removed from enum in favor of 'event_setup' or industry.
|
||||
// Using 'events' translation for eventSetup if available or fallback.
|
||||
case ExperienceSkill.eventSetup:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.skills
|
||||
.events;
|
||||
case 'customer_service':
|
||||
case ExperienceSkill.customerService:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.skills
|
||||
.customer_service;
|
||||
case 'cleaning':
|
||||
case ExperienceSkill.cleaning:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.skills
|
||||
.cleaning;
|
||||
case 'security':
|
||||
case ExperienceSkill.security:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.skills
|
||||
.security;
|
||||
case 'driving':
|
||||
case ExperienceSkill.driving:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.skills
|
||||
.driving;
|
||||
case 'cooking':
|
||||
case ExperienceSkill.cooking:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
@@ -210,48 +191,48 @@ class ProfileSetupExperience extends StatelessWidget {
|
||||
.skills
|
||||
.cooking;
|
||||
default:
|
||||
return key;
|
||||
return skill.value;
|
||||
}
|
||||
}
|
||||
|
||||
String _getIndustryLabel(String key) {
|
||||
switch (key) {
|
||||
case 'hospitality':
|
||||
String _getIndustryLabel(Industry industry) {
|
||||
switch (industry) {
|
||||
case Industry.hospitality:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.industries
|
||||
.hospitality;
|
||||
case 'food_service':
|
||||
case Industry.foodService:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.industries
|
||||
.food_service;
|
||||
case 'warehouse':
|
||||
case Industry.warehouse:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.industries
|
||||
.warehouse;
|
||||
case 'events':
|
||||
case Industry.events:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.industries
|
||||
.events;
|
||||
case 'retail':
|
||||
case Industry.retail:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
.experience
|
||||
.industries
|
||||
.retail;
|
||||
case 'healthcare':
|
||||
case Industry.healthcare:
|
||||
return t
|
||||
.staff_authentication
|
||||
.profile_setup_page
|
||||
@@ -259,7 +240,7 @@ class ProfileSetupExperience extends StatelessWidget {
|
||||
.industries
|
||||
.healthcare;
|
||||
default:
|
||||
return key;
|
||||
return industry.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user