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.

img.png

img_1.png

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 is Colors.indigo.
  • borderColor: The border color of the color selector and size selector. Default is Colors.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.