insta_color_picker

An Instagram-inspired Flutter color picker with paged palettes, animated color buttons, and a selected-color preview.

Installation

dependencies:
  insta_color_picker: ^0.0.5

Usage

Keep the page controller in your widget's state and dispose it when finished. Update selectedColor in response to onColorSelected.

import 'package:flutter/widgets.dart';
import 'package:insta_color_picker/insta_color_picker.dart';

class ColorPickerExample extends StatefulWidget {
  const ColorPickerExample({super.key});

  @override
  State<ColorPickerExample> createState() => _ColorPickerExampleState();
}

class _ColorPickerExampleState extends State<ColorPickerExample> {
  final _pageController = PageController();
  Color _color = const Color(0xFFFFFFFF);

  @override
  void dispose() {
    _pageController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return InstaColorPicker(
      pageController: _pageController,
      selectedColor: _color,
      onColorSelected: (color) => setState(() => _color = color),
    );
  }
}

Color palettes

colorsList takes a list of palettes, with each palette displayed on one page:

const customPalettes = [
  [PaletteColors.magenta, PaletteColors.palePeach, PaletteColors.indigo],
  ColorPalettes.oceanBreeze,
  ColorPalettes.autumnVibes,
  ColorPalettes.pastelDream,
];

Pass colorsList: customPalettes to the picker. An empty list displays only the selected-color preview; an empty palette displays a blank page.

Customization

  • Buttons: colorButtonSize, colorButtonBorderColor.
  • Preview: selectedColor, selectedColorSize, icon, iconSize, iconPadding.
  • Layout: height, colorPaletteHeight.
  • Page indicators: activeDotColor, activeDotScale, dotColor, dotHeight, dotWidth, pageIndicatorSpacing.

Buttons shrink to fit the available palette space and never grow beyond colorButtonSize. Allow enough height for the palette and page indicators when customizing their sizes. Null iconPadding uses the default padding.

See the example application. Run it with:

cd example
flutter pub get
flutter run

Libraries

insta_color_picker
An Instagram-inspired color picker and predefined color palettes.