grid_selector 1.0.0+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

grid_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
  • Custom empty view

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:grid_selector/base_grid_selector_item.dart';
import 'package:grid_selector/grid_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(
      debugShowCheckedModeBanner: false,
      title: 'GridSelector Demo',
      theme: ThemeData(
        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>[
                GridSelector<int>(
                  title: "Tail",
                  items: _getTails(),
                  onSelectionChanged: (option) => print(option),
                ),
                _buildDivider(),
                GridSelector<int>(
                  title: "Tail",
                  items: _getTails(),
                  onSelectionChanged: (option) => print(option),
                  itemSize: 80,
                ),
                _buildDivider(),
                GridSelector<int>(
                  title: "Tail",
                  items: [],
                  onSelectionChanged: (option) => print(option),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }

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

  List<BaseGridSelectorItem> _getTails() {
    return [
      BaseGridSelectorItem(key: 1, label: "28"),
      BaseGridSelectorItem(key: 2, label: "29"),
      BaseGridSelectorItem(key: 3, label: "30"),
      BaseGridSelectorItem(key: 4, label: "31"),
      BaseGridSelectorItem(key: 5, label: "32", isEnabled: false),
      BaseGridSelectorItem(key: 6, label: "33"),
      BaseGridSelectorItem(key: 7, label: "34"),
      BaseGridSelectorItem(key: 8, label: "35", isEnabled: false),
      BaseGridSelectorItem(key: 9, label: "36"),
      BaseGridSelectorItem(key: 10, label: "37"),
      BaseGridSelectorItem(key: 11, label: "38"),
      BaseGridSelectorItem(key: 12, label: "39", isEnabled: false),
      BaseGridSelectorItem(key: 13, label: "40"),
      BaseGridSelectorItem(key: 14, label: "41"),
      BaseGridSelectorItem(key: 15, label: "42"),
      BaseGridSelectorItem(key: 16, label: "43"),
    ];
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  grid_selector: ^1.0.0+1

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

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

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Health issues and suggestions

Document public APIs. (-0.29 points)

40 out of 41 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.

Fix lib/grid_selector.dart. (-0.50 points)

Analysis of lib/grid_selector.dart reported 1 hint:

line 85 col 43: 'title' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline6. This feature was deprecated after v1.13.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.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test