flutter_carbon 1.2.0
flutter_carbon: ^1.2.0 copied to clipboard
A comprehensive Flutter implementation of IBM's Carbon Design System V11. Features 48 components, 4 theme variants, and seamless Material Design integration.
1.2.0 #
New Features #
- CarbonProgressIndicator (new)
- Added
CarbonProgressIndicatorwidget — a native Carbon Design System progress indicator component. - Accepts a
List<CarbonProgressStep>to define each step with a requiredlabel, optionalsecondaryLabel, optional explicitstate, anddisabledflag. - Step states are automatically derived from
currentIndex(parent-managed):complete— steps before the current index; filled circle with white checkmark.current— step at the current index; filled circle with white hollow center (CircleDash).incomplete— steps after the current index; circle outline.invalid— error state (explicit only);CarbonIcons.warningFilledincarbon.layer.supportError.disabled— grayed-out circle outline; not tappable even whenonStepTapis set.- Individual steps can override automatic state via
CarbonProgressStep.state.
- Orientation: horizontal (default) and vertical via
verticalparameter.- Horizontal: connector lines run left/right of each icon; each step in
Expandedby default. - Vertical: connector line runs downward from icon; labels sit to the right; minimum step height 58px matching Carbon spec.
- Horizontal: connector lines run left/right of each icon; each step in
spaceEqually(horizontal only, defaulttrue): wraps each step inExpandedto distribute width equally.onStepTap: when provided, steps become tappable. Current and disabled steps remain non-interactive.- Connector lines reflect completion: lines connecting to/from complete steps use
buttonPrimary(Carbon Blue); lines to incomplete steps use#8D8D8D. - Custom icon painters (
CustomPainter):_CheckCirclePainter— filled circle + white checkmark strokes._CurrentCirclePainter— filled circle + white hollow dot center._OutlineCirclePainter— 1.5px stroke circle outline.
MouseRegioncursor changes toclickon tappable steps.- Icon and label colors follow Carbon theme tokens (
carbon.button.buttonPrimary,carbon.text.textPrimary,carbon.text.textSecondary,carbon.text.textDisabled).
- Added
Component Updates #
- CarbonComboBox
- The trailing chevron icon is now tappable and toggles the dropdown open/closed (previously only the text field area opened the menu).
Bug Fixes #
- CarbonComboBox
- Fixed: the trailing chevron icon did not flip back from up to down immediately after the dropdown closed because
_isOpenwas mutated outsidesetState. Closing the dropdown now triggers a rebuild consistently.
- Fixed: the trailing chevron icon did not flip back from up to down immediately after the dropdown closed because
1.1.0 #
Deprecations #
- CarbonUIShell
- Deprecated
onSideNavItemTap(will be removed in v2.0.0). Use individualonTapcallbacks onCarbonNavIteminstead.
- Deprecated
New Features #
-
Foundation & Theme Updates
- Updated
CheckboxThemeDataandRadioThemeDatato useVisualDensity(vertical: -4.0, horizontal: -4.0)andMaterialTapTargetSize.shrinkWrapfor better Carbon compliance. - Updated
ChipThemeDatato useStadiumBorder(pill shape) and adjustedlabelPadding(with negative vertical values) to achieve compact Carbon Tag sizing. - Added
isDense: trueto globalInputDecorationThemeto prevent excessive height in text fields. - Standardized icon sizes across all components using
CarbonIconSizestokens. - Added
CarbonIconSizes.iconSize03(24px) andCarbonIconSizes.iconSize04(32px) constants. - Set default icon size to 16px (
iconSize01) for:IconThemeData(global default)IconButtonThemeDataAppBarTheme(back and action icons)NavigationBarThemeNavigationRailThemeNavigationDrawerTheme
- Updated
-
CarbonButton
- Added
CarbonButtonwidget following Carbon Design System button specifications:- Seven kind variants via
CarbonButtonKindenum:primary— filled, for primary actionssecondary— filled, for secondary actionstertiary— outlined, for less-prominent actionsghost— transparent, for low-emphasis actionsdanger— filled red, for destructive primary actionsdangerTertiary— outlined red, for destructive secondary actionsdangerGhost— transparent red, for destructive ghost actions
- Five size variants via
CarbonButtonSizeenum:sm(32 px),md(40 px),lg(48 px, default),xl(64 px),twoXl(80 px) - Icon support: optional trailing icon via
iconparameter; omittingchildproduces a square icon-only button - Disabled state: passing
onPressed: nulldisables the button with correct Carbon disabled colors - Hover and press states with animated background transitions (
durationFast01) - Focus ring: 2 px focus outline extending outside the button bounds, using
borderInteractivetoken - Keyboard accessibility: Space and Enter key activation
- Typography follows Carbon type scale —
bodyCompact01(14 px) for sm/md/lg andbodyCompact02(16 px) for xl/2xl
- Seven kind variants via
- Added
-
CarbonDataTable
- Added
CarbonDataTablewidget with comprehensive features following Carbon Design System specifications:- Expandable rows: Supports custom expandable content with chevron indicators
- Selectable rows: Multi-select with checkboxes or single-select with radio buttons
- Radio mode: Single-row selection using radio buttons (
radio: true) - Batch selection: Select-all checkbox in header with indeterminate state support
- Size variants: Four density options via
CarbonDataTableSizeenum (tall, medium, short, compact) - Sortable columns: Full sort state management with ascending/descending/none states
- Sort indicators with up/down arrows
- Per-column sortable control
- Programmatic sort control via
sortKeyandsortDirection - Click-to-sort with automatic direction cycling
- Zebra striping: Alternating row colors for better visual separation (
zebra: true) - Toolbar support: Built-in support for title, description, and custom toolbar widgets
- Skeleton loading state: Animated loading placeholders with configurable row count
- Efficient architecture: Uses
InheritedWidgetfor configuration distribution (no row copying or iteration) - Horizontal scrolling: Via
minWidthproperty - Flexible column sizing: With
flexand fixedwidthsupport - Custom alignment:
mainAxisAlignmentandcrossAxisAlignmentfor headers and cells - Required header keys: Headers now require unique
keyproperty for sorting and column identification
- Added
-
CarbonToolbar
- Added comprehensive toolbar component system for data tables:
- CarbonToolbar: Main container with automatic switching between regular and batch actions
- CarbonToolbarContent: Wrapper for search, filters, and action buttons
- CarbonToolbarBatchActions: Batch actions toolbar shown when items are selected
- Shows selected count
- Cancel button to clear selection
- Flexible action buttons for bulk operations
- Highlighted background to indicate active state
- CarbonToolbarSearch: Styled search field component
- Search icon prefix
- Clear button when text entered
- Expandable or fixed width modes
- Carbon-styled borders and colors
- Added comprehensive toolbar component system for data tables:
-
CarbonTabs
- Added
CarbonTabswidget for explicit Carbon Design System tab styling (Line and Contained). - Added
extendLineparameter to extend the bottom border across the full width (Line type only). - Added auto-scroll behavior to center the selected tab when it changes.
- Added
Component Updates #
-
CarbonNavItem
- Fixed interaction handling.
- Added support for
onTapon children and menu headers.
-
CarbonStructuredList
- Added
sizeproperty to supportnormal(default) andcondensedsizes. - Added custom alignment support (
mainAxisAlignment,crossAxisAlignment) for headers and cells.
- Added
-
CarbonBreadcrumb
- Fixed default behavior to omit trailing slash after the last item (
noTrailingSlashnow defaults totrue).
- Fixed default behavior to omit trailing slash after the last item (
-
CarbonContentSwitcher
- Fixed
G10theme visibility issue where selected text was white on white background (changed text color togray100). - Fixed
G10theme border visibility issue (changed divider color togray30). - Updated to support generic value types (previously restricted to
String).
- Fixed
-
CarbonTile
- Added optional
backgroundColorparameter to allow custom background color override.
- Added optional
-
CarbonToggle
- Enhanced
CarbonToggle:- Added
hideStateTextparameter for small toggles (hides On/Off text). - Added assertions to validate proper configuration (small size requirement, accessibility).
- Added
- Enhanced
-
CarbonUIShell
- Added chevron icons to side nav menu items with children.
- Added assertion to prevent conflicting usage of deprecated
onSideNavItemTapandCarbonNavItem.onTap.
-
CarbonDropdown
- Complete rewrite using custom overlay implementation (replaced Flutter's
DropdownButton). - Added precise Carbon Design System compliance (no forced padding, exact sizing, sharp corners).
- Added
widthparameter for optional fixed-width dropdowns (usesExpandedinternally when specified). - Added smart positioning logic (menu appears above trigger when near bottom of screen).
- Added hover effects with proper Carbon colors (
layerHover01). - Added checkmark icon for selected items.
- Improved menu item styling with proper selection and disabled states.
- Fixed chevron icon appearing immediately after text instead of at the trailing edge. The trigger row now uses
LayoutBuilderto detect bounded constraints: usesExpandedfor the label when width is constrained (e.g. insideExpandedparent), and falls back to natural sizing when unconstrained (e.g. insideRow(mainAxisSize: MainAxisSize.min)).
- Complete rewrite using custom overlay implementation (replaced Flutter's
-
CarbonPagination
- Refactored to match Carbon Design System specifications:
- Created custom
_PageSelectorwidget usingCarbonDropdown. - Implemented Left/Right section layout (Items per page | Page selector + Navigation).
- Added
layer01background color. - Added vertical dividers between sections.
- Created custom
- Updated visual spacing and alignment for compact appearance.
- Refactored to match Carbon Design System specifications:
-
CarbonTearsheet
- Added responsive width logic: Automatically adapts to screen width on smaller devices (e.g., mobile) while respecting the maximum width defined by
CarbonTearsheetWidth(narrow/wide). - Fixed action button layout to match Carbon action-set specification: buttons now fill the full footer width equally with no padding or gaps between them (previously right-aligned with 16px container padding and 8px gaps).
- Action buttons should be sized by callers: use
CarbonButtonSize.xl(64px) for narrow tearsheets andCarbonButtonSize.twoXl(80px) for wide tearsheets, matching the Carbon web component behavior. - Added
scrollableparameter (defaults totrue). When set tofalse, the content area usesExpandedinstead ofSingleChildScrollView, allowing children that manage their own scrolling (e.g.TabBarView) to lay out correctly.
- Added responsive width logic: Automatically adapts to screen width on smaller devices (e.g., mobile) while respecting the maximum width defined by
-
CarbonComboBox
CarbonComboBoxItemnow supports an optionalchild(Widget) parameter as an alternative tolabel(String).- Exactly one of
labelorchildmust be provided — enforced by assert. - When
childis provided, it is rendered as the dropdown item instead ofText(label). - Filtering falls back to
value.toString()whenlabelis absent. - Added
filterTextgetter onCarbonComboBoxItemfor consistent filter logic.
- Exactly one of
- Added
onSearchcallback for external/database-driven search.- When
onSearchis provided, client-side filtering is disabled — the parent is responsible for updatingitemsin response to the query. - Useful for large datasets where items should be fetched on demand (e.g. SQLite full-text search).
- When
- Added keyboard navigation support.
- ↓ / ↑ Arrow: moves highlight through dropdown items; opens the dropdown if closed.
- Enter / Numpad Enter: selects the currently highlighted item.
- Escape: closes the dropdown.
- Holding an arrow key repeats navigation (
KeyRepeatEventhandled). - Dropdown list auto-scrolls to keep the highlighted item visible.
- Highlighted item is visually indicated using
menuItemHovercolor.
- Removed Material underline border from the internal
TextField(all border variants set toInputBorder.none).
-
CarbonTag (new)
- Added
CarbonTagwidget — a native Carbon Design System tag component, replacing Flutter'sChipfor Carbon-compliant tag rendering. - Supports 12 color variants via
CarbonTagTypeenum:red,magenta,purple,blue,cyan,teal,green,gray,coolGray,warmGray,highContrast,outline. Colors use fixed IBM Design Language palette values, independent of the active theme. - Supports 3 size variants via
CarbonTagSizeenum:sm(18px),md(24px, default),lg(32px). - Provide
onDismisscallback to render a dismissible tag with a close icon button. disabledparameter dims text and disables the close button.- Hover state with per-type hover color using
MouseRegion. - Fully pill-shaped (
borderRadius: 100);outlinetype renders with a 1px border and transparent background.
- Added
-
CarbonFileUploaderDropZone
- Added
dragTextparameter to customize the primary drop zone label (defaults to'Drag and drop files here or'). - Added
browseTextparameter to customize the secondary browse label (defaults to'click to upload').
- Added
Bug Fixes #
-
CarbonDataTableRow
- Fixed: clicking the row body on an expandable row toggled the visual expansion state but did not fire
onExpansionChanged. The callback is now called consistently whether the row is expanded via the chevron or by tapping the row body. - Both parameters are ignored when a custom
childwidget is provided.
- Fixed: clicking the row body on an expandable row toggled the visual expansion state but did not fire
-
CarbonMultiSelect
- Selected item chips now render using
CarbonTaginstead of Flutter'sChip, eliminating thecontentSize >= rawLabelSize.heightlayout assertion caused by the globalChipThemeDatanegative verticallabelPadding.
- Selected item chips now render using
1.0.1+1 #
- Fixed issue with inverted colors in generated icons (e.g.,
4k-filled,checkbox-checked-filled) caused by transparent bounding box elements in SVGs.
1.0.1 #
- Refactored
G100Themeto use a constant theme definition with a private constructor for consistency.
1.0.0+4 #
- Updated
ButtonsDemoPageto correctly documentElevatedButtonas the Carbon secondary button variant. - Integrated
super_drag_and_droppackage inFileUploaderDemoPagefor native drag and drop support.
1.0.0+3 #
- Fixed deprecated
RadioListTile.groupValueusage in example app by migrating toRadioGroupwidget (Flutter v3.32.0+) - Fixed Dart formatting issue
1.0.0+2 #
- README.md updated
1.0.0+1 #
- static analysis fix for pub.dev
1.0.0 #
- Initial release with Carbon Design System V11.