ColorComponent class final
ColorPicker. The panel declares one of four string formats via
->hex()/->hsl()/->rgb()/->rgba() — getFormat() is the ONLY
accessor ColorPicker exposes (measured in vendor/filament/forms/src/
Components/ColorPicker.php), and the value on the wire is a plain string
in that format. This client never converts it to another one: an rgb
field gets rgb back, byte for byte, everywhere it did not itself edit
the text.
No graphical picker, and no hand-rolled colour maths for one either: a
full HSV picker's conversion is easy to get subtly wrong and hard to
test, so the owner chose a text field with a live swatch instead (see the
P8 design doc). match is the one regex per format this client trusts —
copied from Filament's own documented validation patterns
(vendor/filament/forms/docs/17-color-picker.md, "Color picker
validation"), not invented — and it is the single place both
client_validator.dart (to block a malformed value at submission) and
ColorFieldWidget (to decide the swatch) read through, so "malformed"
cannot mean two different things in two places. It stays pure Dart
(RegExp only, no Color) — turning a match into an actual colour for
display is the widget's job, the same split EntryComponent draws
between a semantic colour NAME and a Flutter Color.
- Inheritance
-
- Object
- SchemaComponent
- ColorComponent
Properties
- columnSpan → int
-
Out of 12, matching Filament. A phone renderer treats anything >= 6 as
full width; the value is carried so a tablet renderer can use it later.
finalinherited
- defaultValue → String?
-
final
- disabled → bool
-
finalinherited
- format → ColorFormat
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helperText → String?
-
finalinherited
-
finalinherited
- label → String?
-
finalinherited
- live → bool
-
When true, a change to this field triggers a
/stateround-trip so the server can re-evaluate the schema.finalinherited - name → String?
-
Field key. Null for layout containers, which hold no value.
finalinherited
-
props
→ List<
Object?> -
Equality is
(type, name, writable)— meaningful only within a single container.nameis a field key that's unique within one form or infolist, not globally, so two components from different resources, or from a form vs its infolist, can compare equal here while differing in every other property. Do not put components from different containers into the sameSetor diff them against each other on this equality.writableis included: a/stateround-trip can flip it on a field whose type and name are otherwise unchanged, and a rebuild that depends on that difference needs the equality to see it.translatableis included for the same reasonwritableis: it is what decides whether this leaf renders inside a locale-chip group at all.no setterinherited - rules → ValidationRules
-
Client-side validation hints. A base-node property in the contract (§5.3),
so every consumer can ask "is this required?" without switching over the
sealed hierarchy. Containers and entries simply carry
ValidationRules.none.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true, thetoStringmethod will be overridden to output this instance'sprops.no setterinherited - translatable → bool
-
True only on a dotted leaf (
caption.ar) whose head attribute (caption) is translatable on the model — thewritable/placeholderprecedent: published only when true, absent everywhere else, including the undotted scalar sibling. The form screen groups every leaf sharing a head-of-name into one field slot with locale chips instead of one stacked field per locale; seeResourceFormScreen's node walk.finalinherited - type → String
-
The raw contract discriminator, kept so an UnknownComponent can name
itself and so debug output matches the JSON.
finalinherited
- writable → bool
-
False only when the server marks a field it cannot persist — distinct
from disabled, which is a UI decision the user may be able to change
elsewhere. Absent in the contract means
true: most fields are writable, and the key exists to name the exception, not the rule.finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
isValid(
String raw, ColorFormat format) → bool -
match(
String raw, ColorFormat format) → RegExpMatch? -
Matches
raw(leading/trailing whitespace ignored) against the pattern forformat. Null means malformed — the single answer both a widget and a headless validator read.