color_picker_palette 0.1.3

color_picker_palette 0.1.3 #

A color picker palette with custom colors.

Usage #

Using color_picker_palette you can provide user with list of custom colors to choose.

It will show a horizontal list of colors including a button to add custom colors for user.

Long press will remove color from the list.

You can refer color_picker_palette/example

  colorPickerPalette = new ColorPickerPalette(
    size: 30.0,
    onChange: setColorState,
    colors: colors,
    buttonType: ButtonType.circular,
  );
  
  setColorState() {
    setState(() {
      color = colorPickerPalette.color();
    });
  }

Contributing #

We encourage you contribute to color_picker_palette flutter package.

License #

color_picker_palette is released under MIT License

0.1.3 #

  • Initial release

example/lib/main.dart

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

void main() => runApp(MyApp());

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

class MyAppState extends State<MyApp> {
  ColorPickerPalette colorPickerPalette;
  Color color;
  List<Color> colors = [];

  @override
  void initState() {
    super.initState();
    colors.add(Theme.of(context).primaryColor);
    colors.add(Colors.black);
    colors.add(Colors.white);
    color = colors[0];
    colorPickerPalette = new ColorPickerPalette(
      size: 30.0,
      onChange: setColorState,
      colors: colors,
      buttonType: ButtonType.circular,
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: color,
          title: Text(
            'Color Picker Palette',
            style: TextStyle(color: Color(color.value - 10010110)),
          ),
        ),
        body: new Container(
          constraints: BoxConstraints.expand(),
          color: color,
          child: new Column(
            children: <Widget>[
              colorPickerPalette,
              Container(
                padding: EdgeInsets.all(16.0),
                child: Text(
                  colorPickerPalette.color().toString(),
                  style: TextStyle(
                    fontSize: 24.0,
                    fontWeight: FontWeight.w400,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  setColorState() {
    setState(() {
      color = colorPickerPalette.color();
    });
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  color_picker_palette: ^0.1.3

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:color_picker_palette/color_picker_palette.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
5
Health:
Code health derived from static analysis. [more]
95
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
81
Overall:
Weighted score of the above. [more]
47
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Fix lib/picker_widget.dart. (-5.48 points)

Analysis of lib/picker_widget.dart reported 1 warning, 1 hint:

line 207 col 16: The parameter 'backgroundCursorColor' is required.

line 105 col 3: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Format lib/generated/i18n.dart.

Run flutter format to format lib/generated/i18n.dart.

Maintenance suggestions

The package description is too short. (-19 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
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