adaptiveCommandInputBuilder function
CommandInputEditorBuilder
adaptiveCommandInputBuilder({
- Color? cursorColor,
- double? cursorWidth,
- double? cursorHeight,
- Radius? cursorRadius,
- bool? cursorOpacityAnimates,
- bool? showCursor,
- TextStyle? style,
- Brightness? keyboardAppearance,
- EdgeInsets? scrollPadding,
- 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);
}
};