Comments (3)
Can you post how you use it?
from image_gallery_saver.
Hello,
There is my code below:
class Photos extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: <Widget>[
IconButton(
icon: Icon(Icons.camera_alt),
onPressed: () => _onConfirmImage(ImageSource.camera),
),
IconButton(
icon: Icon(Icons.filter),
onPressed: () => _onConfirmImage(ImageSource.gallery),
),
],
),
);
}
void _onConfirmImage(ImageSource source) async {
if (Platform.isAndroid && source == ImageSource.camera) {
final status = await PermissionHandler().checkPermissionStatus(PermissionGroup.storage);
if (status != PermissionStatus.granted) {
await PermissionHandler().requestPermissions([PermissionGroup.storage]);
}
}
File file = await ImagePicker.pickImage(source: source);
if (file != null) {
_uploadImage(file, source);
}
}
Future<Null> _uploadImage(File imageFile, ImageSource source) async {
try {
String imageId = "${DateTime.now().millisecondsSinceEpoch}_${path.basename(imageFile.path)}";
List<int> imageBytes = imageFile.readAsBytesSync();
/// Save to phones gallery
if (source != ImageSource.gallery) {
_saveToGallery(imageBytes);
}
/// Save to app directory
Directory directory = await getApplicationDocumentsDirectory();
File imageCopy = File("${directory.path}/imagens_auditorias/$imageId");
imageCopy.createSync(recursive: true);
imageCopy.writeAsBytesSync(imageBytes);
} catch (error) {
debugPrint(error.toString());
}
}
}
/// Out of the widget
void _saveToGallery(List<int> imageBytes) {
try {
ImageSaver.saveFile(fileData: Uint8List.fromList(imageBytes));
} catch (error) {
debugPrint(error.toString());
}
}
from image_gallery_saver.
I can't see you You can calling my method and print the time before and after calling my method to verify if it is caused by my method. Do you use my plugin?
from image_gallery_saver.
Related Issues (20)
- MissingPluginException(No implementation found for method saveImageToGallery on channel image_gallery_saver) HOT 4
- Running example on android device leads to an error
- Solutions about desktop?
- Error: 'Uint8List' isn't a type
- saveImage() changes the image size
- No such file or directory
- App not compiling with kotlin_version 1.8.21 HOT 2
- Add iOS privacy manifests HOT 4
- 是否有添加鸿蒙平台的打算 HOT 1
- vdhhdhdd HOT 2
- gmer555er
- B
- ios 最新版本 saveVideo 本地 文件报错
- Gradle version with vulnerabilities HOT 1
- not worked in android version 9 (image not saved in gallery) HOT 1
- Execution failed for PlatformAttrTransform: Android/sdk/platforms/android-30/android.jar
- Namespace not specified HOT 3
- Privacy manifest files support HOT 1
- Execution failed for task ':image_gallery_saver:compileDebugKotlin'. > Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17). HOT 2
- The image or video saved in the album after downloading failed to be delivered across the air
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image_gallery_saver.