checkbox_grouped 0.2.1

checkbox_grouped #

pub GitHub

* grouping checkbox
* grouping chips
* recuperate the actual selection
* make multiple selection

Getting Started #

Installing #

Add the following to your pubspec.yaml file:

dependencies:
  checkbox_grouped: ^0.2.1

Simple Usage #

Creating a basic SimpleGroupedCheckbox

SimpleGroupedCheckbox<int>(
                key: checkboxKey,
                itemsTitle: ["1 " ,"2 ","4 ","5 "],
                values: [1,2,4,5],
                activeColor: Colors.red,
                direction: Direction.Horizontal,
                checkFirstElement: false,
                multiSelection: false,
              );

Declare GlobalKey to get selection #

GlobalKey<SimpleGroupedCheckboxState<int>> checkboxKey = GlobalKey<SimpleGroupedCheckboxState<int>>();

Get current selection #

checkboxKey.currentState.selection()

SimpleGroupedCheckbox #

PropertiesDescription
activeColorThe color to use when a CheckBox is checked.
itemsTitle(required) A list of strings that describes each checkbox button. Each label must be distinct.
itemsSubTitleA list of strings that describes second Text.
preSelectionA list of values that you want to be initially selected.
values(required) Values contains in each element.
directionSpecifies the direction to display elements. Either Direction.Horizontal or Direction.Vertical.
checkFirstElementmake first element in list checked.
multiSelectionenable multiple selection.
isCirculaireenable to use circulaire checkbox.
textTitleText title for group checkbox.

Chip grouped Usage #

Creating a basic SimpleGroupedChips

SimpleGroupedChips<int>(
                key: chipKey,
                values: [1,2,4,5],
                values: [1,2,3,4,5,6,7],
                itemTitle: ["1 " ,"2 ","4 ","5 ","6","7"],
                backgroundColorItem: Colors.black26,
              );

Declare GlobalKey to get selection #

GlobalKey<SimpleGroupedChipsState<int>> chipKey = GlobalKey<SimpleGroupedChipsState<int>>();

Get current selection #

chipKey.currentState.selection()

SimpleGroupedCheckbox #

PropertiesDescription
itemsTitle(required) A list of strings that describes each chip button. Each label must be distinct.
preSelectionA list of values that you want to be initially selected.
values(required) Values contains in each element.
backgroundColorItemthe background color for each item.
selectedColorItemthe background color to use when item is selected.
textColorthe color to use for each text of item.
selectedTextColorthe color to use for the selected text of item.
selectedIconthe icon to use when item is selected.
isScrollingenable horizontal scrolling.
isMultipleenable multiple selection.

[0.2.1] - fix err

* add selection function in groupedchips that missed in previous version

[0.2.0+1] - fix readme

[0.2.0] - add new feature

* add chip group

[0.1.4] - add new feature

* add Title for each group
* make Title selected for multiple selection

[0.1.3+1] - fix readme

[0.1.3] - add new feature

  • circulaire checkbox

[0.1.2+17] - fix CHANGELOG

[0.1.2+16] - fix readme file

[0.1.2+15] - add new feature

* add pre-selection element for multiple selection
* add example section

[0.1.2+14] - fix First Element selection.

[0.1.2+13] - fix README.

[0.1.2+12] - fix CHANGELOG.

[0.1.2+11] - fix errors.

[0.1.2+1] - fix errors.

[0.1.2] - fix errors.

[0.1.1]

  • Add example in example/

[0.1.0] - INITIAL RELEASE

  • contain simple and basic widget to grouping checkbox.

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _MyAppState();
  }
}

class _MyAppState extends State<MyApp> {
  GlobalKey<SimpleGroupedCheckboxState<int>> checkboxKey =
      GlobalKey<SimpleGroupedCheckboxState<int>>();
  GlobalKey<SimpleGroupedCheckboxState<int>> circulairekey =
      GlobalKey<SimpleGroupedCheckboxState<int>>();
  GlobalKey<SimpleGroupedCheckboxState<int>> mutlicheckboxKey =
      GlobalKey<SimpleGroupedCheckboxState<int>>();

  GlobalKey<SimpleGroupedChipsState<int>> mutliChipsKey =
  GlobalKey<SimpleGroupedChipsState<int>>();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primaryColor: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text("SingleGroupedCheckbox"),
        ),
        body: SingleChildScrollView(
          child: Column(
            mainAxisSize: MainAxisSize.max,
            children: <Widget>[
              Text("Basic"),
              SimpleGroupedCheckbox<int>(
                key: checkboxKey,
                itemsTitle: ["1 ", "2 ", "4 ", "5 "],
                values: [1, 2, 4, 5],
                activeColor: Colors.red,
                direction: Direction.Horizontal,
                checkFirstElement: false,
                multiSelection: false,
              ),
              Text("Circulaire Checkbox"),
              SimpleGroupedCheckbox<int>(
                key: circulairekey,
                itemsTitle: ["1 ", "2 ", "4 ", "5 "],
                values: [1, 2, 4, 5],
                direction: Direction.Horizontal,
                isCirculaire: true,
                activeColor: Colors.blue,
                isLeading: true,
                checkFirstElement: false,
                multiSelection: false,
              ),
              SimpleGroupedCheckbox<int>(
                key: mutlicheckboxKey,
                itemsTitle: ["1 ", "2 ", "4 ", "5 "],
                values: [1, 2, 4, 5],
                preSelection: [2, 5, 4],
                textTitle: "Mutiple selection",
                activeColor: Colors.green,
                direction: Direction.Horizontal,
                checkFirstElement: false,
                multiSelection: true,
              ),
              SimpleGroupedChips<int>(
                key: mutliChipsKey,
                values: [1,2,3,4,5,6,7],
                itemTitle: ["text1","text2","text3","text4","text5","text6","text7"],
                backgroundColorItem: Colors.black26,
                isScrolling: true,
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


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

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

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Dependencies

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