Checkbox
A selectable checkbox component for enabling/disabling options with support for checked, unchecked, and indeterminate states
A selectable checkbox component for toggling options on and off.
When to use this
- Multi-select lists: Allow users to select multiple items from a list
- Form inputs: Collect boolean preferences or agreement confirmations
- Settings panels: Enable/disable features or options
- Bulk actions: Select multiple items for batch operations
Basic implementation
Basic implementation
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class CheckboxExample extends StatefulWidget {
const CheckboxExample({super.key});
@override
State<CheckboxExample> createState() => _CheckboxExampleState();
}
class _CheckboxExampleState extends State<CheckboxExample> {
bool _isChecked = true;
@override
Widget build(BuildContext context) {
return RemixCheckbox(
selected: _isChecked,
onChanged: (value) {
setState(() {
_isChecked = value ?? false;
});
},
style: style,
);
}
RemixCheckboxStyle get style {
return RemixCheckboxStyle()
.size(24, 24)
.icon(IconStyler().size(20).color(Colors.white))
.onSelected(RemixCheckboxStyle().color(Colors.grey.shade900))
.borderRadiusAll(const Radius.circular(3))
.border(
BoxBorderMix.all(
BorderSideMix().color(Colors.black87).width(2),
),
);
}
}
Fortal styles
Remix includes Fortal-themed style helpers for this component:
Fortal variants
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class FortalCheckboxExample extends StatefulWidget {
const FortalCheckboxExample({super.key});
@override
State<FortalCheckboxExample> createState() => _FortalCheckboxExampleState();
}
class _FortalCheckboxExampleState extends State<FortalCheckboxExample> {
bool _isChecked = true;
@override
Widget build(BuildContext context) {
return Column(
spacing: 16,
children: [
RemixCheckbox(
selected: _isChecked,
onChanged: (value) => setState(() => _isChecked = value ?? false),
style: FortalCheckboxStyle.solid(),
),
RemixCheckbox(
selected: _isChecked,
onChanged: (value) => setState(() => _isChecked = value ?? false),
style: FortalCheckboxStyle.soft(),
),
],
);
}
}
See the FortalCheckboxStyle source code for all available options.
Constructor
Constructor
const RemixCheckbox({
Key? key,
required bool selected,
required ValueChanged<bool?>? onChanged,
bool enabled = true,
bool? indeterminate,
MouseCursor mouseCursor = SystemMouseCursors.click,
bool enableFeedback = true,
FocusNode? focusNode,
bool autofocus = false,
String? semanticLabel,
RemixCheckboxIconBuilder? iconBuilder,
RemixCheckboxStyle style = const RemixCheckboxStyle.create(),
RemixCheckboxSpec? styleSpec,
})
selected → bool?
Required. Whether the checkbox is currently selected. When [tristate] is true, can be null for indeterminate state.
onChanged → ValueChanged<bool?>?
Optional. The callback function that is called when the checkbox is tapped. When [tristate] is true, the value can be null.
autofocus → bool
Optional. Whether the checkbox should automatically request focus when it is created.
indeterminateIcon → IconData
Optional. The icon to display when the checkbox is in indeterminate state (null value).

