ThemeIntent constructor

ThemeIntent({
  1. Iterable<ThemeFamily> families = const [],
  2. ThemeBrightness? brightness,
  3. Iterable<IntentColor> colors = const [],
  4. IntentChroma? chroma,
  5. HarmonyScheme? harmony,
  6. (int, int)? hueRange,
  7. String? name,
})

An intent. Lists are de-duplicated and capped; disabled families are dropped; name is trimmed to maxNameWords words.

Implementation

ThemeIntent({
  Iterable<ThemeFamily> families = const [],
  this.brightness,
  Iterable<IntentColor> colors = const [],
  this.chroma,
  this.harmony,
  (int, int)? hueRange,
  String? name,
}) : families = List.unmodifiable(
       _distinct([
         for (final f in families)
           if (f.enabled) f,
       ]),
     ),
     colors = List.unmodifiable(_distinct(colors).take(maxColors)),
     hueRange = hueRange == null
         ? null
         : (_wrapDeg(hueRange.$1), _wrapDeg(hueRange.$2)),
     name = _cleanName(name);