S360fTable class
A customizable data table widget that provides responsive layout, scrolling capabilities, and sortable headers.
The S360fTable widget creates a responsive table that automatically switches between fixed-width and scrollable layouts based on screen size and number of columns.
Features:
- Sortable Headers: Support for clickable sortable column headers with visual indicators
- Responsive Layout: Automatically adapts to different screen sizes
- Flexible Column Sizing: Custom flex values for controlling column widths
- Action Column: Dedicated column for row-specific operations (always 100px wide)
- Row Interaction: Tap callback for row-level interactions
- Skeleton Loading: Built-in skeleton loading support for headers
- Custom Styling: Themed appearance using S360f design system
- Horizontal Scrolling: Automatic scrollbar for large tables
- Minimum Width Constraint: Optional minWidth to prevent table from shrinking below a specified width
Layout Behavior:
- Scrollable Layout
- Column Sizing: Base width calculated as screen width / number of columns
- Auto-sizing Columns: Use
-1in columnFlex for expandable columns
Example usage:
S360fTable(
tableHeaders: [
S360fTableHeader(
title: 'Name',
isSortable: true,
sortOrder: SortOrder.ascending,
onSort: () => sortByName(),
),
S360fTableHeader(title: 'Email'),
S360fTableHeader(
title: 'Status',
isSortable: true,
sortOrder: SortOrder.none,
onSort: () => sortByStatus(),
),
S360fTableHeader(title: 'Actions'),
],
dataCount: users.length,
tableDataBuilder: (index) => [
Text(users[index].name),
Text(users[index].email),
Chip(label: Text(users[index].status)),
],
actionsBuilder: (index) => Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: Icon(Icons.edit),
onPressed: () => editUser(users[index]),
),
IconButton(
icon: Icon(Icons.delete),
onPressed: () => deleteUser(users[index]),
),
],
),
onTap: (index) => viewUserDetails(users[index]),
columnFlex: [2.0, 3.0, 1.5, 1.0], // Last value ignored for actions column
minWidth: 800, // Optional: prevents table from shrinking below 800px
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- S360fTable
- Available extensions
Constructors
-
S360fTable({required List<
S360fTableHeader> tableHeaders, required int dataCount, required TableDataBuilder tableDataBuilder, required void onTap(int), required List<double> columnFlex, ColumnActionBuilder? actionsBuilder, ScrollController? scrollController, double? minWidth, Key? key}) -
Creates a new S360fTable widget.
const
Properties
- actionsBuilder → ColumnActionBuilder?
-
A function that builds the action widget for each row.
final
-
columnFlex
→ List<
double> -
Defines the flex values for each column to control their relative widths.
final
- dataCount → int
-
The total number of data rows to display in the table.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- minWidth → double?
-
Optional minimum width constraint for the table.
final
- onTap → void Function(int)
-
Callback function called when a table row is tapped.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
Optional scroll controller for the horizontal scrolling.
final
- tableDataBuilder → TableDataBuilder
-
A function that builds the data widgets for each row.
final
-
tableHeaders
→ List<
S360fTableHeader> -
The list of widgets to display as column headers.
final
Methods
-
animateOnActionTrigger(
AnimationInfo animationInfo, {List< Effect> ? effects, bool hasBeenTriggered = false}) → Widget -
Available on Widget, provided by the AnimatedWidgetExtension extension
-
animateOnPageLoad(
AnimationInfo animationInfo, {List< Effect> ? effects}) → Widget -
Available on Widget, provided by the AnimatedWidgetExtension extension
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< S360fTable> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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