flutter_colorpicker 0.0.5

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

flutter_colorpicker #

pub package

A HSV color picker for your flutter app.

Getting Started #

Installation #

Add this to your pubspec.yaml (or create it):

dependencies:
  flutter_colorpicker: any

Then run the flutter tooling:

flutter packages get

Or upgrade the packages with:

flutter packages upgrade

Example #

Use it in [showDialog] widget:

// create some value
Color pickerColor = new Color(0xff443a49);
Color currentColor = new Color(0xff443a49);
ValueChanged<Color> onColorChanged;

// bind some values with [ValueChanged<Color>] callback
changeColor(Color color) {
    setState(() => pickerColor = color);
}

// raise the [showDialog] widget
showDialog(
    context: context,
    child: new AlertDialog(
        title: const Text('Pick a color!'),
        content: new SingleChildScrollView(
            child: new ColorPicker(
                pickerColor: pickerColor,
                onColorChanged: changeColor,
                enableLabel: true,
                pickerAreaHeightPercent: 0.8,
            ),
        ),
        actions: <Widget>[
            new FlatButton(
                child: new Text('Got it'),
                onPressed: () {
                    setState(() => currentColor = pickerColor);
                    Navigator.of(context).pop();
                },
            ),
        ],
    ),
)

preview

Details in example/ folder.

I have created the ColorPicker widget so you can use the color picker out of the box. But you can create your own style with the CustomPaint.

CHANGELOG #

[0.0.5]

  • Replace some deprecated functions.
  • Bump SDK version.

[0.0.4]

  • Replace a parameter from colorPainterHeight to pickerAreaHeightPercent to give a ratio on the picker area.

[0.0.3]

  • Optimization for responsibility design.

[0.0.2]

  • Change widget's width.

[0.0.1+1]

  • Update readme.

[0.0.1]

  • Initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart';

main() => runApp(
      new MaterialApp(
        home: new Scaffold(
          appBar: new AppBar(
            title: const Text('Flutter Color Picker Example'),
          ),
          body: new MyApp(),
        ),
      ),
    );

class MyApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Color pickerColor = new Color(0xff443a49);
  Color currentColor = new Color(0xff443a49);

  ValueChanged<Color> onColorChanged;

  changeColor(Color color) {
    setState(() {
      pickerColor = color;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new Center(
      child: new RaisedButton(
        elevation: 3.0,
        onPressed: () {
          pickerColor = currentColor;
          showDialog(
            context: context,
            builder: (BuildContext context) {
              return new AlertDialog(
                title: const Text('Pick a color!'),
                content: new SingleChildScrollView(
                  child: new ColorPicker(
                    pickerColor: pickerColor,
                    onColorChanged: changeColor,
                    colorPickerWidth: 1000.0,
                    pickerAreaHeightPercent: 0.7,
                  ),
                ),
                actions: <Widget>[
                  new FlatButton(
                    child: new Text('Got it'),
                    onPressed: () {
                      setState(() => currentColor = pickerColor);
                      Navigator.of(context).pop();
                    },
                  ),
                ],
              );
            },
          );
        },
        child: new Text('Change me'),
        color: currentColor,
        textColor: const Color(0xffffffff),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_colorpicker: ^0.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_colorpicker/flutter_colorpicker.dart';
  
Version Uploaded Documentation Archive
0.2.4 May 19, 2019 Go to the documentation of flutter_colorpicker 0.2.4 Download flutter_colorpicker 0.2.4 archive
0.2.3 Apr 2, 2019 Go to the documentation of flutter_colorpicker 0.2.3 Download flutter_colorpicker 0.2.3 archive
0.2.2 Mar 7, 2019 Go to the documentation of flutter_colorpicker 0.2.2 Download flutter_colorpicker 0.2.2 archive
0.2.1 Jan 13, 2019 Go to the documentation of flutter_colorpicker 0.2.1 Download flutter_colorpicker 0.2.1 archive
0.2.0 Jan 9, 2019 Go to the documentation of flutter_colorpicker 0.2.0 Download flutter_colorpicker 0.2.0 archive
0.1.0 Oct 8, 2018 Go to the documentation of flutter_colorpicker 0.1.0 Download flutter_colorpicker 0.1.0 archive
0.0.7 Aug 20, 2018 Go to the documentation of flutter_colorpicker 0.0.7 Download flutter_colorpicker 0.0.7 archive
0.0.6 Aug 20, 2018 Go to the documentation of flutter_colorpicker 0.0.6 Download flutter_colorpicker 0.0.6 archive
0.0.5 May 24, 2018 Go to the documentation of flutter_colorpicker 0.0.5 Download flutter_colorpicker 0.0.5 archive
0.0.4 Mar 12, 2018 Go to the documentation of flutter_colorpicker 0.0.4 Download flutter_colorpicker 0.0.4 archive

All 14 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
95
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]
92
Learn more about scoring.

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

  • Dart: 2.3.0
  • pana: 0.12.15
  • Flutter: 1.5.8

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

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.28.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