checkbox_grouped 0.6.0+1
checkbox_grouped: ^0.6.0+1

Flutter Android iOS web

flutter widget that grouping checkbox, recuperate the actual selection,support multiple selection

checkbox_grouped #

pub GitHub

* grouped (checkbox/radioButton)
* customisable grouped checkbox
* grouped chips
* grouped switch
* recuperate the actual selection
* make multiple selection
* dialogGroupedCheckbox
* lit of groupedCheckbox

Getting Started #

Installing #

Add the following to your pubspec.yaml file:

dependencies:
	checkbox_grouped: ^0.6.0+1

Simple Usage #

Creating a basic SimpleGroupedCheckbox

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

Declare GlobalKey to get selection #

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

Get current selection #

checkboxKey.currentState.selection()

enabled items #

checkboxKey.currentState.enabledItems(List<String> items)

disable item #

checkboxKey.currentState.disabledItems(List<String> items)

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.
onItemSelectedCall when users make selection
disableItemsSpecifies which item should be disabled. The strings passed to this must match the Titles
preSelectionA list of values that you want to be initially selected.
values(required) Values contains in each element.
checkFirstElementmake first element in list checked.
multiSelectionenable multiple selection.
isCirculaireenable to use circulaire checkbox.
isExpandableTitleenable group checkbox to be expandable.
groupTitleText title for group checkbox.

Customisable Checkbox Grouped #

Creating a basic CustomGroupedCheckbox

CustomGroupedCheckbox<int>(
        groupTitle: "Custom GroupedCheckbox",
        itemBuilder: (ctx,index,v){
        return Card(
            child: Row(
                children: <Widget>[
                    Expanded(
                        child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text("$index"),
                        ),
                    ),
                    Opacity(
                          opacity: v?1:0,
                          child: Icon(Icons.check,
                            color: Colors.green,
                            size: 24,
                          ),
                     ),
                  ],
               ),
            );
        },
        itemCount: 10,
        values: List<int>.generate(10, (i)=>i),
    ),

Declare GlobalKey to get selection #

GlobalKey<CustomGroupedCheckboxState<int>> _customCheckBoxKey = GlobalKey<CustomGroupedCheckboxState<int>>();

Get current selection #

_customCheckBoxKey.currentState.selection()

CustomGroupedCheckbox

PropertiesDescription
groupTitlewidget title for group checkbox.
itemBuilder(required) Called to build children.
values(required) Values contains in each element.
itemCount(required)The total number of children
itemExtentThe extent the children are forced to have in the main axis
isMultipleSelectionenable multiple selection.

Chip grouped Usage #

Creating a basic SimpleGroupedChips

SimpleGroupedChips<int>(
                key: chipKey,
                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()

SimpleGroupedChip

PropertiesDescription
itemsTitle(required) A list of strings that describes each chip button. Each label must be distinct.
disabledItemsSpecifies which item should be disabled. The strings passed to this must match the Titles
preSelectionA list of values that you want to be initially selected.
values(required) Values contains in each element.
onItemSelectedCallback when users make selection
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.

Switch grouped Usage #

Creating a basic SimpleGroupedSwitch

SimpleGroupedSwitch<int>(
                key: chipKey,
                values: [1,2,4,5],
                itemsTitle: ["1 " ,"2 ","4 ","5 ","6","7"],
                isMutlipleSelection: false,
              );

Declare GlobalKey to get selection #

GlobalKey<SimpleGroupedSwitchState<int>> switchKey = GlobalKey<SimpleGroupedSwitchState<int>>();

Get current selection #

switchKey.currentState.selection()

SimpleGroupedSwitch

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.
disableItemsSpecifies which item should be disabled. The value passed to this must match the values list
onItemSelectedCall when users make selection
isMutlipleSelectionenable multiple selection.

showDialogGroupedCheckbox #

display groupedCheckbox inside dialog return values selected

Creating a basic showDialogGroupedCheckbox

 showDialogGroupedCheckbox(
                    context: context,
                    cancelDialogText: "cancel",
                    isMultiSelection: true,
                    itemsTitle: List.generate(15, (index) => "$index"),
                    submitDialogText: "select",
                    dialogTitle:Text("example dialog") ,
                    values: List.generate(15, (index) => index)
                  );

showDialogGroupedCheckbox

PropertiesDescription
dialogTitle(required) Text Widget that describe Title of dialog.
itemsTitle(required) Values contains in each element.
values(required) list of values.
initialSelectedValueslist of initial values that you want to be selected.
isDismissibleenable multiple selection.
cancelDialogText(string) label for cancelButton.
submitDialogText(string) label for submitButton.
isMultiSelectionenable multiple selection.

ListGroupedCheckbox *(experimental) #

display list of groupedCheckbox return all values selected

Declare GlobalKey to get selected values #

GlobalKey<ListGroupedCheckboxState> globalKey = GlobalKey<ListGroupedCheckboxState>();

Get all values selected #

await globalKey.currentState.getAllValues()

Creating a basic ListGroupedCheckbox

        ListGroupedCheckbox(
                    key: globalKey,
                    groupTitles: List.generate(3, (index) => "groupe $index"),
                    values: List.generate(
                      3,
                      (i) =>
                          List.generate(5, (j) => "${(i + Random().nextInt(100)) * j}"),
                    ),
                    titles: List.generate(
                      3,
                      (i) => List.generate(5, (j) => "Title:$i-$j"),
                    ),
                    isMultipleSelectionPerGroup: [true, false, true],
                  ),

showDialogGroupedCheckbox

PropertiesDescription
groupTitles(required)Text title for group checkbox in each groupedCheckbox.
titles(required) A list of list of strings that describes each checkbox button. Each label must be distinct in groupedCheckbox.
values(required) Values contains in each element in each groupedCheckbox.
subTitlesA list of list strings that describes second Text in each groupedChckbox.
disabledValuesA nested list of string ,specifies which item should be disabled in each groupedCheckbox. The strings passed to this must match the Titles
preSelectedValuesA list of list values that you want to be initially selected of each groupedCheckbox.
isMultipleSelectionPerGroupA list of boolean to enable multiple selection of each groupedCheckbox.
4
likes
100
pub points
80%
popularity

flutter widget that grouping checkbox, recuperate the actual selection,support multiple selection

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

hamza.mohamedali93@gmail.com

License

MIT (LICENSE)

Dependencies

auto_size_text, flare_flutter, flutter

More

Packages that depend on checkbox_grouped