Columns
Most FDC grid columns are field-bound declarations. The fieldName must resolve to a compatible field in the dataset schema.
const FdcTextColumn<dynamic>(
id: 'companyColumn',
fieldName: 'company',
label: 'Company',
width: 240,
minWidth: 140,
maxWidth: 420,
)
Stable column identity
Use id when a column must preserve runtime layout state across rebuilds or be targeted by FdcGridController commands.
final controller = FdcGridController();
FdcGrid(
controller: controller,
dataSet: customers,
columns: const [
FdcTextColumn<dynamic>(
id: 'cityColumn',
fieldName: 'city',
),
],
)
Later:
controller.focusColumn('cityColumn');
controller.hideColumn('cityColumn');
controller.showColumn('cityColumn');
Common column controls
All standard field-bound columns share common configuration such as:
label,hint,visible, andenabledreadOnly,tabStop, andfocusOrderwidth,minWidth,maxWidth, andautoSizeModeallowSort,filterConfig, andallowResizehorizontalAlignmentpinsummaryonValueChanging,onValueChanged, andonLookup
Column sizing and resizing
Column width is constrained by minWidth and maxWidth, while width provides the configured width:
const FdcTextColumn<dynamic>(
fieldName: 'company',
width: 240,
minWidth: 140,
maxWidth: 420,
allowResize: true,
)
Interactive resize is controlled at both grid and column level. The grid must allow column resize and the target column must not disable it:
FdcGrid(
dataSet: customers,
options: const FdcGridOptions(
allowColumnResize: true,
),
columns: const [
FdcTextColumn<dynamic>(
fieldName: 'company',
allowResize: true,
),
],
)
autoSizeMode controls whether a column participates in viewport width distribution. It is a layout behavior, not content measurement:
| Mode | Behavior |
|---|---|
FdcGridColumnAutoSizeMode.none | Keeps the configured width except for explicit or manual resize. |
FdcGridColumnAutoSizeMode.viewport | Lets the column absorb scrollable viewport width deltas. |
Pinned columns do not participate in the scrollable viewport auto-size pass. Use stable minWidth and maxWidth constraints when a viewport-sized column must remain within a practical range.
Column pinning
const FdcTextColumn<dynamic>(
fieldName: 'company',
pin: FdcGridColumnPin.start,
)
Interactive pinning is opt-in. Enable it globally when users should be able to pin and unpin columns from grid menus:
FdcGrid(
dataSet: customers,
pinning: const FdcGridColumnPinning(enabled: true),
)
Programmatic initial pinning through FdcGridColumn.pin remains available independently of interactive pinning.
Duplicate field bindings
Multiple columns may bind to the same field. Give them distinct id values when each column needs independent layout state.