light3D property

Implementation

static ComponentDefinition<Light3DComponent> get light3D =>
    ComponentDefinition<Light3DComponent>(
      type: 'Light3DComponent',
      id: 'light_3d_4f9a12d0',
      create: Light3DComponent.new,
      hints: ComponentHints(
        dimensions: Dimensions.threeD,
        name: 'Light',
        group: '3D',
        description: 'A directional, point or spot light.',
        icon: Icons.lightbulb_outline,
        accentColor: const Color(0xFFFFCA28),
        fields: {
          'kind': const FieldHint(label: 'Kind'),
          'color': const FieldHint(label: 'Colour'),
          'intensity': const FieldHint(
            label: 'Intensity',
            scrub: ScrubHint(step: 0.5, fractionDigits: 1),
          ),
          'range': FieldHint(
            label: 'Range',
            scrub: const ScrubHint(step: 0.5, fractionDigits: 1, suffix: 'm'),
            visibleWhen: (c) =>
                (c as Light3DComponent).kind != Light3DKind.directional,
          ),
          'innerConeAngle': FieldHint(
            label: 'Inner cone',
            unit: AngleUnit.degrees,
            scrub: const ScrubHint(step: 1, fractionDigits: 0, suffix: '°'),
            visibleWhen: (c) =>
                (c as Light3DComponent).kind == Light3DKind.spot,
          ),
          'outerConeAngle': FieldHint(
            label: 'Outer cone',
            unit: AngleUnit.degrees,
            scrub: const ScrubHint(step: 1, fractionDigits: 0, suffix: '°'),
            visibleWhen: (c) =>
                (c as Light3DComponent).kind == Light3DKind.spot,
          ),
        },
      ),
      fields: [
        FieldDefinition(
          name: 'kind',
          kind: const EnumFieldType(
            Light3DKind.values,
            fallback: Light3DKind.point,
            id: 'graphics.lightKind',
          ),
          read: (c) => (c as Light3DComponent).kind,
          write: (c, v) => (c as Light3DComponent).kind = v as Light3DKind,
        ),
        FieldDefinition(
          name: 'color',
          kind: FieldTypes.color,
          read: (c) => (c as Light3DComponent).color,
          write: (c, v) => (c as Light3DComponent).color = v as Color,
        ),
        _decimal(
          'intensity',
          (c) => (c as Light3DComponent).intensity,
          (c, v) => (c as Light3DComponent).intensity = v,
          min: 0,
        ),
        _decimal(
          'range',
          (c) => (c as Light3DComponent).range,
          (c, v) => (c as Light3DComponent).range = v,
          min: 0,
        ),
        _decimal(
          'innerConeAngle',
          (c) => (c as Light3DComponent).innerConeAngle,
          (c, v) => (c as Light3DComponent).innerConeAngle = v,
          min: 0,
        ),
        _decimal(
          'outerConeAngle',
          (c) => (c as Light3DComponent).outerConeAngle,
          (c, v) => (c as Light3DComponent).outerConeAngle = v,
          min: 0,
        ),
      ],
    );