WOIRadioButton class

A widget that gives you option to toggle between 2 values as a radio button

Here is the very basic way to use the widget

WOIRadioButton(
  isSelected: radioValue,
  onTap: (bool isSelected) {
    radioValue = isSelected;
    setState(() {});
  },
)

The isSelected and onTap are required fields onTap field will return the data when ever the value is changed with the updated value on what should be the new value after the tap action

Further if you want to explore the full extent of the widget then we have the selected and non-selected states for the radio button So to customize the radio button in its selected state there would be variables starting from 'selected' or would have 'selected' in them

Here is the implementation with all utilization of its customization

WOIRadioButton(
  isSelected: radioValue,
  onTap: (bool isSelected) {
    radioValue = isSelected;
    setState(() {});
  },
  border: Border.all(
    color: Colors.green,
    width: 2,
  ),
  selectedBorder: Border.all(
    color: Colors.black,
  ),
  selectedFillColor: Colors.black,
  size: 30,
  innerPadding: const EdgeInsets.all(3),
  duration: const Duration(
    milliseconds: 1,
  ),
),
Inheritance

Constructors

WOIRadioButton({Key? key, required bool isSelected, required ValueChanged<bool> onTap, Border? border, Border? selectedBorder, Color? selectedFillColor, double size = 25, EdgeInsets? innerPadding, Duration? duration, Color? backgroundColor})
const

Properties

backgroundColor Color?
This defines the background Color
final
border Border?
This is the border for state when radio button is not selected
final
duration Duration?
This defines the duration for the animation duration
final
hashCode int
The hash code for this object.
no setterinherited
innerPadding EdgeInsets?
To define the padding between outer cirlce and inner circle
final
isSelected bool
This is a required field which would be used to differentiate between active and inactive states
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onTap ValueChanged<bool>
This variable will return the value when you tap on the button
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedBorder Border?
This is variable to change border for selected state
final
selectedFillColor Color?
This is variable to change inner Color for selected state. The inner filled circle
final
size double
This is to define the size of the radio button The inner circle will expand with the size of outer widget
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited