FlagShaderOptions class
Immutable configuration for waved-flag style shader delegates.
These options describe purely visual preferences (amplitude, turbulence, highlights, etc.) and can be stored inside FlagThemeData or supplied to a FlagShaderSurface. They do not manage shader life-cycles, tickers, or GPU resources.
Usage
const options = FlagShaderOptions(
waveAmplitude: 0.04,
turbulence: 0.6,
);
return FlagShaderSurface(
isoObject,
simplifiedFlagsMap,
options: options,
);
Recommendations
- Works best for flags rendered at widths >= 320 logical pixels; extremely small icons cannot showcase the cloth motion and may look blurry.
- Shader effects are relatively GPU intensive; avoid animating multiple full-size flags simultaneously on low-end devices.
- Maintain sufficient padding/"breathing space" above and below the flag when increasing waveAmplitude to minimize clipping artifacts.
- Annotations
Constructors
- FlagShaderOptions({bool animate = true, double animationSpeed = 1, double frozenPhase = 0.25, double waveAmplitude = 0.03, double waveFrequency = 2, double wavePhaseShift = 0, double secondaryAmplitude = 0.02, double secondaryFrequency = 1.8, bool leftEdgePinned = true, bool rightEdgePinned = false, double pinSoftness = 0.15, double poleMargin = 0.02, bool shadingEnabled = true, double foldStrength = 0.4, double highlightStrength = 0.3, double shadowStrength = 0.3, double sheenStrength = 0.1, double sheenFrequency = 4, double perspective = 0.12, double seed = 1, double turbulence = 0.8, Offset waveDirection = const Offset(0.8, 0.3), double fabricVisibility = 0, bool clipContent = false, double overflowScale = 0.9})
-
Creates a new set of shader options.
const
Properties
- animate → bool
-
Whether animation should advance automatically using a ticker.
final
- animationSpeed → double
-
Multiplier applied to time advancement for slower/faster motion.
final
- clipContent → bool
-
Whether to clip shader output to flag bounds.
final
- fabricVisibility → double
-
Visibility of the procedural cloth texture (0 = off, 1 = fully visible).
final
- foldStrength → double
-
Strength of the fold/jitter applied along the vertical axis.
final
- frozenPhase → double
-
Phase used when animate is
false; determines frozen pose.final - hashCode → int
-
The hash code for this object.
no setteroverride
- highlightStrength → double
-
Brightness boost applied on lit areas.
final
- leftEdgePinned → bool
-
Pins the hoist (left) edge to the flag pole, reducing displacement there.
final
- overflowScale → double
-
Scale applied to the source flag before shader processing when
clipContent is false, leaving headroom for overflow.
final
- perspective → double
-
Fake perspective intensity (use small values, e.g. 0.1).
final
- pinSoftness → double
-
Distance (0-1) over which the pinning mask eases in.
final
- poleMargin → double
-
Margin reserved near pinned edges where displacement should be minimal.
final
- rightEdgePinned → bool
-
Pins the fly (right) edge to dampen movement.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secondaryAmplitude → double
-
Secondary wave amplitude for layered, softer motion.
final
- secondaryFrequency → double
-
Secondary wave frequency for the supplemental wave layer.
final
- seed → double
-
Seed that randomizes the noise/turbulence field.
final
- shadingEnabled → bool
-
Enables lighting calculations (folds, shading, highlights).
final
- shadowStrength → double
-
Darkness applied to shadowed folds.
final
- sheenFrequency → double
-
Frequency of the sheen shimmer.
final
- sheenStrength → double
-
Intensity of the silky sheen running across the fabric.
final
- turbulence → double
-
Global turbulence factor that adds organic irregularities.
final
- waveAmplitude → double
-
Primary wave amplitude controlling displacement magnitude.
final
- waveDirection → Offset
-
Default wave direction unit vector.
final
- waveFrequency → double
-
Primary wave frequency; higher values add more folds within the flag.
final
- wavePhaseShift → double
-
Phase offset applied to the primary wave function.
final
Methods
-
copyWith(
{bool? animate, double? animationSpeed, double? frozenPhase, double? waveAmplitude, double? waveFrequency, double? wavePhaseShift, double? secondaryAmplitude, double? secondaryFrequency, bool? leftEdgePinned, bool? rightEdgePinned, double? pinSoftness, double? poleMargin, bool? shadingEnabled, double? foldStrength, double? highlightStrength, double? shadowStrength, double? sheenStrength, double? sheenFrequency, double? perspective, double? seed, double? turbulence, Offset? waveDirection, double? fabricVisibility, bool? clipContent, double? overflowScale}) → FlagShaderOptions - Returns a copy with selectively replaced fields.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override