flutter_material_color_picker 0.0.5

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 89

Flutter Material Color Picker #

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: ^0.0.5

Import #

import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';

Basic #

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

Listen main color changes #

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

Disallow Shades #

MaterialColorPicker(
    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.

MaterialColorPicker(
    onColorChange: (Color color) {
        // Handle color changes
    },
    selectedColor: Colors.red,
    colors: [
        Colors.red,
        Colors.deepOrange,
        Colors.yellow,
        Colors.lightGreen
    ],
)

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.

0.05 #

  • 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

example/README.md

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:


dependencies:
  flutter_material_color_picker: ^0.0.5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
0.0.5 Jan 28, 2019 Go to the documentation of flutter_material_color_picker 0.0.5 Download flutter_material_color_picker 0.0.5 archive
0.0.4 Sep 10, 2018 Go to the documentation of flutter_material_color_picker 0.0.4 Download flutter_material_color_picker 0.0.4 archive
0.0.3+1 Sep 10, 2018 Go to the documentation of flutter_material_color_picker 0.0.3+1 Download flutter_material_color_picker 0.0.3+1 archive
0.0.3 Sep 10, 2018 Go to the documentation of flutter_material_color_picker 0.0.3 Download flutter_material_color_picker 0.0.3 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
90
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
89
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/flutter_material_color_picker.dart.

Run flutter format to format lib/flutter_material_color_picker.dart.

Format lib/src/colors.dart.

Run flutter format to format lib/src/colors.dart.

Format lib/src/material_color_picker.dart.

Run flutter format to format lib/src/material_color_picker.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.58.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test