Boolean Column
FdcBooleanColumn is the standard column type for true/false values. It can render as a checkbox or as a switch-style control.
Use it for binary values that users can understand and change directly in the row, such as enabled state, approval, visibility, or notification preferences. Prefer a combo or badge column when the business state has more than two meaningful values.
FdcGrid(
dataSet: taskRows,
options: const FdcGridOptions(autoEdit: true),
columns: const [
FdcTextColumn(fieldName: 'task', width: 240),
FdcBooleanColumn(
fieldName: 'approved',
width: 110,
horizontalAlignment: FdcGridHorizontalAlignment.center,
showIndicator: false,
),
FdcBooleanColumn(
fieldName: 'notifications',
width: 135,
control: FdcBooleanControl.switchControl,
horizontalAlignment: FdcGridHorizontalAlignment.center,
showIndicator: false,
),
],
);
Key characteristics
- Binds to
FdcBooleanField. - Supports checkbox or switch rendering through
control. - Keeps normal sorting, filtering, and dataset editing behavior.
Example
const FdcBooleanColumn<dynamic>(
fieldName: 'notifications',
label: 'Notifications',
control: FdcBooleanControl.switchControl,
)
Editing and filtering behavior
The column validates that fieldName resolves to an FdcBooleanField. When the cell is editable, the checkbox or switch writes through the normal dataset edit lifecycle, so field validation, record state, and change tracking remain active.
Boolean header filtering uses semantic choices rather than free-form text: All, Is true, and Is false. Sorting follows the dataset's boolean ordering. Set readOnly: true when the value should remain visible but must not be changed from the grid.
Null values
Whether null is valid is defined by the bound field. Use a required or non-nullable business rule when every record must have an explicit true/false value; otherwise make sure the surrounding UI explains how an unset value differs from false.