ZdsSlidableListTile class
A widget that creates a slidable list tile, which can be slid right-to-left to reveal further actions. Takes a child which can be any widget, although a Row is recommended to use like so:
ZdsSlidableListTile(
child: Row(
children: [
LeadingWidget(),
Spacer(),
TrailingWidget()
],
),
);
Although this widget has predefined styling, it can be adjusted with backgroundColor and slideButtonWidth. This is recommended for example to indicate state change.
It is also possible that the actions text will not fit within the default action width and will be ellipsized, in which case you can increase slideButtonWidth. slideButtonWidth * actions.length must not exceed width.
If we don't want the slide actions to be shown (i.e. the tile is in a selected state), then slideEnabled must be set to false. This will not allow the user to slide to see more actions, but they will still be able to interact with the tile's main contents. To disable the user interacting with the tile, you can set the onTap to null.
This widget's actions are defined through ZdsSlidableAction.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ZdsSlidableListTile
- Available Extensions
Constructors
-
ZdsSlidableListTile({required double width, required Widget child, Key? key, List<
ZdsSlidableAction> ? actions, List<ZdsSlidableAction> ? leadingActions, Color? backgroundColor, double slideButtonWidth = 100, double minHeight = 80, VoidCallback? onTap, bool slideEnabled = true, String? semanticDescription, bool excludeSemantics = false}) -
A tile that can be slid to reveal further actions.
const
Properties
-
actions
→ List<
ZdsSlidableAction> ? -
The actions that will be revealed when the user swipes left on the tile. Must not be empty for the slidable action to occur.
final
- backgroundColor → Color?
-
The background color of the tile's main content. Defaults to ColorScheme.surface
final
- child → Widget
-
The tile's main content. Usually a Row
final
- excludeSemantics → bool
-
Flag to exclude child component semantics.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
leadingActions
→ List<
ZdsSlidableAction> ? -
The actions that will be revealed when the user swipes right on the tile. Must not be empty for the slidable action to occur.
final
- minHeight → double
-
Minimum height of the list tile.
final
- onTap → VoidCallback?
-
Will be called whenever the user taps on the tile's main content.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticDescription → String?
-
Description used as semantic label for the tile.
final
- slideButtonWidth → double
-
How wide each action button is. Text that does not fit this width will be ellipsized.
final
- slideEnabled → bool
-
Whether to show the slide actions.
final
- width → double
-
The length of the tile. On vertical displays this usually is
MediaQuery.of(context).size.width
. Must exceed or be equal to slideButtonWidth * actions.length.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.
override
-
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}) → 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