Lightning class
A widget that applies a lightning overlay effect to its child.
The Lightning widget wraps a child widget and applies an animated lightning effect overlay. The effect can be triggered automatically, manually via a controller, or through gestures.
Example usage:
Lightning(
child: Container(
width: 200,
height: 100,
color: Colors.blue,
child: Text('Tap me!'),
),
useGesture: true,
overlayColor: Colors.white.withOpacity(0.3),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- Lightning
Constructors
- Lightning({Key? key, required Widget child, Duration? delayDuration = const Duration(milliseconds: 500), bool useGesture = false, double borderRadius = 0, bool repeatInfinity = false, LightningController? controller, Duration pauseRepeatInfinityDelay = const Duration(seconds: 2), Color overlayColor = const Color.fromRGBO(255, 255, 255, 0.1), Duration pauseDuration = const Duration(milliseconds: 200), Duration durationIn = const Duration(milliseconds: 300), Duration durationOut = const Duration(milliseconds: 600), Curve curveIn = Curves.easeIn, Curve curveOut = Curves.linear, LightningDirection direction = LightningDirection.leftToRight, bool autoStart = true})
-
Creates a Lightning widget.
const
Properties
- autoStart → bool
-
Whether the animation should start once widget is rendered
final
- borderRadius → double
-
Border radius for the lightning overlay.
final
- child → Widget
-
The child widget to apply the lightning effect on.
final
- controller → LightningController?
-
Optional controller to manually trigger animations.
final
- curveIn → Curve
-
Animation curve for the lightning effect appearing.
final
- curveOut → Curve
-
Animation curve for the lightning effect disappearing.
final
- delayDuration → Duration?
-
Delay before the first automatic animation starts.
final
- direction → LightningDirection
-
Direction of the lightning effect animation.
final
- durationIn → Duration
-
Duration for the lightning effect to animate in (appear).
final
- durationOut → Duration
-
Duration for the lightning effect to animate out (disappear).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- overlayColor → Color
-
Color of the lightning overlay effect.
final
- pauseDuration → Duration
-
Duration to pause between the in and out animations.
final
- pauseRepeatInfinityDelay → Duration
-
Pause duration between animation repeats.
final
- repeatInfinity → bool
-
Whether the animation should repeat indefinitely.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- useGesture → bool
-
Whether the animation can be triggered by tapping the widget.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Lightning> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited