|
|
|
|
@ -34,7 +34,16 @@ class SettingsLearningController extends State<SettingsLearning> {
|
|
|
|
|
setPublicProfile(bool isPublic) {
|
|
|
|
|
pangeaController.userController.updateProfile(
|
|
|
|
|
(profile) {
|
|
|
|
|
profile.userSettings.publicProfile = isPublic;
|
|
|
|
|
// set user DOB to younger that 18 if private and older than 18 if public
|
|
|
|
|
if (isPublic) {
|
|
|
|
|
profile.userSettings.dateOfBirth = DateTime.now().subtract(
|
|
|
|
|
const Duration(days: 18 * 365),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
profile.userSettings.dateOfBirth = DateTime.now().subtract(
|
|
|
|
|
const Duration(days: 17 * 365),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return profile;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@ -91,7 +100,11 @@ class SettingsLearningController extends State<SettingsLearning> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool get publicProfile =>
|
|
|
|
|
pangeaController.userController.profile.userSettings.publicProfile;
|
|
|
|
|
pangeaController.userController.profile.userSettings.dateOfBirth
|
|
|
|
|
?.isBefore(
|
|
|
|
|
DateTime.now().subtract(const Duration(days: 18 * 365)),
|
|
|
|
|
) ??
|
|
|
|
|
false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|