Skip to content
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

Enhancing UX by introducing User Profile Modification Feature #2268

Merged
merged 24 commits into from
Dec 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 35 additions & 45 deletions lib/views/after_auth_screens/profile/edit_profile_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class _EditProfilePageState extends State<EditProfilePage> {
),
),
body: SingleChildScrollView(
// SingleChildScrollView is a box in which a single widget can be scrolled.
child: Column(
children: [
SizedBox(
Expand Down Expand Up @@ -100,57 +99,23 @@ class _EditProfilePageState extends State<EditProfilePage> {
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
GestureDetector(
key: const Key('selectcamera'),
onTap: () {
_createModalSheetButton(
context,
Icons.camera_alt,
'Camera',
() {
Navigator.of(context).pop();
model.selectImage(camera: true);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.camera_alt,
size: SizeConfig
.screenHeight! *
0.05,
),
Text(
AppLocalizations.of(
context,
)!
.strictTranslate(
'Camera',
),
),
],
),
),
GestureDetector(
key: const Key('selectgallery'),
onTap: () {
_createModalSheetButton(
context,
Icons.photo_library,
'Gallery',
() {
Navigator.of(context).pop();
model.selectImage();
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.photo_library,
size: SizeConfig
.screenHeight! *
0.05,
),
Text(
AppLocalizations.of(
context,
)!
.strictTranslate(
'Gallery',
),
),
],
),
),
],
),
Expand Down Expand Up @@ -317,4 +282,29 @@ class _EditProfilePageState extends State<EditProfilePage> {
},
);
}

/// Button for the different image selection methods.
///
/// **params**:
/// * `context`:context for the sheet
/// * `icon`: icon for the method
/// * `label`: label for the method
/// * `onTap`: onTap funtionality for the method
///
/// **returns**:
/// * `Widget`: Icon Button for selecting different image selection method.
Widget _createModalSheetButton(
BuildContext context, IconData icon, String label, VoidCallback onTap) {
Dante291 marked this conversation as resolved.
Show resolved Hide resolved
return GestureDetector(
key: Key('select$label'),
onTap: onTap,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(icon, size: SizeConfig.screenHeight! * 0.05),
Dante291 marked this conversation as resolved.
Show resolved Hide resolved
Text(AppLocalizations.of(context)!.strictTranslate(label)),
],
),
);
}
}
Loading