flutter_image_uploading 0.0.2 flutter_image_uploading: ^0.0.2 copied to clipboard
Using this package we can easily pick the file from gallery, file manager or camera with asking user permission.
Using this package we can easily pick the file from gallery, file manager or camera with asking user permission.
Features #
For using this * With the user permission to get images from the gallery or images taken from the camera. * you can get document file
Getting started #
Android: #
Add permissions to your AndroidManifest.xml file. There's a debug, main and profile version which are chosen depending on how you start your app. In general, it's sufficient to add permission only to the main version.
<!-- Permissions options for the `storage` group -->
<uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Permissions options for the `camera` group -->
<uses-permission android:name="android.permission.CAMERA"/>
</uses-permission>
IOS: #
Add permission to your Info.plist file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCameraUsageDescription</key>
<string>camera</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>photos</string>
</dict>
</plist>
You must list permission you want to use in your application :
Add the following to your Podfile file:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# You can remove unused permissions here
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1'
]
end
end
end
Usage #
call this Function -
void getImageFile() {
ImageHelper().showPhotoBottomDialog(context, Platform.isIOS,(file) {
setState(() {
print("File=${file.toString()}");
this.file=file;
});
},
fileFormat: FileFormat.image,//by default is image
);
}
You can upload video then select FileFormat
fileFormat: FileFormat.video,