n_image_picker 1.0.0 n_image_picker: ^1.0.0 copied to clipboard
Configurable and easy-to-use cross-platform image selector.
Neil's Image Picker #
With this widget, you can: #
- Select images
- Load images on startup
- Name the JSON key of the image
- Obtain the multipart file
- Have error control when loading the image
- Change the widgets displayed when loading the initial image, when selecting an image, when undoing the selection of an image, and when an error occurs.
Controller properties #
nImagePickerController.bytes -> Uint8List // Image in bytes list
nImagePickerController.error -> bool // When onLoadingImage has a url
nImagePickerController.hasImage -> bool
nImagePickerController.file -> File
nImagePickerController.fileTypes -> List<String> // List of upported formats
nImagePickerController.image -> Image // Image filetype
nImagePickerController.imageKey -> String // key for json upload image
nImagePickerController.multipartFile -> MultipartFile // File ready for upload
nImagePickerController.path -> Path
nImagePickerController.headers -> Map<String, String> // Map for headers, this need a backend open port for your domain
Controller metodhs #
nImagePickerController.setFromResponse(response: Response, url: String) // Set the image file from http response and url
nImagePickerController.setFromPath(path: String) // This dont work in web!
nImagePickerController.pickImage() // Open the image dialog picker
nImagePickerController.removeImage(notify: bool)
- Create a controller and add a listener
NImagePickerController nImagePickerController = NImagePickerController();
@override
void initState() {
super.initState();
nImagePickerController.addListener(() => setState(() {}));
}
@override
void dispose() {
super.dispose();
nImagePickerController.dispose();
}
- Use the widget ;D
NImagePicker(
controller : nImagePickerController,
onLoadingImage : 'https://w.wallhaven.cc/full/jx/wallhaven-jxd1x5.jpg',
bankgroundColor : Colors.blueGrey.withOpacity(0.5),
height : 250,
width : 250,
enable : true,
filterOpacity : 0.2,
borderRadius : BorderRadius.circular(50),
fit : BoxFit.cover,
border : Border.all(color: Colors.black, width: 4),
shadow : const BoxShadow(color: Colors.black, blurRadius: 10, blurStyle: BlurStyle.outer),
margin : const EdgeInsets.all(40),
),