checkProfileProgress function
Implementation
String checkProfileProgress(BuildContext context) {
final CoreState state = StoreProvider.state<CoreState>(context)!;
// check if profile has data
bool userBioDataFilled() {
if (state.userState!.userProfile!.userBioData!.firstName!.isValid() &&
state.userState!.userProfile!.userBioData!.lastName!.isValid()) {
return true;
}
return false;
}
// check if profile has data
bool userEmailFilled() {
if (state.userState!.userProfile!.primaryEmailAddress != null) {
if (state.userState!.userProfile!.primaryEmailAddress!.isValid()) {
return true;
}
return false;
}
return false;
}
final bool isBioDataFilledChecker = userBioDataFilled();
final bool isUserEmailFilledChecker = userEmailFilled();
final bool isBioDataFilled = isBioDataFilledChecker;
final bool isUserEmailFilled = isUserEmailFilledChecker;
int totalCount = 0;
final List<bool> completeProgressSteps = <bool>[
isBioDataFilled,
isUserEmailFilled
];
final Map<int, bool> isStepCompleted = completeProgressSteps.asMap();
for (final bool value in isStepCompleted.values) {
if (value) {
totalCount += 25;
}
}
return '$totalCount';
}