The AwesomeImageSelector
is a Flutter widget that allows you to display and select images with ease. It provides a customizable interface for selecting images and triggers a callback when the image is changed or added. This widget is perfect for scenarios where you need to offer users the ability to choose or update images within your app.
- Display an image within a customizable card layout.
- Provide callbacks for handling image changes.
- Customize the appearance of the card, including outer margins and background color.
- Supports displaying an initial image, which can be updated through user interaction.
- Built-in support for specifying custom text for selecting and changing images.
To use the AwesomeImageSelector
widget in your Flutter project, follow these steps:
- Add the package to your
pubspec.yaml
file:
dependencies:
awesome_image_selector: ^<latest_version>
- Import the package in your Dart code:
import 'package:awesome_image_selector/awesome_image_selector.dart';
- Add the
AwesomeImageSelector
widget to your widget tree:
AwesomeImageSelector(
onImageChanged: (XFile file) {
// Handle the changed image file here
},
// can be any image, network mostly
initialImage: AssetImage('assets/placeholder_image.png'),
cardOuterMargin: EdgeInsets.all(16.0), // optional
bgCardColor: Colors.grey[200],
selectText: 'Select Image',
changeText: 'Change Image',
)
For a more comprehensive example, you can check the /example
folder in the package repository.
- For more details and usage examples, visit the official documentation at https://salehwaleed.com.
- If you encounter any issues, have questions, or want to contribute to the package, please visit the GitHub repository.
- This package is licensed under the MIT License.
Made with ❤️ by Salih