AttributeIcon constructor

AttributeIcon(
  1. Attribute attribute, {
  2. required Color backgroundColor,
  3. required double size,
  4. Color? foregroundColor,
  5. String? semanticsLabel,
})

Implementation

factory AttributeIcon(
  Attribute attribute, {
  required Color backgroundColor,
  required double size,
  Color? foregroundColor,
  String? semanticsLabel,
}) {
  return switch (attribute.id) {
    'additives' => _AttributeAdditivesIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_celery' => _AttributeCeleryIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_crustaceans' => _AttributeCrustaceansIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_eggs' => _AttributeEggsIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_fish' => _AttributeFishIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_gluten' => _AttributeGlutenIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_lupin' => _AttributeLupinIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_milk' => _AttributeMilkIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_molluscs' => _AttributeMolluscsIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_mustard' => _AttributeMustardIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_nuts' => _AttributeNutsIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_peanuts' => _AttributePeanutsIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_sesame_seeds' => _AttributeSesameSeedsIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_soybeans' => _AttributeSoybeansIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'allergens_no_sulphur_dioxide_and_sulphites' => _AttributeSulphitesIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'forest_footprint' => _AttributeForestFootprintIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'labels_fair_trade' => _AttributeFairTradeIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'labels_organic' => _AttributeOrganicFarmingIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'low_fat' => _AttributeFatIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'low_salt' => _AttributeSaltIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'low_saturated_fat' => _AttributeSaturatedFatIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'low_sugars' => _AttributeSugarIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'nova' when attribute.iconUrl?.endsWith('nova-group-1.svg') == true =>
      _AttributeNOVAIcon.group1(
        backgroundColor: backgroundColor,
        foregroundColor: foregroundColor,
        size: size,
        semanticsLabel: semanticsLabel,
      ),
    'nova' when attribute.iconUrl?.endsWith('nova-group-2.svg') == true =>
      _AttributeNOVAIcon.group2(
        backgroundColor: backgroundColor,
        foregroundColor: foregroundColor,
        size: size,
        semanticsLabel: semanticsLabel,
      ),
    'nova' when attribute.iconUrl?.endsWith('nova-group-3.svg') == true =>
      _AttributeNOVAIcon.group3(
        backgroundColor: backgroundColor,
        foregroundColor: foregroundColor,
        size: size,
        semanticsLabel: semanticsLabel,
      ),
    'nova' when attribute.iconUrl?.endsWith('nova-group-4.svg') == true =>
      _AttributeNOVAIcon.group4(
        backgroundColor: backgroundColor,
        foregroundColor: foregroundColor,
        size: size,
        semanticsLabel: semanticsLabel,
      ),
    'nova' => _AttributeNOVAIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'palm_oil_free' => _AttributePalmOilIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'vegan' => _AttributeVeganIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),
    'vegetarian' => _AttributeVegetarianIcon(
      backgroundColor: backgroundColor,
      foregroundColor: foregroundColor,
      size: size,
      semanticsLabel: semanticsLabel,
    ),

    /*'nutriscore' => EMPTY_WIDGET,
    'ecoscore' => EMPTY_WIDGET,*/
    _ => throw UnsupportedError('Unsupported attribute: ${attribute.id}'),
  };
}