merge static method

Widget merge({
  1. Key? key,
  2. Color? cursorColor,
  3. Color? selectionColor,
  4. MouseCursor? mouseCursor,
  5. required Widget child,
})

Creates a default selection style that overrides the selection styles in scope at this point in the widget tree.

Any Arguments that are not null replace the corresponding properties on the default selection style for the BuildContext where the widget is inserted.

Implementation

static Widget merge({
  Key? key,
  Color? cursorColor,
  Color? selectionColor,
  MouseCursor? mouseCursor,
  required Widget child,
}) {
  return Builder(
    builder: (BuildContext context) {
      final DefaultSelectionStyle parent = DefaultSelectionStyle.of(context);
      return DefaultSelectionStyle(
        key: key,
        cursorColor: cursorColor ?? parent.cursorColor,
        selectionColor: selectionColor ?? parent.selectionColor,
        mouseCursor: mouseCursor ?? parent.mouseCursor,
        child: child,
      );
    },
  );
}