Skip to content
On this page

BarChart

A chart for comparing values with rectangular bars.

BarChart in FluttyUIBarChart in FluttyUI dark theme

Import

import 'package:flutter/widgets.dart';
import 'package:fluttyui/fluttyui.dart' as ui;

API Reference

The declarations below match the current FluttyUI source. Types are shown without the optional ui. import prefix.

BarChart

const BarChart({
  super.key,
  required this.data,
  required this.xKey,
  required this.yKeys,
  required this.builder,
  this.height,
  this.padding = EdgeInsets.zero,
  this.domainPadding = const EdgeInsets.symmetric(
    horizontal: 12,
    vertical: 8,
  ),
  this.barEdgePadding = 12,
  this.domain,
  this.viewport,
  this.xAxis = const BarXAxis(),
  this.yAxis = const [BarYAxis()],
  this.frame,
  this.theme,
  this.animation = BarAnimationState.enabled,
  this.gestureLongPressDelay = const Duration(milliseconds: 100),
  this.onSelectionChanged,
  this.onChartBoundsChanged,
  this.overlayBuilder,
  this.semanticLabel,
});
ParameterTypeRequiredDefault
keyKey?Nonull
dataList<Map<String, Object?>>Yes—
xKeyStringYes—
yKeysList<String>Yes—
builderBarChartBuilderYes—
heightdouble?Nonull
paddingEdgeInsetsNoEdgeInsets.zero
domainPaddingEdgeInsetsNoconst EdgeInsets.symmetric( horizontal: 12, vertical: 8, )
barEdgePaddingdoubleNo12
domainBarDomain?Nonull
viewportBarDomain?Nonull
xAxisBarXAxisNoconst BarXAxis()
yAxisList<BarYAxis>Noconst [BarYAxis()]
frameBarFrame?Nonull
themeBarTheme?Nonull
animationBarAnimationStateNoBarAnimationState.enabled
gestureLongPressDelayDurationNoconst Duration(milliseconds: 100)
onSelectionChangedValueChanged<BarSelection?>?Nonull
onChartBoundsChangedValueChanged<Rect>?Nonull
overlayBuilderBarOverlayBuilder?Nonull
semanticLabelString?Nonull

Application Setup

Place components under FluttyApp to provide theme, navigation, localization, and overlay defaults. Use theme tokens for shared appearance settings.

Source

lib/src/widgets/charts/bar_chart/chart_widget.dart

This reference is generated from the BarChart declaration in the FluttyUI core checkout. The component catalog lists the other available building blocks.

DartFlutter

Get started with FluttyUI