openUploader function
dynamic
openUploader(
- BuildContext context, {
- required dynamic onPicked(),
- Color? lineColor,
- double? lineThickness,
- String variant = 'primary',
Implementation
openUploader(
BuildContext context, {
required Function(FileInfo) onPicked,
Color? lineColor,
double? lineThickness,
String variant = 'primary',
}) {
menu(
context,
MenuList(
[
MenuListItem(
Icon(
Icons.photo_library_rounded,
color: BilionsTheme.getColor(variant),
),
title: 'Gallery',
subTitle: 'Select image from your photo gallery',
onPressed: () async {
FileInfo file = await showFileUpload(ImageSource.gallery);
onPicked(file);
},
),
MenuListItem(
Icon(
Icons.camera,
color: BilionsTheme.getColor(variant),
),
title: 'Camera',
subTitle: 'Open camera to take photo',
onPressed: () async {
FileInfo file = await showFileUpload(ImageSource.camera);
onPicked(file);
},
),
],
lineColor: lineColor,
lineThickness: lineThickness,
),
);
}