copyWith method

  1. @override
NavRailButton copyWith({
  1. String? label,
  2. IconData? icon,
  3. dynamic onTap()?,
  4. bool? expanded,
  5. bool? selected,
  6. bool? showSelected,
  7. double? width,
  8. double? height,
  9. Color? selectedColor,
  10. Color? selectedBackgroundColor,
  11. Color? unselectedColor,
  12. Color? unselectedBackgroundColor,
  13. BorderRadius? borderRadius,
  14. NavRailDirection? direction,
  15. NavRailButtonLabelPosition? labelPosition,
})
override

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

This method is used internally by the navigation system to update button properties based on state changes (selected, expanded, etc.).

All parameters are optional and will use the current values if not provided.

Implementation

@override
NavRailButton copyWith({
  String? label,
  IconData? icon,
  Function()? onTap,
  bool? expanded,
  bool? selected,
  bool? showSelected,
  double? width,
  double? height,
  Color? selectedColor,
  Color? selectedBackgroundColor,
  Color? unselectedColor,
  Color? unselectedBackgroundColor,
  BorderRadius? borderRadius,
  NavRailDirection? direction,
  NavRailButtonLabelPosition? labelPosition,
}) => NavRailButton(
  label: label ?? this.label,
  icon: icon ?? this.icon,
  onTap: onTap ?? this.onTap,
  expanded: expanded ?? this.expanded,
  selected: selected ?? this.selected,
  showSelected: showSelected ?? this.showSelected,
  width: width ?? this.width,
  height: height ?? this.height,
  selectedColor: selectedColor ?? this.selectedColor,
  selectedBackgroundColor:
      selectedBackgroundColor ?? this.selectedBackgroundColor,
  unselectedColor: unselectedColor ?? this.unselectedColor,
  unselectedBackgroundColor:
      unselectedBackgroundColor ?? this.unselectedBackgroundColor,
  borderRadius: borderRadius ?? this.borderRadius,
  labelPosition: labelPosition ?? this.labelPosition,
  key: key,
  direction: direction ?? this.direction,
);