copyWith method

  1. @useResult
FItemStyle copyWith({
  1. FWidgetStateMap<Color?>? backgroundColor,
  2. EdgeInsetsGeometry? margin,
  3. FWidgetStateMap<BoxDecoration?>? decoration,
  4. FItemContentStyle contentStyle(
    1. FItemContentStyle
    )?,
  5. FRawItemContentStyle rawItemContentStyle(
    1. FRawItemContentStyle
    )?,
  6. FTappableStyle tappableStyle(
    1. FTappableStyle
    )?,
  7. FFocusedOutlineStyle? focusedOutlineStyle,
})

Returns a copy of this FItemStyle with the given properties replaced.

Where possible, it is strongly recommended to use the CLI to generate a style and directly modify the style.

backgroundColor

The item's background color.

It is applied to the entire item, including margin. Since it is applied before decoration in the z-layer, it is not visible if decoration has a background color.

This is useful for setting a background color when margin is not zero.

Supported states:

margin

The margin around the item, including the decoration.

Defaults to const EdgeInsets.symmetric(vertical: 2, horizontal: 4).

decoration

The item's decoration.

An FItem is considered tappable if FItem.onPress or FItem.onLongPress is not null.

The supported states if the item is tappable:

The supported states if the item is untappable:

contentStyle

The default item content's style.

rawItemContentStyle

THe default raw item content's style.

tappableStyle

The tappable style.

focusedOutlineStyle

The focused outline style.

Implementation

@useResult
FItemStyle copyWith({
  FWidgetStateMap<Color?>? backgroundColor,
  EdgeInsetsGeometry? margin,
  FWidgetStateMap<BoxDecoration?>? decoration,
  FItemContentStyle Function(FItemContentStyle)? contentStyle,
  FRawItemContentStyle Function(FRawItemContentStyle)? rawItemContentStyle,
  FTappableStyle Function(FTappableStyle)? tappableStyle,
  FFocusedOutlineStyle? focusedOutlineStyle,
}) => FItemStyle(
  backgroundColor: backgroundColor ?? this.backgroundColor,
  margin: margin ?? this.margin,
  decoration: decoration ?? this.decoration,
  contentStyle: contentStyle != null ? contentStyle(this.contentStyle) : this.contentStyle,
  rawItemContentStyle: rawItemContentStyle != null
      ? rawItemContentStyle(this.rawItemContentStyle)
      : this.rawItemContentStyle,
  tappableStyle: tappableStyle != null ? tappableStyle(this.tappableStyle) : this.tappableStyle,
  focusedOutlineStyle: focusedOutlineStyle ?? this.focusedOutlineStyle,
);