StatCardGrid class

A responsive "bento grid" layout for dashboard stat cards — an optional full-width hero card up top, with the rest flowing into a fixed-column grid beneath it.

This is the layout half of the dashboard kit: GaugeRingCard, GaugeBarCard, and the presets in stat_card_presets.dart provide the cards, and StatCardGrid arranges them the way a car's in-cabin "booking" or status dashboard typically does — one hero stat (usually speed) commanding attention, with secondary stats (battery, range, climate, tyre pressure, ...) tiled below.

The column count adapts to the available width, so the same grid reads as a single column on a phone-sized panel and multiple columns on a tablet or in-car display.

StatCardGrid(
  hero: SpeedStatCard(controller: speedCtrl),
  children: [
    BatteryStatCard(controller: batteryCtrl),
    RangeStatCard(controller: rangeCtrl),
    ClimateStatCard(controller: climateCtrl),
    TirePressureStatCard(controller: tireCtrl),
  ],
)
Inheritance

Constructors

StatCardGrid({Key? key, Widget? hero, List<Widget> children = const [], double spacing = 16, double minTileWidth = 160, double tileAspectRatio = 1.05, double heroHeight = 240})
const

Properties

children List<Widget>
The secondary stat cards, tiled into a responsive grid beneath hero.
final
hashCode int
The hash code for this object.
no setterinherited
hero Widget?
An optional full-width card shown above the grid — typically the single most important stat (e.g. current speed).
final
heroHeight double
Fixed height reserved for hero, regardless of the grid's column count.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minTileWidth double
The narrowest a grid tile is allowed to get before another column is dropped. Smaller values pack more columns into the same width.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spacing double
Gap between cards, both within the grid and between hero and the grid.
final
tileAspectRatio double
Width-to-height ratio of each grid tile.
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