resolveFluentHorizontalBarChartWithAxisStyle function

FluentHorizontalBarChartWithAxisStyle resolveFluentHorizontalBarChartWithAxisStyle(
  1. FluentThemeData theme
)

Derives the default horizontal-bar-with-axis style from theme.

Implementation

FluentHorizontalBarChartWithAxisStyle
resolveFluentHorizontalBarChartWithAxisStyle(FluentThemeData theme) {
  final textStyles = FluentChartTextStyles.of(theme);
  return FluentHorizontalBarChartWithAxisStyle(
    // `props.barHeight || 32` (`HorizontalBarChartWithAxis.tsx:111`).
    barHeight: const WidgetStatePropertyAll<double?>(32),
    // Deliberately unset: upstream imposes no cap.
    // `props.yAxisPadding ?? 0.5` (`HorizontalBarChartWithAxis.tsx:77`).
    yAxisPadding: const WidgetStatePropertyAll<double?>(0.5),
    // The gap literal of `gapWidthLTR` (`HorizontalBarChartWithAxis.tsx:438`).
    segmentGap: const WidgetStatePropertyAll<double?>(2),
    // `rx={props.roundCorners ? 3 : 0}` (`HorizontalBarChartWithAxis.tsx:479`).
    barCornerRadius: const WidgetStatePropertyAll<double?>(3),
    // 0.1 once another legend owns the highlight
    // (`HorizontalBarChartWithAxis.tsx:489`).
    barOpacity: const WidgetStateProperty<double?>.fromMap(
      <WidgetStatesConstraint, double?>{
        WidgetState.disabled: 0.1,
        WidgetState.any: 1,
      },
    ),
    // `useHorizontalBarChartWithAxisStyles.styles.ts:44-50`.
    barLabelStyle: WidgetStatePropertyAll<TextStyle?>(textStyles.barLabel),
    // `translate(±4)` (`HorizontalBarChartWithAxis.tsx:803`).
    barLabelInset: const WidgetStatePropertyAll<double?>(4),
    // `_barHeight < 16` (`HorizontalBarChartWithAxis.tsx:794`).
    minBarLabelHeight: const WidgetStatePropertyAll<double?>(16),
  );
}