Display of Sectors of Interest

master
Rafael 2024-06-21 02:42:45 +02:00
parent 78b9f1bc7b
commit d0ad8d6745
8 changed files with 190 additions and 12 deletions

View File

@ -4,7 +4,7 @@ class Constants {
/// Title of the app /// Title of the app
static const String appTitle = 'Cofounderella'; static const String appTitle = 'Cofounderella';
static const String appVersion = '1.0.1'; static const String appVersion = '1.0.1';
static const String appCompilationDate = '2024-06-19'; static const String appCompilationDate = '2024-06-20';
static const String dbCollectionFeedbacks = 'feedbacks'; static const String dbCollectionFeedbacks = 'feedbacks';
static const String dbCollectionUsers = 'Users'; static const String dbCollectionUsers = 'Users';

View File

@ -256,33 +256,47 @@ enum RiskTolerance {
enum SectorOption { enum SectorOption {
agriculture, agriculture,
ai, ai,
vr, ar,
automotive, automotive,
beauty,
bigdata, bigdata,
blockchain, blockchain,
cloud, cloud,
construction,
consulting,
crypto, crypto,
cybersecurity, cybersecurity,
ecommerce,
education, education,
energy, energy,
fashion, fashion,
finance, finance,
food, food,
gaming, gaming,
hardware,
healthcare, healthcare,
home, home,
industry, industry,
insurance, insurance,
iot, iot,
it,
legal, legal,
ml, ml,
marketing,
media, media,
mobility,
pharma, pharma,
retail, retail,
robotics, robotics,
saas, saas,
sports, sports,
travel; software,
telecommunication,
transport,
travel,
vr,
web,
other;
String get displayName { String get displayName {
switch (this) { switch (this) {
@ -290,20 +304,28 @@ enum SectorOption {
return 'Agriculture'; return 'Agriculture';
case SectorOption.ai: case SectorOption.ai:
return 'Artificial Intelligence'; return 'Artificial Intelligence';
case SectorOption.vr: case SectorOption.ar:
return 'Augmented/Virtual Reality'; return 'Augmented Reality';
case SectorOption.automotive: case SectorOption.automotive:
return 'Automotive'; return 'Automotive';
case SectorOption.beauty:
return 'Beauty and Personal Care';
case SectorOption.bigdata: case SectorOption.bigdata:
return 'Big Data'; return 'Big Data';
case SectorOption.blockchain: case SectorOption.blockchain:
return 'Blockchain'; return 'Blockchain';
case SectorOption.cloud: case SectorOption.cloud:
return 'Cloud Computing'; return 'Cloud Computing';
case SectorOption.construction:
return 'Construction and Real Estate';
case SectorOption.consulting:
return 'Consulting and Agency';
case SectorOption.crypto: case SectorOption.crypto:
return 'Cryptocurrencies/Digital Assets'; return 'Cryptocurrencies and Digital Assets';
case SectorOption.cybersecurity: case SectorOption.cybersecurity:
return 'Cybersecurity'; return 'Cybersecurity';
case SectorOption.ecommerce:
return 'E-Commerce';
case SectorOption.education: case SectorOption.education:
return 'Education'; return 'Education';
case SectorOption.energy: case SectorOption.energy:
@ -316,6 +338,8 @@ enum SectorOption {
return 'Food and Beverage'; return 'Food and Beverage';
case SectorOption.gaming: case SectorOption.gaming:
return 'Gaming'; return 'Gaming';
case SectorOption.hardware:
return 'Hardware';
case SectorOption.healthcare: case SectorOption.healthcare:
return 'Healthcare'; return 'Healthcare';
case SectorOption.home: case SectorOption.home:
@ -326,12 +350,18 @@ enum SectorOption {
return 'Insurance'; return 'Insurance';
case SectorOption.iot: case SectorOption.iot:
return 'Internet of Things'; return 'Internet of Things';
case SectorOption.it:
return 'IT';
case SectorOption.legal: case SectorOption.legal:
return 'Legal and Compliance'; return 'Legal and Compliance';
case SectorOption.ml: case SectorOption.ml:
return 'Machine Learning'; return 'Machine Learning';
case SectorOption.marketing:
return 'Marketing and Advertising';
case SectorOption.media: case SectorOption.media:
return 'Media and Entertainment'; return 'Media and Entertainment';
case SectorOption.mobility:
return 'Mobility';
case SectorOption.pharma: case SectorOption.pharma:
return 'Pharma'; return 'Pharma';
case SectorOption.retail: case SectorOption.retail:
@ -342,8 +372,20 @@ enum SectorOption {
return 'SaaS'; return 'SaaS';
case SectorOption.sports: case SectorOption.sports:
return 'Sports and Fitness'; return 'Sports and Fitness';
case SectorOption.software:
return 'Software';
case SectorOption.telecommunication:
return 'Telecommunications';
case SectorOption.transport:
return 'Transport and Logistics';
case SectorOption.travel: case SectorOption.travel:
return 'Travel'; return 'Travel';
case SectorOption.vr:
return 'Virtual Reality';
case SectorOption.web:
return 'Web';
case SectorOption.other:
return 'Other';
} }
} }
} }

View File

@ -19,6 +19,7 @@ class UserProfile {
CommunicationPreference communication; CommunicationPreference communication;
List<SkillOption> skills; List<SkillOption> skills;
List<SkillOption> skillsSought; List<SkillOption> skillsSought;
List<SectorOption> sectors;
List<VisionOption> visions; List<VisionOption> visions;
List<WorkValueOption> workValues; List<WorkValueOption> workValues;
List<Language> languages; List<Language> languages;
@ -41,6 +42,7 @@ class UserProfile {
required this.communication, required this.communication,
required this.skills, required this.skills,
required this.skillsSought, required this.skillsSought,
required this.sectors,
required this.visions, required this.visions,
required this.workValues, required this.workValues,
required this.languages, required this.languages,

View File

@ -14,6 +14,7 @@ import '../models/user_profile.dart';
import '../services/auth/auth_service.dart'; import '../services/auth/auth_service.dart';
import '../services/user_service.dart'; import '../services/user_service.dart';
import '../utils/helper.dart'; import '../utils/helper.dart';
import '../utils/list_utils.dart';
import '../utils/math.dart'; import '../utils/math.dart';
import 'chat_page.dart'; import 'chat_page.dart';
@ -326,7 +327,7 @@ class UserMatchingPageState extends State<UserMatchingPage> {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.0), borderRadius: BorderRadius.circular(16.0),
color: Colors.blue, color: Colors.blue,
), ),
child: Stack( child: Stack(
@ -356,6 +357,7 @@ class UserMatchingPageState extends State<UserMatchingPage> {
String? profileImageUrl = userProfile.profilePictureUrl; String? profileImageUrl = userProfile.profilePictureUrl;
String pronoun = getPronoun(userProfile.gender); String pronoun = getPronoun(userProfile.gender);
String possAdjective = getPossessiveAdjective(userProfile.gender);
String location = String location =
userProfile.locations[Constants.dbDocMainLocation]?.toString() ?? 'N/A'; userProfile.locations[Constants.dbDocMainLocation]?.toString() ?? 'N/A';
@ -445,10 +447,31 @@ class UserMatchingPageState extends State<UserMatchingPage> {
'${userProfile.availability.commitmentText}.', '${userProfile.availability.commitmentText}.',
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
const Row( Row(
children: [ children: [
Text('Spoken languages '), Text(
Expanded(child: Divider()), '$possAdjective Sectors of Interest ',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
const Expanded(child: Divider()),
],
),
const SizedBox(height: 4),
Text(sortSectorsList(userProfile.sectors)
.map((x) => x.displayName)
.join(' \u25CF ')),
const SizedBox(height: 8),
Row(
children: [
Text(
'Spoken languages ',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
const Expanded(child: Divider()),
], ],
), ),
const SizedBox(height: 4), const SizedBox(height: 4),

View File

@ -7,10 +7,12 @@ import '../constants.dart';
import '../enumerations.dart'; import '../enumerations.dart';
import '../forms/corporate_culture_form.dart'; import '../forms/corporate_culture_form.dart';
import '../forms/risks_form.dart'; import '../forms/risks_form.dart';
import '../forms/sectors_form.dart';
import '../forms/skills_form.dart'; import '../forms/skills_form.dart';
import '../models/user_profile.dart'; import '../models/user_profile.dart';
import '../services/user_service.dart'; import '../services/user_service.dart';
import '../utils/helper.dart'; import '../utils/helper.dart';
import '../utils/list_utils.dart';
import '../utils/math.dart'; import '../utils/math.dart';
import 'edit_profile_page.dart'; import 'edit_profile_page.dart';
import 'user_data_page.dart'; import 'user_data_page.dart';
@ -132,6 +134,27 @@ class _UserProfilePageState extends State<UserProfilePage> {
_editSkills(skillsSought: true); _editSkills(skillsSought: true);
} }
void editUserSectorsInfo() async {
final updatedUserData = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SectorsForm(
isRegProcess: false,
isEditMode: true,
),
),
);
if (updatedUserData != null) {
setState(() {
// above Type of updatedUserData is dynamic, so convert
List<dynamic> dynamicList =
updatedUserData[Constants.dbFieldUsersSectors];
myData.sectors = dynamicList.map((e) => e as SectorOption).toList();
});
}
}
void editUserVisionInfo() async { void editUserVisionInfo() async {
final updatedUserData = await Navigator.push( final updatedUserData = await Navigator.push(
context, context,
@ -227,6 +250,11 @@ class _UserProfilePageState extends State<UserProfilePage> {
if (isOwner) if (isOwner)
Divider(color: Theme.of(context).colorScheme.primary), Divider(color: Theme.of(context).colorScheme.primary),
if (isOwner) const SizedBox(height: 16), if (isOwner) const SizedBox(height: 16),
_buildSectors(context),
const SizedBox(height: 16),
if (isOwner)
Divider(color: Theme.of(context).colorScheme.primary),
if (isOwner) const SizedBox(height: 16),
_buildVision(context), _buildVision(context),
const SizedBox(height: 16), const SizedBox(height: 16),
if (isOwner) if (isOwner)
@ -434,6 +462,47 @@ class _UserProfilePageState extends State<UserProfilePage> {
); );
} }
Widget _buildSectors(BuildContext context) {
return Column(
children: [
Align(
alignment: Alignment.centerLeft,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Sectors of Interest',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
Text(
sortSectorsList(myData.sectors)
.map((x) => x.displayName)
.join('\n'),
style: const TextStyle(fontSize: 16)),
],
),
),
if (isOwner) _editButton(context, editUserSectorsInfo),
],
),
const SizedBox(height: 16),
],
),
),
],
);
}
Widget _buildSkills(BuildContext context) { Widget _buildSkills(BuildContext context) {
return Column( return Column(
children: [ children: [
@ -511,7 +580,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'Locations', myData.locations.length > 1 ? 'Locations' : 'Location',
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),

View File

@ -70,6 +70,17 @@ class UserService {
return []; return [];
} }
static List<SectorOption> convertSectorStringToEnum(List<dynamic>? sectors) {
if (sectors != null && sectors.isNotEmpty) {
List<SectorOption> userSectors = sectors
.map((sector) =>
SectorOption.values.firstWhere((x) => x.toString() == sector))
.toList();
return userSectors;
}
return [];
}
static List<VisionOption> convertVisionStringToEnum(List<dynamic>? visions) { static List<VisionOption> convertVisionStringToEnum(List<dynamic>? visions) {
if (visions != null && visions.isNotEmpty) { if (visions != null && visions.isNotEmpty) {
List<VisionOption> userVisions = visions List<VisionOption> userVisions = visions
@ -126,6 +137,8 @@ class UserService {
data[Constants.dbFieldUsersSkills]); data[Constants.dbFieldUsersSkills]);
List<SkillOption> skillsSought = UserService.convertSkillStringToEnum( List<SkillOption> skillsSought = UserService.convertSkillStringToEnum(
data[Constants.dbFieldUsersSkillsSought]); data[Constants.dbFieldUsersSkillsSought]);
List<SectorOption> sectors = UserService.convertSectorStringToEnum(
data[Constants.dbFieldUsersSectors]);
List<VisionOption> visions = UserService.convertVisionStringToEnum( List<VisionOption> visions = UserService.convertVisionStringToEnum(
data[Constants.dbFieldUsersVisions]); data[Constants.dbFieldUsersVisions]);
List<WorkValueOption> works = UserService.convertWorkValuesStringToEnum( List<WorkValueOption> works = UserService.convertWorkValuesStringToEnum(
@ -178,6 +191,7 @@ class UserService {
lastName: data[Constants.dbFieldUsersLastName] ?? '', lastName: data[Constants.dbFieldUsersLastName] ?? '',
skills: skillsOffered, skills: skillsOffered,
skillsSought: skillsSought, skillsSought: skillsSought,
sectors: sectors,
visions: visions, visions: visions,
risk: risk, risk: risk,
availability: availability, availability: availability,

View File

@ -75,6 +75,19 @@ String getPronoun(Gender? userGender) {
} }
} }
/// Get possessive adjective for given [userGender].
/// Returns [His] if male, [Her] if female, else [His/Her].
String getPossessiveAdjective(Gender? userGender) {
switch (userGender) {
case Gender.male:
return 'His';
case Gender.female:
return 'Her';
default:
return 'His/Her';
}
}
/// Get the [displayName] of our own Enumerations. /// Get the [displayName] of our own Enumerations.
String getDisplayText(dynamic option) { String getDisplayText(dynamic option) {
// Check if the option is an enum and has a displayName property // Check if the option is an enum and has a displayName property

View File

@ -1,4 +1,5 @@
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import '../enumerations.dart';
import '../models/language.dart'; import '../models/language.dart';
/// Compare two lists by their content ignoring their elements order. /// Compare two lists by their content ignoring their elements order.
@ -6,7 +7,8 @@ bool equalContent(List<dynamic> list1, List<dynamic> list2) {
return const DeepCollectionEquality.unordered().equals(list1, list2); return const DeepCollectionEquality.unordered().equals(list1, list2);
} }
/// Sort the given list of languages so that German appears first, English second, and all other languages follow in alphabetical order. /// Sort the given list of languages so that German appears first,
/// English second, and all other languages follow in alphabetical order.
List<Language> sortLanguageList(List<Language> langList) { List<Language> sortLanguageList(List<Language> langList) {
List<Language> sortedLanguages = List.from(langList); List<Language> sortedLanguages = List.from(langList);
sortedLanguages.sort((a, b) { sortedLanguages.sort((a, b) {
@ -21,3 +23,16 @@ List<Language> sortLanguageList(List<Language> langList) {
}); });
return sortedLanguages; return sortedLanguages;
} }
/// Sort the given list of sectors of interest, placing [SectorOption.other] at the end.
List<SectorOption> sortSectorsList(List<SectorOption> sectorList) {
List<SectorOption> sortedSectors = List.from(sectorList);
sortedSectors.sort((a, b) {
// other last
if (a.name == 'other') return 1;
if (b.name == 'other') return -1;
// All others by name ascending
return a.name.compareTo(b.name);
});
return sortedSectors;
}