flutter_material_color_picker 1.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 97

Flutter Material Color Picker pub package

Material Color picker is a Flutter widget, that can be customizable.

By default, it's Material Colors, but you can define your own colors.

You can also use CircleColor widget to display color in your app. Example, you can set the color picker in a dialog and display the selected color in a ListTile, for settings.

How to use it #

These examples use a static color for 'selectedColor', but you can use a variable (state)

Add to your Flutter project #

You just need to add flutter_material_color_picker as a dependency in your pubspec.yaml file.

flutter_material_color_picker: ^1.0.5

Import #

import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';

Basic #

    onColorChange: (Color color) {
        // Handle color changes
    selectedColor: Colors.red

Listen main color changes #

    onColorChange: (Color color) {
        // Handle color changes
    onMainColorChange: (ColorSwatch color) {
        // Handle main color changes
    selectedColor: Colors.red

Disallow Shades #

    allowShades: false, // default true
    onMainColorChange: (ColorSwatch color) {
        // Handle main color changes
    selectedColor: Colors.red

If allowShades is set to false then only main colors will be shown and allowed to be selected. onColorChange will not be called, use onMainColorChange instead.

Custom colors #

In this example, custom colors are a list of Material Colors (class who extend of ColorSwatch). But you can create your own list of ColorSwatch.

    onColorChange: (Color color) {
        // Handle color changes
    selectedColor: Colors.red,
    colors: [

Screenshot #

Color selection #

There is two step, first choose the main color, and when you press it, you have to choose a shade of the main color. By default it's all Material Colors, but you can define custom colors, a list of ColorSwatch.

Example of usages #

You can insert the color picker into a Dialog

Display color #

You can use CircleColor widget, to display the selected color into your settings for example.


1.0.5 #

  • Fix issue with elevation property that cause crashes

1.0.4 #

1.0.3 #

  • Add onBack callback to catch back button press (See this issue)
  • Fix color shade order mistake (Thanks to @pczn0327)
  • Code improvement

1.0.2 #

  • Add spacing option, to define the minimum space between each color
  • Add spacing value in the calculation to determine the number of color to display per line
  • Remove padding added on shades by this PR
  • You should CHECK SIZE of colors, it could be changed with this update :/

1.0.1 #

  • Add onlyShadeSelection option, to have only shade changes callback (Thanks @peyter213)
  • Add predefined colors (accents and full material colors), since this issue
  • Improve code and update example

1.0.0 #

  • Code improvement
  • Move to stable version 1.0.0

0.0.5 #

  • Add allowShades property

0.0.4 #

  • Fix icon on selected color
  • Force icon's color (if light color set black icon, and if dark color set white icon)

0.0.3+1 #

  • Edit README

0.0.3 #

  • Improve design (use GridView)
  • Add (customizable) icon on CircleColor when selected

0.0.2 #

  • Add support of ColorSwatch and not MaterialColor
  • Fix bug of colors null
  • Fix bug if you just press main color, and not shade color, the change event not called
  • Improve code

0.0.1 #

  • Initial release


flutter_material_color_picker_example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_material_color_picker: ^1.0.5

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8