MedalTable class

A ranking ("medal") table.

Renders an arbitrary number of items as ranked rows. The top three ranks receive gold, silver and bronze medals; the rest get a numbered badge.

MedalTable(
  leadingTitle: 'Rank',
  labelTitle: 'Team',
  valueTitle: 'UCL Titles',
  sortByValue: true,
  items: const [
    TableItemModel(title: 'Real Madrid', value: 15),
    TableItemModel(title: 'Milan', value: 7),
    TableItemModel(title: 'Liverpool', value: 6),
    TableItemModel(title: 'Bayern', value: 6),
  ],
)

Without maxHeight the table is as tall as all of its rows. When it is placed in a space of limited height, either set maxHeight to scroll the rows under a fixed header, or put the table inside a scroll view.

Inheritance

Constructors

MedalTable({Key? key, required List<TableItemModel> items, required String leadingTitle, required String labelTitle, String valueTitle = '', List<String>? valueTitles, TextStyle? itemTextStyle, TextStyle? headerTextStyle, bool hideHeader = false, BoxDecoration? headerDecoration, bool sortByValue = false, bool descending = true, bool sharedRanks = false, List<Color> medalColors = kDefaultMedalColors, Color? oddRowColor, Color? evenRowColor, BoxDecoration? rowDecoration, double rowSpacing = 2, int leadingFlex = 1, int labelFlex = 2, int valueFlex = 2, bool showTrend = false, Color? trendUpColor, Color? trendDownColor, Color? trendSameColor, double? maxHeight, EdgeInsetsGeometry itemPadding = const EdgeInsets.symmetric(vertical: 2), MedalTableSemanticsLabelBuilder? semanticsLabelBuilder})
const

Properties

descending → bool
Sort direction used when sortByValue is true. Defaults to descending (highest value ranked first).
final
evenRowColor → Color?
Background color for even rows (2nd, 4th, 6th … row).
final
hashCode → int
The hash code for this object.
no setterinherited
headerDecoration → BoxDecoration?
Decoration for the header container.
final
headerTextStyle → TextStyle?
Text style for the header row.
final
hideHeader → bool
Hides the header row when true.
final
itemPadding → EdgeInsetsGeometry
Padding applied inside each data row.
final
items → List<TableItemModel>
Rows of the table, in display order unless sortByValue is set.
final
itemTextStyle → TextStyle?
Text style for data rows.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelFlex → int
Flex of the label (name) column.
final
labelTitle → String
Title of the label (name) column.
final
leadingFlex → int
Flex of the leading (rank) column.
final
leadingTitle → String
Title of the leading (rank) column.
final
maxHeight → double?
When set, rows scroll within this height while the header stays fixed.
final
medalColors → List<Color>
Colors for the medals of ranks 1–3 (gold, silver, bronze).
final
oddRowColor → Color?
Background color for odd rows (1st, 3rd, 5th … row).
final
rowDecoration → BoxDecoration?
Extra decoration applied to every data row.
final
rowSpacing → double
Vertical gap between consecutive rows.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticsLabelBuilder → MedalTableSemanticsLabelBuilder?
Builds the label screen readers announce for each row.
final
sharedRanks → bool
Gives tied rows the same rank, skipping the ranks that follow (1, 2, 3, 3, 5) — tied rows then also share a medal.
final
showTrend → bool
Renders a per-row trend arrow based on TableItemModel.trend.
final
sortByValue → bool
Sorts items before assigning ranks.
final
trendDownColor → Color?
Color of the TrendDirection.down arrow. Defaults to red.
final
trendSameColor → Color?
Color of the TrendDirection.same marker. Defaults to the theme's ColorScheme.outline.
final
trendUpColor → Color?
Color of the TrendDirection.up arrow. Defaults to green.
final
valueFlex → int
Flex of the value column.
final
valueTitle → String
Title of the single value column.
final
valueTitles → List<String>?
Titles for multiple value columns.
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