adaptiveAxisLabel static method

Widget adaptiveAxisLabel(
  1. BuildContext context,
  2. String text, {
  3. Color? lightColor,
  4. Color? darkColor,
  5. TextStyle? style,
})

Builds a chart axis-tick label with the same backdrop-aware contrast as GlassChart's own title/legend text.

Intended for a charting library's per-tick label callback — e.g. fl_chart's SideTitles(getTitlesWidget: ...). Requires the same GlassContentAwareScope precondition as AdaptiveGlassText generally; falls back to ambient-brightness static coloring when there is no scope to sample, the same as any other AdaptiveGlassText.

Implementation

static Widget adaptiveAxisLabel(
  BuildContext context,
  String text, {
  Color? lightColor,
  Color? darkColor,
  TextStyle? style,
}) {
  return AdaptiveGlassText(
    text,
    lightColor: lightColor ?? CupertinoColors.black.withValues(alpha: 0.6),
    darkColor: darkColor ?? CupertinoColors.white.withValues(alpha: 0.6),
    style:
        style ?? const TextStyle(fontSize: 11, fontWeight: FontWeight.w500),
  );
}