grid_color_selector 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 55

grid_color_selector #

A new grid selector package.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

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

Preview #

[example]

How is it install? #

Follow this instructions

How is it use? #

See de example

Versions #

Changelog

[1.0.0] - First version with the basic features and without animations.

  • Single selection
  • Disable items

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:grid_color_selector/base_color_grid_selector_item.dart';
import 'package:grid_color_selector/grid_color_selector.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Grid color selector',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Grid selector sample"),
      ),
      body: SafeArea(
        child: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Container(
            child: Column(
              children: <Widget>[
                GridColorSelector<int>(
                  title: "Color",
                  items: _getColors(),
                  onSelectionChanged: (option) => print(option),
                ),
                _buildDivider(),
                GridColorSelector<int>(
                  title: "Color",
                  items: _getColors(),
                  onSelectionChanged: (option) => print(option),
                  itemSize: 100,
                  itemCircleSize: 85,
                  checkSize: 50,
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }

  Padding _buildDivider() {
    return Padding(
      padding: const EdgeInsets.symmetric(
        vertical: 32.0,
      ),
      child: Divider(
        height: 2,
        color: Colors.grey,
      ),
    );
  }

  _getColors() {
    return [
      BaseGridColorSelectorItem(
        key: 1,
        primaryColor: Colors.green,
      ),
      BaseGridColorSelectorItem(
        key: 2,
        primaryColor: Colors.blueGrey,
      ),
      BaseGridColorSelectorItem(
        key: 3,
        primaryColor: Colors.red,
      ),
      BaseGridColorSelectorItem(
        key: 4,
        primaryColor: Colors.orange,
        secondaryColor: Colors.blue,
      ),
      BaseGridColorSelectorItem(
        key: 5,
        primaryColor: Colors.yellow,
      ),
      BaseGridColorSelectorItem(
        key: 6,
        primaryColor: Colors.deepPurple,
        secondaryColor: Colors.orange,
        isEnabled: false,
      ),
      BaseGridColorSelectorItem(
        key: 7,
        primaryColor: Colors.white,
        secondaryColor: Colors.blueGrey,
        isEnabled: false,
      ),
      BaseGridColorSelectorItem(
        key: 8,
        primaryColor: Colors.green,
        secondaryColor: Colors.blueGrey,
      ),
      BaseGridColorSelectorItem(
        key: 9,
        primaryColor: Colors.blue,
        secondaryColor: Colors.red,
      ),
    ];
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  grid_color_selector: ^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:grid_color_selector/grid_color_selector.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
11
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]
55
Learn more about scoring.

We analyzed this package on Apr 7, 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

Health issues and suggestions

Document public APIs. (-0.30 points)

41 out of 42 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

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