Skip to content

Commit

Permalink
pronouns in onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-lox committed Nov 22, 2024
1 parent 31a92f7 commit 74c87e8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/domain_layer/entities/onboarding_user_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class OnboardingUserInfo {
MemFile? picture;
MemFile? banner;
String? about = '';
String? pronouns = '';
String? nip05;
String? website = '';
bool nip46 = false;
Expand All @@ -19,6 +20,7 @@ class OnboardingUserInfo {
this.picture,
this.banner,
this.about,
this.pronouns,
this.nip05,
this.website,
this.nip46 = false,
Expand Down
14 changes: 11 additions & 3 deletions lib/presentation_layer/components/edit_profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class EditProfile extends ConsumerStatefulWidget {
final Function(String) onLud06Changed;
final String initialLud16;
final Function(String) onLud16Changed;
final String initialPronouns;
final Function(String) onPronounsChanged;

const EditProfile({
super.key,
Expand All @@ -38,6 +40,7 @@ class EditProfile extends ConsumerStatefulWidget {
required this.initialWebsite,
required this.initialLud06,
required this.initialLud16,
required this.initialPronouns,
required this.onNameChanged,
required this.pictureCallback,
required this.bannerCallback,
Expand All @@ -46,6 +49,7 @@ class EditProfile extends ConsumerStatefulWidget {
required this.onWebsiteChanged,
required this.onLud06Changed,
required this.onLud16Changed,
required this.onPronounsChanged,
});

@override
Expand All @@ -67,6 +71,7 @@ class _EditProfileState extends ConsumerState<EditProfile> {
'website': TextEditingController(text: widget.initialWebsite),
'lud06': TextEditingController(text: widget.initialLud06),
'lud16': TextEditingController(text: widget.initialLud16),
'pronouns': TextEditingController(text: widget.initialPronouns),
};

// Adding listeners to each controller to call the corresponding callback when the text changes.
Expand All @@ -91,6 +96,9 @@ class _EditProfileState extends ConsumerState<EditProfile> {
case 'lud16':
widget.onLud16Changed(controller.text);
break;
case 'pronouns':
widget.onPronounsChanged(controller.text);
break;
}
});
});
Expand Down Expand Up @@ -170,10 +178,10 @@ class _EditProfileState extends ConsumerState<EditProfile> {
children: [
_buildInputField('Name', _controllers['name']!),
_buildInputField('Bio', _controllers['about']!, isMultiline: true),
_buildInputField('pronouns', _controllers['pronouns']!),
_buildInputField('Website', _controllers['website']!),
_buildInputField('nip05', _controllers['nip05']!),
_buildInputField('lud06', _controllers['lud06']!),
_buildInputField('lud16', _controllers['lud16']!),
_buildInputField('username (nip05)', _controllers['nip05']!),
_buildInputField('lightning address', _controllers['lud16']!),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ ${_privateKey.mnemonicSentence}
picture: uploadedPicture,
banner: uploadedBanner,
about: widget.userInfo.about,
pronouns: widget.userInfo.pronouns,
website: widget.userInfo.website,
nip05: widget.userInfo.nip05,
lud06: widget.userInfo.lud06,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ class _OnboardingProfileState extends ConsumerState<OnboardingProfile> {
onAboutChanged: (value) {
widget.signUpInfo.about = value;
},
initialPronouns: widget.signUpInfo.pronouns ?? '',
onPronounsChanged: (value) {
widget.signUpInfo.pronouns = value;
},
initialNip05: widget.signUpInfo.nip05 ?? '',
onNip05Changed: (value) {
widget.signUpInfo.nip05 = value;
Expand Down

0 comments on commit 74c87e8

Please sign in to comment.