pickImage static method
Implementation
static Future<CroppedFile?> pickImage(BuildContext context) {
final completer = Completer<CroppedFile?>();
final dialog = GrxBottomSheetService(
context: context,
builder:
(controller) => Container(
padding: const EdgeInsets.all(10),
child: SafeArea(
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
ListTile(
leading: const Icon(GrxIcons.camera),
title: const GrxBodyText('Camera'),
onTap: () {
Navigator.pop(context, false);
completer.complete(openCamera());
},
),
ListTile(
leading: const Icon(GrxIcons.image),
title: const GrxBodyText('Galeria'),
onTap: () {
Navigator.pop(context, false);
completer.complete(openGallery());
},
),
],
),
),
),
);
dialog.show<bool?>().then((value) {
if (value ?? true) {
completer.complete(null);
}
});
return completer.future;
}