materialCommandInputBuilder function

CommandInputEditorBuilder materialCommandInputBuilder({
  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,
})

Uses Flutter's full Material text-field behavior without field decoration or padding. Requires the usual Material and MaterialLocalizations ancestors.

Implementation

CommandInputEditorBuilder materialCommandInputBuilder({
  Color? cursorColor,
  double? cursorWidth,
  double? cursorHeight,
  Radius? cursorRadius,
  bool? cursorOpacityAnimates,
  bool? showCursor,
  TextStyle? style,
  Brightness? keyboardAppearance,
  EdgeInsets? scrollPadding,
  EditableTextContextMenuBuilder? contextMenuBuilder,
}) =>
    (BuildContext context, CommandInputEditor editor) => Material(
      type: MaterialType.transparency,
      child: DefaultSelectionStyle(
        selectionColor: (cursorColor ?? editor.cursorColor).withValues(
          alpha: 0.4,
        ),
        child: TextField(
          controller: editor.controller,
          focusNode: editor.focusNode,
          autofocus: editor.autofocus,
          decoration: null,
          style: style ?? editor.style,
          cursorColor: cursorColor ?? editor.cursorColor,
          cursorWidth: cursorWidth ?? editor.cursorWidth,
          cursorHeight: cursorHeight ?? editor.cursorHeight,
          cursorRadius: cursorRadius ?? editor.cursorRadius,
          cursorOpacityAnimates:
              cursorOpacityAnimates ?? editor.cursorOpacityAnimates,
          showCursor: showCursor ?? editor.showCursor,
          keyboardType: TextInputType.text,
          textInputAction: TextInputAction.search,
          autocorrect: editor.autocorrect,
          enableSuggestions: editor.enableSuggestions,
          textCapitalization: editor.textCapitalization,
          smartDashesType: editor.smartDashesType,
          smartQuotesType: editor.smartQuotesType,
          keyboardAppearance: keyboardAppearance ?? editor.keyboardAppearance,
          scrollPadding: scrollPadding ?? editor.scrollPadding,
          onEditingComplete: editor.onEditingComplete,
          onSubmitted: editor.onSubmitted,
          contextMenuBuilder:
              contextMenuBuilder ??
              editor.contextMenuBuilder ??
              const TextField().contextMenuBuilder,
        ),
      ),
    );