pickGalleryMedia method
Implementation
Future pickGalleryMedia(BuildContext context) async {
final MediaSource? source = ModalRoute.of(context)!.settings.arguments as MediaSource?;
final getMedia = source == MediaSource.image
? ImagePicker().pickImage
: ImagePicker().pickVideo;
final media = await (getMedia(source: ImageSource.gallery) as FutureOr<XFile>);
final file = File(media.path);
Navigator.of(context).pop(file);
}