gird_sai 1.0.1+1
gird_sai: ^1.0.1+1 copied to clipboard
A Flutter plugin for selecting images from the Android and iOS image library, and taking new pictures with the camera as well as from device gallery also with multiple image selecting option with resi [...]
gird_sai simplifies image and file selection in Flutter, offering camera, gallery, file browsing, cropping, and multi-file support.
Features #
The gird_sai package simplifies the process of selecting images and files in Flutter applications. It provides an easy-to-use interface for picking images from the camera, gallery, or file system, with optional support for cropping images and selecting multiple files. This package is ideal for developers who need to integrate image and file selection with customizable options in their apps
Usage #
// Make sure you import your utility class
class ImagePickerExample extends StatefulWidget {
@override
_ImagePickerExampleState createState() => _ImagePickerExampleState();
}
class _ImagePickerExampleState extends State<ImagePickerExample> {
File? _selectedImage;
Future<void> _pickImage() async {
// Call the utility class's pickImage method
var image = await ImagePickerUtil.pickImage(
context: context,
isMultipleFile: false,
// Set this to true if you want to select multiple images
isFromFile: false,
// Set this to true to browse files
isImgCropeble: true,
// Set to true if you want to allow cropping
isOnlyCamera: false, // Set to true if you want to limit the user to the camera only
);
if (image != null && mounted) {
setState(() {
_selectedImage = image is List ? image[0] : image; // Handle both single and multiple images
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Image Picker Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_selectedImage != null
? Image.file(_selectedImage!) // Display selected image
: Text('No image selected'),
SizedBox(height: 20),
ElevatedButton(
onPressed: _pickImage, // Call the image picker when pressed
child: Text('Pick an Image'),
),
],
),
),
);
}
}