heroForAccessible function

ThemeSpec heroForAccessible(
  1. ThemeSpec hero, {
  2. bool accessible = true,
})

hero repaired for the Accessible lock (labels and display text ≥ 7:1). Returns hero unchanged when accessible is false.

Implementation

ThemeSpec heroForAccessible(ThemeSpec hero, {bool accessible = true}) {
  if (!accessible) return hero;
  final locked = hero.copyWith(accessible: true);
  return repairTheme(locked) ??
      (throw StateError('hero ${hero.heroId} cannot reach 7:1'));
}