Giter Site home page Giter Site logo

wer-mathurin / group_button Goto Github PK

View Code? Open in Web Editor NEW

This project forked from frezyx/group_button

0.0 0.0 0.0 10.87 MB

:sweat_drops: Flutter custom widget to make a group buttons. Included Radio and CheckBox buttons.

Home Page: https://pub.dev/packages/group_button

License: MIT License

Kotlin 0.31% Swift 1.00% Objective-C 0.09% Dart 98.35% Makefile 0.24%

group_button's Introduction

Flutter widget to create a group of buttons fast ๐Ÿš€

Included Radio and CheckBox buttons models with custom groping types ๐Ÿคค
Show some โค๏ธ and star the repo to support the project!


Build info Pub Star on Github License: MIT

Pub likes Pub popularity Pub points

Image Image Image

Getting Started

Follow these steps to use this package

Add dependency

dependencies:
  group_button: ^3.1.0 #latest version

Add import package

import 'package:group_button/group_button.dart';

Easy to use

Simple example of use GroupButton
Put this code in your project at an screen and learn how it works ๐Ÿ˜Š

GroupButton(
    isRadio: false,
    spacing: 10,
    onSelected: (index, isSelected) => print('$index button is selected'),
    buttons: ["12:00", "13:00", "14:30", "18:00", "19:00", "21:40"],
)

Customize

In order to customize your buttons inside GroupButton you can use code below
This code includes all the fields used in GroupButton

GroupButton(
    spacing: 5,
    isRadio: false,
    direction: Axis.horizontal,
    onSelected: (index, isSelected) =>
          print('$index button is ${isSelected ? 'selected' : 'unselected'}'),
    buttons: ["Dart","Kotlin","Java","Swift","Objective-C","Python","JS"],
    selectedButtons: [0, 1], /// [List<int>] after 2.2.1 version 
    selectedTextStyle: TextStyle(
        fontWeight: FontWeight.w600,
        fontSize: 16,
        color: Colors.red,
    ),
    unselectedTextStyle: TextStyle(
        fontWeight: FontWeight.w600,
        fontSize: 14,
        color: Colors.grey[600],
    ),
    selectedColor: Colors.white,
    unselectedColor: Colors.grey[300],
    selectedBorderColor: Colors.red,
    unselectedBorderColor: Colors.grey[500],
    borderRadius: BorderRadius.circular(5.0),
    selectedShadow: <BoxShadow>[BoxShadow(color: Colors.transparent)],
    unselectedShadow: <BoxShadow>[BoxShadow(color: Colors.transparent)],
)

Examples

You can check more examples of using this package here


Attributes

Attribute Annotation
buttons [String] list that will be displayed on buttons in the [GroupButton]
selectedButtons [List] that will be set initial selected buttons in the [GroupButton] when [isRadio] is false
selectedButton [int] that will be set initial selected button in the [GroupButton] when [isRadio] is true
onSelected Callback [Function] works by clicking on a group element
Return int [index] of selected button and [isSelected] if [isRadio] = false
isRadio bool variable for switching between modes [ChackBox] and [Radio]
if the [isRadio] = true, only one button can be selected
if the [isRadio] = false, you can select several at once
direction The direction of arrangement of the buttons in [GroupButton]
spacing The spacing between buttons inside [GroupButton]
runSpacing When [groupingType] is [GroupingType.wrap] this field sets Wrap [runSpacing]
selectedTextStyle [TextStyle] of text of selected button(s)
unselectedTextStyle [TextStyle] of text of unselected buttons
selectedColor background [Color] of selected button(s)
unselectedColor background [Color] of unselected buttons
selectedBorderColor border [Color] of selected button(s)
unselectedBorderColor border [Color] of unselected buttons
borderRadius [BorderRadius] of buttons
How much the button will be rounded
selectedShadow list of selected button(s) [BoxShadow]
unselectedShadow list of unselected buttons [BoxShadow]
groupingType The field is responsible for how the buttons will be grouped [GroupingType]
mainGroupAlignment How the buttons should be placed in the main axis in a layout [MainGroupAlignment]
crossGroupAlignment How the buttons should be placed along the cross axis in a layout [CrossGroupAlignment]
groupRunAlignment How the button runs themselves should be placed the cross axis in a layout [GroupRunAlignment]

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.