resolveFluentDeclarativeChartStyle function
FluentDeclarativeChartStyle
resolveFluentDeclarativeChartStyle(
- FluentThemeData theme, {
- FluentDeclarativeChartStyle? themeStyle,
- FluentDeclarativeChartStyle? widgetStyle,
Resolves a FluentDeclarativeChartStyle from the theme, then layers
themeStyle and widgetStyle on top in that order.
Every property of the returned style is non-null, so callers never need a second fallback.
Implementation
FluentDeclarativeChartStyle resolveFluentDeclarativeChartStyle(
FluentThemeData theme, {
FluentDeclarativeChartStyle? themeStyle,
FluentDeclarativeChartStyle? widgetStyle,
}) {
final colors = theme.colors;
final textStyles = FluentChartTextStyles.of(theme);
final defaults = FluentDeclarativeChartStyle.from(
// `DeclarativeChart.tsx:550-551`: the caption1 ramp at
// `colorNeutralForeground1`. The shared `FluentChartTextStyles.chartTitle`
// slot is used instead of caption1 directly, so that a declarative chart's
// multi-plot title matches the in-chart titles it sits above; that slot is
// caption2Strong (`utilities/Common.styles.ts:83-91`), which is one ramp
// smaller than upstream's caption1 here. Only the colour is restated,
// because the slot is shared.
titleTextStyle: textStyles.chartTitle.copyWith(
color: colors.neutralForeground1,
),
// `DeclarativeChart.tsx:553`: `spacingVerticalS` is 8 logical pixels.
titleBottomSpacing: 8,
errorTextStyle: textStyles.chartTitle.copyWith(
color: colors.statusDangerForeground1,
),
// `DeclarativeChart.tsx:440`.
exportBackgroundColor: colors.neutralBackground1,
// `DeclarativeChart.tsx:441`.
exportScale: 5,
);
return defaults.merge(themeStyle).merge(widgetStyle);
}