ParallaxWidget class
A widget that overlap two widgets and gives a parallax effect to the background one. The effect is obtained by using a Stack and a nested OverflowBox twice the size of the main child For this widget working it needs to find a ParallaxArea somewhere above the tree The center of the parallax effect will be on the center of the first ParallaxArea found If no ParallaxArea is found this widget will simply render the child and the background without any effect.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ParallaxWidget
Constructors
- ParallaxWidget({Key? key, required Widget child, Widget? background, double overflowWidthFactor = 2, double overflowHeightFactor = 2, bool fixedHorizontal = false, bool fixedVertical = false, bool inverted = false, Alignment alignment = Alignment.center, bool clipOverflow = true, bool showDebugInfo = false, EdgeInsets parallaxPadding = EdgeInsets.zero})
-
const
Properties
- alignment → Alignment
-
define the point where this Parallax should be centered
The aligment will be relative to the parent ParallaxArea, for example
if you set the Alignment.topLeft, the Background widget will be centered
when the ParallaxWidget top and left will be aligned with the top and the
left of the ParallaxArea parent.
default value Alignment.center
final
- background → Widget?
-
The widget to be placed in the background,
it will be contained in a OverflowBox and sized according
to overflowWidthFactor and overflowHeightFactor
final
- child → Widget
-
Main child to be displayed
the size of the background will be matched to this child
final
- clipOverflow → bool
-
define if the overflow should be clipped
if not clipped the content will overflow outside the ParallaxWidget
default value true
final
- fixedHorizontal → bool
-
if true the parallax effect will be disabled for the horizontal Axis
default value false
final
- fixedVertical → bool
-
if true the parallax effect will be disabled for the vertical Axis
default value false
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- inverted → bool
-
if true the parallax effect will be inverted for both Axis
default value false
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- overflowHeightFactor → double
-
The height multiplier factor, the background will be as taller as the child
multiplied by the overflowHeightFactor
increasing this value will increase the parallax effect during vertical scroll
Min value 1, default value 2
final
- overflowWidthFactor → double
-
The width multiplier factor, the background will be as larger as the child
multiplied by the overflowWidthFactor.
increasing this value will increase the parallax effect during horizontal scroll
Min value 1, default value 2
final
- parallaxPadding → EdgeInsets
-
give the parallax a general padding, used to avoid pixel
bleeding if the content doesn't cover completely the viewport
default value EdgeInsets.zero
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showDebugInfo → bool
-
show some debug info like positioning on the currentParallax boundary and overflows
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _ParallaxWidgetState -
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}) → 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