NxBackgroundLayer class

A widget that creates a full-screen background layer with support for images or solid colors.

This widget can display either:

  • An image from assets or network as a background
  • A solid color background

The widget automatically sizes itself to fill the screen and can be positioned with an optional vertical shift.

Example usage with asset image:

NxBackgroundLayer(
  fromAssets: true,
  imagePath: 'assets/images/background.jpg',
  imageOpacity: 0.8,
)

Example usage with network image:

NxBackgroundLayer(
  fromAssets: false,
  imagePath: 'https://example.com/background.jpg',
)

Example usage with solid color:

NxBackgroundLayer(
  backgroundColor: Colors.black.withOpacity(0.3),
)
Inheritance

Constructors

NxBackgroundLayer.new({bool fromAssets = true, Color? backgroundColor, String? imagePath, double imageShift = 0.0, double imageOpacity = 1, Key? key})
Creates a background layer widget.
const

Properties

backgroundColor Color?
The background color to use when no image is provided.
final
fromAssets bool
Whether to load the image from assets.
final
hashCode int
The hash code for this object.
no setterinherited
imageOpacity double
The opacity of the background image.
final
imagePath String?
The path to the background image.
final
imageShift double
The vertical offset of the background from the bottom of the screen.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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