simple_color_picker 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

simple_color_picker #

A simple HSV color picker without any glitz or glamour.

Sample #

Installation #

dependencies:
  simlpe_color_picker: any

Example #

import 'package:simple_color_picker/simple_color_picker.dart';

SimpleColorPicker(
    color: this.color,
    onChanged: (value) =>
         super.setState(() => this.onChanged(value)),
)

Credits #

This package is a mutation of flutter_hsvcolor_picker, a library module containing very complex implementation of HSV color picker.

Origin #

One of my projects had a requirement of showing a simple color picker and I couldn't find any Flutter plugins that implemented only this and I had to make tweaks here and there to build this simple color picker. Decided to publish my creation so it may benefit someone like me.

[1.0.0] - 25/Nov/2019. #

  • Incorporated packages health suggestions.

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Color Picker Example',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  HSVColor color = HSVColor.fromColor(Colors.cyan);
  void onChanged(HSVColor value) => this.color = value;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Color Picker Example'),
      ),
      body: SafeArea(
          child: Center(
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Card(
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(Radius.circular(0.0))),
              elevation: 2.0,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    FloatingActionButton(
                      onPressed: () {},
                      backgroundColor: this.color.toColor(),
                    ),
                    Divider(),
                    SimpleColorPicker(
                      color: this.color,
                      onChanged: (value) =>
                          super.setState(() => this.onChanged(value)),
                    ),
                  ],
                ),
              )),
        ),
      )),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  simple_color_picker: ^1.0.0

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

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Dependencies

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