copyWith method

ModalBackdropTheme copyWith({
  1. ValueGetter<BorderRadiusGeometry?>? borderRadius,
  2. ValueGetter<EdgeInsetsGeometry?>? padding,
  3. ValueGetter<Color?>? barrierColor,
  4. ValueGetter<bool?>? modal,
  5. ValueGetter<bool?>? surfaceClip,
})

Creates a copy of this theme with the given fields replaced.

Uses ValueGetter functions to allow null value assignments. Any parameter set to null will use the current value.

Returns: A new ModalBackdropTheme with updated values.

Example:

final newTheme = theme.copyWith(
  barrierColor: () => Colors.red.withOpacity(0.3),
  modal: () => false,
);

Implementation

ModalBackdropTheme copyWith({
  ValueGetter<BorderRadiusGeometry?>? borderRadius,
  ValueGetter<EdgeInsetsGeometry?>? padding,
  ValueGetter<Color?>? barrierColor,
  ValueGetter<bool?>? modal,
  ValueGetter<bool?>? surfaceClip,
}) {
  return ModalBackdropTheme(
    borderRadius: borderRadius == null ? this.borderRadius : borderRadius(),
    padding: padding == null ? this.padding : padding(),
    barrierColor: barrierColor == null ? this.barrierColor : barrierColor(),
    modal: modal == null ? this.modal : modal(),
    surfaceClip: surfaceClip == null ? this.surfaceClip : surfaceClip(),
  );
}