adaptiveCommandInputBuilder function

CommandInputEditorBuilder adaptiveCommandInputBuilder({
  1. Color? cursorColor,
  2. double? cursorWidth,
  3. double? cursorHeight,
  4. Radius? cursorRadius,
  5. bool? cursorOpacityAnimates,
  6. bool? showCursor,
  7. TextStyle? style,
  8. Brightness? keyboardAppearance,
  9. EdgeInsets? scrollPadding,
  10. EditableTextContextMenuBuilder? contextMenuBuilder,
})

Automatically selects cupertinoCommandInputBuilder on iOS/macOS and materialCommandInputBuilder on other platforms.

Implementation

CommandInputEditorBuilder adaptiveCommandInputBuilder({
  Color? cursorColor,
  double? cursorWidth,
  double? cursorHeight,
  Radius? cursorRadius,
  bool? cursorOpacityAnimates,
  bool? showCursor,
  TextStyle? style,
  Brightness? keyboardAppearance,
  EdgeInsets? scrollPadding,
  EditableTextContextMenuBuilder? contextMenuBuilder,
}) => (BuildContext context, CommandInputEditor editor) {
  final platform = material.Theme.of(context).platform;
  final isApple =
      platform == TargetPlatform.iOS || platform == TargetPlatform.macOS;
  if (isApple) {
    return cupertinoCommandInputBuilder(
      cursorColor: cursorColor,
      cursorWidth: cursorWidth,
      cursorHeight: cursorHeight,
      cursorRadius: cursorRadius,
      cursorOpacityAnimates: cursorOpacityAnimates,
      showCursor: showCursor,
      style: style,
      keyboardAppearance: keyboardAppearance,
      scrollPadding: scrollPadding,
      contextMenuBuilder: contextMenuBuilder,
    )(context, editor);
  } else {
    return materialCommandInputBuilder(
      cursorColor: cursorColor,
      cursorWidth: cursorWidth,
      cursorHeight: cursorHeight,
      cursorRadius: cursorRadius,
      cursorOpacityAnimates: cursorOpacityAnimates,
      showCursor: showCursor,
      style: style,
      keyboardAppearance: keyboardAppearance,
      scrollPadding: scrollPadding,
      contextMenuBuilder: contextMenuBuilder,
    )(context, editor);
  }
};