Skip to content

Commit

Permalink
adding requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dante291 committed Dec 26, 2023
1 parent 87be0f8 commit ff9d651
Showing 1 changed file with 35 additions and 45 deletions.
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) {
return GestureDetector(
key: Key('select$label'),
onTap: onTap,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(icon, size: SizeConfig.screenHeight! * 0.05),
Text(AppLocalizations.of(context)!.strictTranslate(label)),
],
),
);
}
}

0 comments on commit ff9d651

Please sign in to comment.