Shortened the Registration Process by skipping and therefore making Visions and Corporate Culture values optional.
parent
c5a788c67f
commit
ba37ca72f8
|
@ -123,6 +123,8 @@ class CultureValuesFormPageState extends State<CultureValuesFormPage> {
|
|||
MaterialPageRoute(
|
||||
//
|
||||
// set following registration page HERE
|
||||
// this Page (CorporateCultureForm) is optional as of 22.06.24
|
||||
// and therefore not called anymore during RegProcess
|
||||
//
|
||||
builder: (context) => RisksFormPage(
|
||||
isRegProcess: widget.isRegProcess,
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:collection/collection.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import '../components/my_elevated_button.dart';
|
||||
import '../components/text_bold.dart';
|
||||
import '../constants.dart';
|
||||
import '../enumerations.dart';
|
||||
import '../pages/registration_complete_page.dart';
|
||||
|
@ -20,7 +21,7 @@ class RisksFormPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class RisksFormPageState extends State<RisksFormPage> {
|
||||
CommunicationPreference? communicationPreference;
|
||||
AvailabilityOption? availability;
|
||||
RiskTolerance? riskPreference;
|
||||
|
||||
final AuthService _authService = AuthService();
|
||||
|
@ -41,11 +42,11 @@ class RisksFormPageState extends State<RisksFormPage> {
|
|||
final data = snapshot.data();
|
||||
setState(() {
|
||||
if (data != null) {
|
||||
// Load Communication Preference
|
||||
if (data[Constants.dbFieldUsersCommunication] != null) {
|
||||
communicationPreference = CommunicationPreference.values
|
||||
.firstWhereOrNull((x) =>
|
||||
x.toString() == data[Constants.dbFieldUsersCommunication]);
|
||||
// Load Availability option
|
||||
if (data[Constants.dbFieldUsersAvailability] != null) {
|
||||
availability = AvailabilityOption.values.firstWhereOrNull(
|
||||
(x) => x.toString() == data[Constants.dbFieldUsersAvailability],
|
||||
);
|
||||
}
|
||||
// Load Risk Tolerance
|
||||
if (data[Constants.dbFieldUsersRiskTolerance] != null) {
|
||||
|
@ -65,8 +66,7 @@ class RisksFormPageState extends State<RisksFormPage> {
|
|||
|
||||
await userDoc.set(
|
||||
{
|
||||
Constants.dbFieldUsersCommunication:
|
||||
communicationPreference?.toString(),
|
||||
Constants.dbFieldUsersAvailability: availability.toString(),
|
||||
Constants.dbFieldUsersRiskTolerance: riskPreference?.toString(),
|
||||
},
|
||||
SetOptions(merge: true), // avoid overwriting existing data
|
||||
|
@ -83,13 +83,12 @@ class RisksFormPageState extends State<RisksFormPage> {
|
|||
}
|
||||
|
||||
Future<void> handleSubmit() async {
|
||||
if (communicationPreference == null) {
|
||||
showErrorSnackBar(context, 'Please select a communication preference.');
|
||||
if (availability == null) {
|
||||
_showSnackBar('Please select an availability option.');
|
||||
return;
|
||||
}
|
||||
if (riskPreference == null) {
|
||||
showErrorSnackBar(
|
||||
context, 'Please select the willingness to take risks.');
|
||||
showErrorSnackBar(context, 'Please select a willingness to take risks.');
|
||||
return;
|
||||
}
|
||||
// Handle the form submission logic here
|
||||
|
@ -116,7 +115,7 @@ class RisksFormPageState extends State<RisksFormPage> {
|
|||
if (widget.isEditMode == true) {
|
||||
// pass selectedOptions data back to caller
|
||||
Navigator.pop(context, {
|
||||
Constants.dbFieldUsersCommunication: communicationPreference,
|
||||
Constants.dbFieldUsersAvailability: availability,
|
||||
Constants.dbFieldUsersRiskTolerance: riskPreference,
|
||||
});
|
||||
} else {
|
||||
|
@ -144,28 +143,24 @@ class RisksFormPageState extends State<RisksFormPage> {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TextBold(text: 'Availability and commitment'),
|
||||
const Text(
|
||||
'Communication preference',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
'How much time can you devote to the startup each week?',
|
||||
),
|
||||
const Text('How do you prefer to communicate in a team?'),
|
||||
...CommunicationPreference.values.map((option) {
|
||||
...AvailabilityOption.values.map((option) {
|
||||
return RadioListTile(
|
||||
title: Text(option.displayName),
|
||||
value: option,
|
||||
groupValue: communicationPreference,
|
||||
onChanged: (CommunicationPreference? value) {
|
||||
groupValue: availability,
|
||||
onChanged: (AvailabilityOption? value) {
|
||||
setState(() {
|
||||
communicationPreference = value;
|
||||
availability = value;
|
||||
});
|
||||
},
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 40),
|
||||
const Text(
|
||||
'Risk tolerance',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const TextBold(text: 'Risk tolerance'),
|
||||
const Text('How do you deal with uncertainty and risk?'),
|
||||
...RiskTolerance.values.map((option) {
|
||||
return RadioListTile(
|
||||
|
|
|
@ -3,8 +3,8 @@ import '../../enumerations.dart';
|
|||
import '../../services/auth/auth_service.dart';
|
||||
import '../../services/user_service.dart';
|
||||
import '../constants.dart';
|
||||
import '../pages/user_vision_page.dart';
|
||||
import 'profile_category_form.dart';
|
||||
import 'risks_form.dart';
|
||||
|
||||
class SectorsForm extends StatelessWidget {
|
||||
SectorsForm({
|
||||
|
@ -54,7 +54,7 @@ class SectorsForm extends StatelessWidget {
|
|||
context,
|
||||
MaterialPageRoute(
|
||||
// set following registration page HERE
|
||||
builder: (context) => UserVisionPage(
|
||||
builder: (context) => RisksFormPage(
|
||||
isRegProcess: isRegProcess,
|
||||
isEditMode: false,
|
||||
),
|
||||
|
|
|
@ -201,7 +201,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
}
|
||||
}
|
||||
|
||||
void editUserCommunicationInfo() async {
|
||||
void editUserRiskInfo() async {
|
||||
final updatedUserData = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
|
@ -255,12 +255,12 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
if (isOwner)
|
||||
Divider(color: Theme.of(context).colorScheme.primary),
|
||||
if (isOwner) const SizedBox(height: 16),
|
||||
_buildVision(context),
|
||||
_buildRisks(context),
|
||||
const SizedBox(height: 16),
|
||||
if (isOwner)
|
||||
Divider(color: Theme.of(context).colorScheme.primary),
|
||||
if (isOwner) const SizedBox(height: 16),
|
||||
_buildRisks(context),
|
||||
_buildVision(context),
|
||||
const SizedBox(height: 16),
|
||||
if (isOwner)
|
||||
Divider(color: Theme.of(context).colorScheme.primary),
|
||||
|
@ -295,7 +295,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
CircleAvatar(
|
||||
radius: 80,
|
||||
backgroundImage:
|
||||
((profileImageUrl != null && profileImageUrl!.isNotEmpty))
|
||||
(profileImageUrl != null && profileImageUrl!.isNotEmpty)
|
||||
? NetworkImage(profileImageUrl!)
|
||||
: null,
|
||||
child: (profileImageUrl == null || profileImageUrl!.isEmpty)
|
||||
|
@ -535,7 +535,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget _buildVision(BuildContext context) {
|
||||
Widget _buildRisks(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Align(
|
||||
|
@ -561,7 +561,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
],
|
||||
),
|
||||
),
|
||||
if (isOwner) _editButton(context, editUserVisionInfo),
|
||||
if (isOwner) _editButton(context, editUserRiskInfo),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
@ -573,15 +573,12 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Vision and Goals',
|
||||
'Risk profile',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
myData.visions
|
||||
.map((x) => x.displayName)
|
||||
.join(',\n'),
|
||||
Text(myData.risk.displayName,
|
||||
style: const TextStyle(fontSize: 16)),
|
||||
],
|
||||
),
|
||||
|
@ -595,7 +592,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget _buildRisks(BuildContext context) {
|
||||
Widget _buildVision(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Align(
|
||||
|
@ -624,7 +621,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
if (isOwner)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: _editButton(context, editUserCommunicationInfo),
|
||||
child: _editButton(context, editUserVisionInfo),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -637,12 +634,15 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Risk profile',
|
||||
'Vision and Goals',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
Text(myData.risk.displayName,
|
||||
Text(
|
||||
myData.visions
|
||||
.map((x) => x.displayName)
|
||||
.join(',\n'),
|
||||
style: const TextStyle(fontSize: 16)),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -5,7 +5,7 @@ import '../components/my_elevated_button.dart';
|
|||
import '../components/text_bold.dart';
|
||||
import '../constants.dart';
|
||||
import '../enumerations.dart';
|
||||
import '../forms/corporate_culture_form.dart';
|
||||
import '../forms/risks_form.dart';
|
||||
import '../services/auth/auth_service.dart';
|
||||
import '../utils/helper_dialogs.dart';
|
||||
|
||||
|
@ -27,7 +27,7 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
VisionOption.innovativeProduct: false,
|
||||
VisionOption.exitStrategy: false,
|
||||
};
|
||||
AvailabilityOption? availability;
|
||||
CommunicationPreference? communicationPreference;
|
||||
|
||||
final AuthService _authService = AuthService();
|
||||
|
||||
|
@ -45,24 +45,24 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
|
||||
if (snapshot.exists) {
|
||||
final data = snapshot.data();
|
||||
setState(
|
||||
() {
|
||||
setState(() {
|
||||
if (data != null) {
|
||||
// Load Communication Preference
|
||||
if (data[Constants.dbFieldUsersCommunication] != null) {
|
||||
communicationPreference = CommunicationPreference.values
|
||||
.firstWhereOrNull((x) =>
|
||||
x.toString() == data[Constants.dbFieldUsersCommunication]);
|
||||
}
|
||||
// Load Vision options
|
||||
if (data?[Constants.dbFieldUsersVisions] != null) {
|
||||
if (data[Constants.dbFieldUsersVisions] != null) {
|
||||
for (var option in VisionOption.values) {
|
||||
selectedVisionOptions[option] =
|
||||
data?[Constants.dbFieldUsersVisions]
|
||||
data[Constants.dbFieldUsersVisions]
|
||||
.contains(option.toString());
|
||||
}
|
||||
}
|
||||
// Load Availability option
|
||||
if (data?[Constants.dbFieldUsersAvailability] != null) {
|
||||
availability = AvailabilityOption.values.firstWhereOrNull(
|
||||
(e) => e.toString() == data?[Constants.dbFieldUsersAvailability],
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,11 +74,12 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
|
||||
await userDoc.set(
|
||||
{
|
||||
Constants.dbFieldUsersCommunication:
|
||||
communicationPreference?.toString(),
|
||||
Constants.dbFieldUsersVisions: selectedVisionOptions.entries
|
||||
.where((entry) => entry.value)
|
||||
.map((entry) => entry.key.toString())
|
||||
.toList(),
|
||||
Constants.dbFieldUsersAvailability: availability?.toString(),
|
||||
},
|
||||
SetOptions(merge: true), // avoid overwriting existing data
|
||||
);
|
||||
|
@ -98,14 +99,15 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
}
|
||||
|
||||
Future<void> handleSubmit() async {
|
||||
if (communicationPreference == null) {
|
||||
showErrorSnackBar(context, 'Please select a communication preference.');
|
||||
return;
|
||||
}
|
||||
if (!isVisionSelected()) {
|
||||
_showSnackBar('Please select at least one long-term vision.');
|
||||
return;
|
||||
}
|
||||
if (availability == null) {
|
||||
_showSnackBar('Please select an availability option.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the form submission logic here
|
||||
bool success = await _saveDataToFirebase();
|
||||
if (success) {
|
||||
|
@ -122,8 +124,11 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
MaterialPageRoute(
|
||||
//
|
||||
// set following registration page HERE
|
||||
// this Page (UserVisionPage) is optional as of 22.06.24
|
||||
// and therefore not called anymore during RegProcess
|
||||
//
|
||||
builder: (context) => CultureValuesFormPage(
|
||||
//
|
||||
builder: (context) => RisksFormPage(
|
||||
isRegProcess: widget.isRegProcess,
|
||||
isEditMode: false,
|
||||
),
|
||||
|
@ -133,11 +138,11 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
if (widget.isEditMode == true) {
|
||||
// pass selectedOptions data back to caller
|
||||
Navigator.pop(context, {
|
||||
Constants.dbFieldUsersCommunication: communicationPreference,
|
||||
Constants.dbFieldUsersVisions: selectedVisionOptions.entries
|
||||
.where((entry) => entry.value)
|
||||
.map((entry) => entry.key)
|
||||
.toList(),
|
||||
Constants.dbFieldUsersAvailability: availability,
|
||||
});
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
|
@ -164,18 +169,16 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TextBold(text: 'Availability and commitment'),
|
||||
const Text(
|
||||
'How much time can you devote to the startup each week?',
|
||||
),
|
||||
...AvailabilityOption.values.map((option) {
|
||||
const TextBold(text: 'Communication preference'),
|
||||
const Text('How do you prefer to communicate in a team?'),
|
||||
...CommunicationPreference.values.map((option) {
|
||||
return RadioListTile(
|
||||
title: Text(option.displayName),
|
||||
value: option,
|
||||
groupValue: availability,
|
||||
onChanged: (AvailabilityOption? value) {
|
||||
groupValue: communicationPreference,
|
||||
onChanged: (CommunicationPreference? value) {
|
||||
setState(() {
|
||||
availability = value;
|
||||
communicationPreference = value;
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
@ -59,15 +59,22 @@ class UserService {
|
|||
}
|
||||
|
||||
static List<SkillOption> convertSkillStringToEnum(List<dynamic>? skills) {
|
||||
List<SkillOption> userSkills = [];
|
||||
if (skills != null && skills.isNotEmpty) {
|
||||
// Convert skills from strings to enum values
|
||||
List<SkillOption> userSkills = skills
|
||||
.map((skill) => SkillOption.values
|
||||
.firstWhere((x) => x.toString() == 'SkillOption.$skill'))
|
||||
.toList();
|
||||
return userSkills;
|
||||
for (var skill in skills) {
|
||||
try {
|
||||
SkillOption skillOption = SkillOption.values.firstWhere(
|
||||
(x) => x.toString() == 'SkillOption.$skill',
|
||||
);
|
||||
userSkills.add(skillOption);
|
||||
} catch (e) {
|
||||
// Ignore invalid values
|
||||
continue;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return userSkills;
|
||||
}
|
||||
|
||||
static List<SectorOption> convertSectorStringToEnum(List<dynamic>? sectors) {
|
||||
|
|
Loading…
Reference in New Issue