NxPhotoCard class

A card widget for displaying images with fallback support.

This widget wraps an image in a Card with rounded corners. It can display:

  • An asset image specified by imagePath
  • A custom widget specified by child
  • A placeholder when no image or child is provided

Example usage:

// Basic photo card with asset image
NxPhotoCard(
  imagePath: 'assets/images/photo.jpg',
  height: 200,
  width: double.infinity,
  elevation: 4,
)

// Photo card with custom child widget
NxPhotoCard(
  height: 200,
  width: double.infinity,
  child: Image.network(
    'https://example.com/image.jpg',
    fit: BoxFit.cover,
  ),
)

// Photo card without image (shows placeholder)
NxPhotoCard(
  height: 150,
  width: 200,
)
Inheritance

Constructors

NxPhotoCard.new({Key? key, String? imagePath, double? elevation, Widget? child, double? height, double? width})
Creates a photo card widget.
const

Properties

child Widget?
A custom widget to display instead of an asset image.
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.
final
imagePath String?
The path to the asset image to display.
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
width double?
The width of the card.
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