import 'package:gluestack_ui/gluestack_ui.dart';
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(margin: EdgeInsets.only(right: $GSSpace.$2)),
child: const GSCheckBoxIcon(),
),
value: "value 1",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "value1"),
size: GSCheckBoxSizes.$md,
isDisabled: false,
isInvalid: false,
)
import "package:gluestack_ui/gluestack_ui.dart"
Parameters | Type | Default | Description |
---|---|---|---|
value | String | - | The value to be used in the checkbox input. This is the value that will be returned on form submission. |
onChange | void Function(bool? value) | - | Function called when the state of the checkbox changes. |
defaultIsChecked | bool | false | If true, the checkbox will be initially checked. |
isChecked | bool | false | When true, the checkbox will be checked. You'll need to pass onChange to update it's value (since it's now controlled). |
isDisabled | bool | false | To manually set disable to the checkbox. |
isInvalid | bool | false | To manually set invalid to the checkbox. |
isReadOnly | bool | false | To manually set read-only to the checkbox. |
isHovered | bool | false | To manually set hover to the checkbox. |
isFocusVisible | bool | false | To manually set focus visible state to the checkbox. |
Parameters | Type | Default | Description |
---|---|---|---|
value | string[] | - | The value of the checkbox group. |
onChange | void Function(bool? value) | - | The callback fired when any children Checkbox is checked or unchecked. |
isDisabled | bool | false | To manually set disable to the checkbox. |
isInvalid | bool | false | To manually set invalid to the checkbox. |
isReadOnly | bool | false | To manually set read-only to the checkbox. |
Name | Value | Default |
---|---|---|
size | lg | md | sm | md |
import 'package:gluestack_ui/gluestack_ui.dart';
GSVStack(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(margin: EdgeInsets.only(right: $GSSpace.$2)),
child: const GSCheckBoxIcon(),
),
value: "Flutter",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "Flutter"),
),
const SizedBox(
height: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(margin: EdgeInsets.only(right: $GSSpace.$2)),
child: const GSCheckBoxIcon(),
),
value: "React",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "React"),
),
const SizedBox(
height: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(margin: EdgeInsets.only(right: $GSSpace.$2)),
child: const GSCheckBoxIcon(),
),
value: "React Native",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "React Native"),
),
],
)
import 'package:gluestack_ui/gluestack_ui.dart';
GSHStack(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(margin: EdgeInsets.only(right: $GSSpace.$2)),
child: const GSCheckBoxIcon(),
),
value: "Flutter",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "Flutter"),
),
const SizedBox(
width: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(margin: EdgeInsets.only(right: $GSSpace.$2)),
child: const GSCheckBoxIcon(),
),
value: "React",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "React"),
),
const SizedBox(
width: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(margin: EdgeInsets.only(right: $GSSpace.$2)),
child: const GSCheckBoxIcon(),
),
value: "React Native",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "React Native"),
),
],
)
import 'package:gluestack_ui/gluestack_ui.dart';
GSVStack(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(
right: $GSSpace.$4,
),
),
child: const GSCheckBoxIcon(),
),
value: "Design",
onChanged: (value) {},
label: GSVStack(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
GSCheckBoxLabel(text: "Design"),
GSText(
text: 'Subscribe to updates from the Design Feed',
),
],
),
),
const SizedBox(
height: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(
right: $GSSpace.$4,
),
),
child: const GSCheckBoxIcon(),
),
value: "Marketing",
onChanged: (value) {},
label: GSVStack(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
GSCheckBoxLabel(text: "Marketing"),
GSText(
text: 'Subscribe to updates from the Marketing Feed',
),
],
),
),
],
)
import 'package:gluestack_ui/gluestack_ui.dart';
GSVStack(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const GSHeading(text: 'Sign up for newsletters'),
const SizedBox(
height: 10,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
value: "Flutter",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "Flutter"),
),
const SizedBox(
height: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
value: "React",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "React"),
),
const SizedBox(
height: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
value: "React Native",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "React Native"),
),
const SizedBox(
height: 10,
),
const GSText(text: 'Subscribe to newsletters for updates'),
],
)
import 'package:gluestack_ui/gluestack_ui.dart';
GSVStack(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GSCheckBox(
isChecked: true,
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
value: "Flutter",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "Flutter"),
),
const SizedBox(
height: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
value: "React",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "React"),
),
const SizedBox(
height: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
isChecked: true,
value: "React Native",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "React Native"),
),
],
)
import 'package:gluestack_ui/gluestack_ui.dart';
GSVStack(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
value: "Appartments",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "Appartments"),
),
const SizedBox(
height: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
value: "Residents",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "Residents"),
),
],
)
import 'package:gluestack_ui/gluestack_ui.dart';
GSVStack(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GSCheckBox(
isDisabled: true,
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
value: "Disabled",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "Disabled"),
),
const SizedBox(
height: 20,
),
GSCheckBox(
icon: GSCheckBoxIndicator(
style: GSStyle(
margin: EdgeInsets.only(right: $GSSpace.$2),
),
child: const GSCheckBoxIcon(),
),
value: "Active",
onChanged: (value) {},
label: const GSCheckBoxLabel(text: "Active"),
),
],
)