copyWith static method

Widget copyWith({
  1. Key? key,
  2. required Widget child,
  3. IconThemeData? iconThemeData,
  4. double? menuWidthStep,
  5. double? itemHeight,
  6. double? minMenuWidth,
  7. double? maxMenuWidth,
  8. double? menuHorizontalPadding,
  9. TextStyle? textStyle,
  10. Color? selectedColor,
  11. Color? selectedHighlightColor,
  12. Color? selectedHoverColor,
  13. Color? selectedForeground,
  14. Color? hoverColor,
  15. Color? highlightColor,
  16. Color? background,
  17. Color? color,
})

Makes a copy of the nearest ContextMenuTheme overwriting selected fields.

Implementation

static Widget copyWith({
  Key? key,
  required Widget child,
  IconThemeData? iconThemeData,
  double? menuWidthStep,
  double? itemHeight,
  double? minMenuWidth,
  double? maxMenuWidth,
  double? menuHorizontalPadding,
  TextStyle? textStyle,
  Color? selectedColor,
  Color? selectedHighlightColor,
  Color? selectedHoverColor,
  Color? selectedForeground,
  Color? hoverColor,
  Color? highlightColor,
  Color? background,
  Color? color,
}) {
  return Builder(
    key: key,
    builder: (context) => ContextMenuTheme(
      data: ContextMenuTheme.of(context).copyWith(
        iconThemeData: iconThemeData,
        menuWidthStep: menuWidthStep,
        itemHeight: itemHeight,
        minMenuWidth: minMenuWidth,
        maxMenuWidth: maxMenuWidth,
        menuHorizontalPadding: menuHorizontalPadding,
        textStyle: textStyle,
        selectedColor: selectedColor,
        selectedHighlightColor: selectedHighlightColor,
        selectedHoverColor: selectedHoverColor,
        selectedForeground: selectedForeground,
        hoverColor: hoverColor,
        highlightColor: highlightColor,
        background: background,
        color: color,
      ),
      child: child,
    ),
  );
}