videoPickerDialog method
Future<File?>
videoPickerDialog(
- BuildContext context, {
- bool shouldCrop = true,
- bool shouldCompress = false,
- bool onlyShowRecord = false,
Implementation
Future<File?> videoPickerDialog(BuildContext context, {bool shouldCrop = true,bool shouldCompress=false, bool onlyShowRecord = false}) async {
return showCupertinoModalPopup(
context: context,
builder: (_) => CupertinoActionSheet(
actions: [
if(onlyShowRecord)
// Container(
// padding: EdgeInsets.symmetric(horizontal: 16,vertical: 16,),
// child: CustomText.headingLarge('Verify Yourself'),
// ),
// vSizedBox2,
CupertinoActionSheetAction(
onPressed: () async {
},
child: CustomText.heading(
'Verify Yourself',
color: MyColors.blackColor,
fontWeight: FontWeight.w700,
fontSize: 24,
)),
CupertinoActionSheetAction(
onPressed: () async {
File? image;
// image = await pickVideo(isGallery: false,shouldCompress: shouldCompress);
// FilePicker.platform.pickFiles(allowMultiple: false);
image = await VideoRecorderPage.open(context);
// image = await recordVideo();
// image = await pickVideo(isGallery: false,shouldCompress: shouldCompress);
// showSnackbar('video logs 1.2: picked video $image',storeLogs: true);
customPrint('image--2--$image');
if (image != null) {
// if (isUserProfile) {
// profile_image = image;
// } else {
// pet_image = image;
// }
try{
// showSnackbar('video logs 1.3: trying to pop now $image',storeLogs: true);
Navigator.pop(context, image);
// showSnackbar('video logs 1.301: Pop Successful!!!!!!!!',storeLogs: true);
}catch(e){
// showSnackbar('video logs 1.4: Error in popping $e',storeLogs: true);
customPrint('Error in context popping');
CustomNavigation.pop(context, image);
// Navigator.pop(MyGlobalKeys.navigatorKey.currentContext!, image);
}
}
// popPage(context: ctx);
},
child: CustomText.heading(
'Record a Video',
color: CustomStylesConfig.primaryColor,
fontWeight: FontWeight.w500,
fontSize: 20,
)),
if(onlyShowRecord==false)
CupertinoActionSheetAction(
onPressed: () async {
File? image;
image = await pickVideo(context,isGallery: true,shouldCompress: shouldCompress);
customPrint('image--4--$image');
try{
Navigator.pop(context, image);
}catch(e){
customPrint('Error in context popping');
CustomNavigation.pop(context, image);
// Navigator.pop(MyGlobalKeys.navigatorKey.currentContext!, image);
}
// Navigator.pop(context, image);
// popPage(context: ctx, image);
},
child: CustomText.heading(
'Gallery',
color: CustomStylesConfig.primaryColor,
fontWeight: FontWeight.w500,
fontSize: 20,
)),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () => CustomNavigation.pop(context),
child: CustomText.heading(
'Close',
color: CustomStylesConfig.primaryColor,
fontWeight: FontWeight.w500,
fontSize: 20,
)),
));
}