NxBackgroundCard class

A customizable card widget that sizes itself relative to the screen dimensions.

This widget wraps Flutter's Card widget and adds convenient sizing functionality by allowing height and width to be specified as fractions of the screen size. It also provides common customization options like elevation, shape, and scrolling.

Example usage:

NxBackgroundCard(
  height: 0.5, // Takes up half the screen height
  elevation: 20,
  child: Column(
    children: [
      Text('Card Content'),
      // ... other widgets
    ],
  ),
)

The card automatically applies rounded corners at the top edges by default, making it suitable for bottom-sheet style interfaces when positioned at the bottom of the screen.

Inheritance

Constructors

NxBackgroundCard.new({required Widget child, double? height, double? width, Color? backgroundColor, EdgeInsetsGeometry? margin, double? elevation, ShapeBorder? shape, bool isScrollable = false, Key? key})
Creates a background card that sizes relative to screen dimensions.
const

Properties

backgroundColor Color?
The background color of the card.
final
child Widget
The widget to display inside the card.
final
elevation double?
The z-coordinate at which to place this card relative to its parent.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
The height of the card as a fraction of screen height.
final
isScrollable bool
Whether the card's content should be scrollable.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsetsGeometry?
The empty space around the card.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape ShapeBorder?
The shape of the card's border.
final
width double?
The width of the card as a fraction of screen width.
final

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