-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed Edit Profile button and Added individuals buttons for edit profile pic and bio #293
Changes from all commits
fd08a01
c82076d
c6a6d80
63c122f
d81e0fc
cb96857
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,21 +129,59 @@ class _UserProfilePageState extends State<UserProfilePage> { | |
maxRadius: 50, | ||
), | ||
), | ||
if (state.isEditing == true) ...[ | ||
if (state.userProfile != null) ...[ | ||
Positioned( | ||
bottom: 0, | ||
right: 0, | ||
child: FloatingActionButton( | ||
onPressed: () => | ||
PhotoSelector.showPhotoSelector( | ||
context, | ||
onSelected: (image) { | ||
setState(() => _image = image); | ||
}, | ||
), | ||
onPressed: () { | ||
PhotoSelector.showPhotoSelector( | ||
context, | ||
onSelected: (image) { | ||
setState(() => _image = image); | ||
}, | ||
); | ||
context | ||
.read<ProfileBloc>() | ||
.add(EditProfilePic()); | ||
}, | ||
backgroundColor: kAccentColor, | ||
mini: true, | ||
child: const Icon(Icons.edit), | ||
), | ||
), | ||
], | ||
if (state.isPicEditing == true) ...[ | ||
Positioned( | ||
bottom: 0, | ||
right: 0, | ||
child: FloatingActionButton( | ||
onPressed: () { | ||
BlocProvider.of<ProfileBloc>(context) | ||
.add( | ||
SaveProfilePic( | ||
image: _image, | ||
), | ||
); | ||
}, | ||
backgroundColor: kAccentColor, | ||
mini: true, | ||
child: const Icon(Icons.add), | ||
child: const Icon(Icons.check), | ||
), | ||
), | ||
Positioned( | ||
bottom: 0, | ||
left: 0, | ||
child: FloatingActionButton( | ||
onPressed: () { | ||
BlocProvider.of<ProfileBloc>(context) | ||
.add(CancelEditProfilePic()); | ||
|
||
_image = null; | ||
}, | ||
backgroundColor: kErrorColor, | ||
mini: true, | ||
child: const Icon(Icons.close), | ||
), | ||
), | ||
] | ||
|
@@ -162,17 +200,59 @@ class _UserProfilePageState extends State<UserProfilePage> { | |
), | ||
if (state.userProfile != null) ...[ | ||
const SizedBox(height: 40), | ||
const Text( | ||
'About me', | ||
style: TextStyle( | ||
fontWeight: FontWeight.w700, | ||
fontSize: 11, | ||
color: Color(0xFF666666), | ||
), | ||
textAlign: TextAlign.left, | ||
Row( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this could be a Widget itself? |
||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
const Text( | ||
'About me', | ||
style: TextStyle( | ||
fontWeight: FontWeight.w700, | ||
fontSize: 11, | ||
color: Color(0xFF666666), | ||
), | ||
textAlign: TextAlign.left, | ||
), | ||
TextButton( | ||
key: const Key('save_edit_bio_button'), | ||
style: ButtonStyle( | ||
shape: MaterialStateProperty.all( | ||
RoundedRectangleBorder( | ||
borderRadius: | ||
BorderRadius.circular(200), | ||
), | ||
), | ||
), | ||
onPressed: () { | ||
if (state.isBioEditing == true) { | ||
/// TODO: Implement save profile image | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not relevant comment? |
||
|
||
BlocProvider.of<ProfileBloc>(context).add( | ||
SaveBio( | ||
bio: bioController.text, | ||
), | ||
); | ||
} else { | ||
context | ||
.read<ProfileBloc>() | ||
.add(EditBio()); | ||
} | ||
}, | ||
child: Text( | ||
state.isBioEditing == true | ||
? 'Save changes' | ||
: 'Edit Bio', | ||
style: const TextStyle( | ||
fontSize: 11, | ||
color: kAccentColor, | ||
fontWeight: FontWeight.w700, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
const SizedBox(height: 10), | ||
if (state.isEditing == true) ...[ | ||
if (state.isBioEditing == true) ...[ | ||
//idhr bio editing start | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove |
||
Row( | ||
children: [ | ||
Expanded( | ||
|
@@ -215,8 +295,9 @@ class _UserProfilePageState extends State<UserProfilePage> { | |
), | ||
const SizedBox(height: 4), | ||
Row( | ||
mainAxisAlignment: | ||
MainAxisAlignment.spaceBetween, | ||
children: [ | ||
const SizedBox(width: 16), | ||
Text( | ||
'Maximum 150 characters', | ||
style: Theme.of(context) | ||
|
@@ -265,90 +346,6 @@ class _UserProfilePageState extends State<UserProfilePage> { | |
], | ||
), | ||
), | ||
const SizedBox(height: 40), | ||
TextButton( | ||
key: const Key('save_edit_button'), | ||
style: ButtonStyle( | ||
overlayColor: MaterialStateColor.resolveWith( | ||
(states) => state.isEditing == true | ||
? Colors.white.withOpacity(0.1) | ||
: kAccentColor.withOpacity(0.1), | ||
), | ||
backgroundColor: state.isEditing == true | ||
? MaterialStateProperty.all( | ||
kAccentColor, | ||
) | ||
: null, | ||
minimumSize: MaterialStateProperty.all( | ||
const Size(double.infinity * 0.75, 52), | ||
), | ||
shape: MaterialStateProperty.all( | ||
RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(200), | ||
side: const BorderSide( | ||
color: kAccentColor, | ||
), | ||
), | ||
), | ||
), | ||
onPressed: () { | ||
if (state.isEditing == true) { | ||
BlocProvider.of<ProfileBloc>(context).add( | ||
SaveProfile( | ||
bio: bioController.text, | ||
image: _image, | ||
), | ||
); | ||
} else { | ||
context | ||
.read<ProfileBloc>() | ||
.add(EditProfile()); | ||
} | ||
}, | ||
child: Text( | ||
state.isEditing == true | ||
? 'Save changes' | ||
: 'Edit profile', | ||
style: TextStyle( | ||
color: state.isEditing == true | ||
? Colors.white | ||
: kAccentColor, | ||
fontWeight: FontWeight.w700, | ||
), | ||
), | ||
), | ||
if (state.isEditing == true) ...[ | ||
const SizedBox(height: 10), | ||
TextButton( | ||
key: const Key('cancel_edit_button'), | ||
style: ButtonStyle( | ||
minimumSize: MaterialStateProperty.all( | ||
const Size(double.infinity * 0.75, 52), | ||
), | ||
shape: MaterialStateProperty.all( | ||
RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(200), | ||
), | ||
), | ||
), | ||
onPressed: () { | ||
BlocProvider.of<ProfileBloc>(context) | ||
.add(CancelEditProfile()); | ||
|
||
_image = null; | ||
bioController.value = TextEditingValue( | ||
text: state.userProfile?.profile.bio ?? '', | ||
); | ||
}, | ||
child: const Text( | ||
'Cancel', | ||
style: TextStyle( | ||
color: kAccentColor, | ||
fontWeight: FontWeight.w700, | ||
), | ||
), | ||
), | ||
], | ||
] else ...[ | ||
// TODO only for MVP (remove later) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this comment is still relevant? |
||
const SizedBox(height: 40), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember how this works, but shouldn't the image be passed to this event?