Coder Social home page Coder Social logo

flutter_radio_group's Introduction

Flutter Radio Group pub package License: MIT Build Status

A Beautiful and Simple Radio Group widget for Flutter. It can be fully customized with label, titles, labelStyle, titleStyle, orientation, etc. It also maintains onChanged state.

Getting Started

In the pubspec.yaml of your flutter project, add the following dependency:

flutter_radio_group: "^latest_version"

Import it:

import'package:flutter_radio_group/flutter_radio_group.dart';

Demo

Farmers Market Finder Demo

Usage Examples

var _listHorizontal = ["Horizontal 1", "Horizontal 2", "Horizontal 3"];
var _indexHorizontal = 0;

FlutterRadioGroup(
                 titles: _listHorizontal,
                 labelStyle: TextStyle(color: Colors.white38),
                 labelVisible: true,
                 label: "This is label radio",
                 activeColor: Colors.blue,
                 titleStyle: TextStyle(fontSize: 14),
                 defaultSelected: _indexHorizontal,
                 orientation: RGOrientation.HORIZONTAL,
                 onChanged: (index) {
                   setState(() {
                     _indexHorizontal = index;
                   });
                 }),

Select Index Programmatically

var _key = GlobalKey<RadioGroupState>();

/// Update selected radio
_key.currentState.setIndexSelected(3);

FlutterRadioGroup(
		  key:_key
                  titles: _listHorizontal,
                  labelStyle: TextStyle(color: Colors.white38),
                  labelVisible: true,
                  label: "This is label radio",
                  activeColor: Colors.blue,
                  titleStyle: TextStyle(fontSize: 14),
                  defaultSelected: _indexHorizontal,
                  orientation: RGOrientation.HORIZONTAL,
                  onChanged: (index) {
                    setState(() {
                      _indexHorizontal = index;
                    });
                  }),

Tips

Set defaultSelected to -1 to empty selected radio group

Available Parameters

Param isRequired
RGOrientation orientation (RGOrientation.VERTICAL) No
List<String> titles Yes
TextStyle titleStyle No
String label No
TextStyle labelStyle No
int defaultSelected (0) No
bool labelVisible (true) No
Color activeColor (PrimaryColor) No
Function(int) onChanged No

Buy me coffee if you love my works ☕️

ko-fi      buymeacoffe      paypal



flutter_radio_group's People

Contributors

bonaparta13 avatar lzyct avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

bonaparta13

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.