product_size_color_selector 1.1.1
product_size_color_selector: ^1.1.1 copied to clipboard
A Flutter package for selecting colors and sizes from predefined lists, with callbacks for selections and graceful handling of edge cases.
product_size_color_selector #
This is a Flutter package that provides a user-friendly way for users to select colors and sizes. It allows users to pick from a predefined list of colors and sizes, and provides a callback mechanism to handle the selection. The package also handles edge cases like empty color and size lists gracefully.


Features #
- Allows users to pick colors and sizes from a predefined list.
- Supports custom color and size palettes.
- Provides a callback mechanism to handle color and size selection.
- Handles edge cases like empty color and size lists gracefully.
Installation #
Add the following dependency to your pubspec.yaml file:
dependencies:
color_size_picker: ^0.0.1
Then, run flutter pub get to install the package.
Usage #
Import the package in your Dart file:
import 'package:color_size_picker/color_size_picker.dart';
Use the ColorSelector in your app:
ColorSelector(
colors: ["Green", "Red", "Blue", "Yellow"],
onChangeColor: (selectedColor) {
print("Selected color: $selectedColor");
},
)
Use the SizeSelector in your app:
SizeSelector(
sizes: ["S", "M", "L", "XL"],
onChangeSize: (size) {
setState(() {
print("Selected size: $size");
});
},
),
Properties #
colors: A list of colors to display in the color selector.sizes: A list of sizes to display in the size selector.onChangeColor: A callback function that is called when a color is selected.onChangeSize: A callback function that is called when a size is selected.backgroundColor: The background color of the color selector and size selector. Default isColors.indigo.borderColor: The border color of the color selector and size selector. Default isColors.black.
Contributing Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License This project is licensed under the MIT License. See the LICENSE file for details.