WOICheckBox class
A widget that gives you option to toggle between 2 values as a checkBox
Here is the very basic way to use the widget
WOICheckBox(
isChecked: checkValue,
onTap: (bool isSelected) {
checkValue = isSelected;
setState(() {});
},
)
The isChecked
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
Furthure if you want to explore the full extent of the widget then we have the checked and simple states
so to customize the checkbox in its checked state there would be variables
starting from checked
or would have checked
in them.
Here is the implementation with all utalization of its customization
WOICheckBox(
isChecked: switchValue,
onTap: (bool isSelected) {
switchValue = isSelected;
setState(() {});
},
border: Border.all(
color: Colors.green,
width: 5,
),
checkedBorder: Border.all(
color: Colors.black,
width: 2,
),
checkedFillColor: Colors.red,
size: 50,
innerPadding: const EdgeInsets.all(3),
duration: const Duration(
milliseconds: 1,
),
icon: const Icon(
Icons.check_outlined,
color: Colors.black,
),
borderRadius: 100,
),
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- WOICheckBox
Constructors
-
WOICheckBox({Key? key, required bool isChecked, required ValueChanged<
bool> onTap, Border? border, Border? checkedBorder, Color? checkedFillColor, double size = 25, EdgeInsets? innerPadding, Duration? duration, double borderRadius = 0, Icon? icon}) -
const
Properties
- border → Border?
-
This is the border for state when checkbox is not checked (in its simple inital state)
final
- borderRadius → double
-
This defines the radius for the border
final
- checkedBorder → Border?
-
This is variable to change border for checked state
final
- checkedFillColor → Color?
-
This variable is to change inner Color for checked state.
final
- duration → Duration?
-
This defines the duration for the animation duration
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → Icon?
-
You can change the inner icon to any other icon as well
final
- innerPadding → EdgeInsets?
-
To define the padding between outer border and inner icon
final
- isChecked → bool
-
This is a required field which would be used to differential between 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
- size → double
-
This is to define the size of the checkbox button
The inner icon will expand respectively with the size until the size of icon is separately provided
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