flutter_radio_group 2.1.0 copy "flutter_radio_group: ^2.1.0" to clipboard
flutter_radio_group: ^2.1.0 copied to clipboard

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.

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



9
likes
130
pub points
80%
popularity

Publisher

verified publisherlazycatlabs.com

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.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_radio_group