From 16ed1e27a7d9702dc69808d6b4b8e2e8bda6d877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Thu, 16 Feb 2023 10:16:57 +0100 Subject: [PATCH] feat(ui_components): add text input abstract class (#138) --- .../domain/entities/text_input_component.dart | 151 ++++++++++++++++++ .../entities/text_input_component.g.dart | 139 ++++++++++++++++ 2 files changed, 290 insertions(+) create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/text_input_component.dart create mode 100644 packages/wyatt_ui_components/lib/src/domain/entities/text_input_component.g.dart diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/text_input_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/text_input_component.dart new file mode 100644 index 00000000..fc7a78dc --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/text_input_component.dart @@ -0,0 +1,151 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'dart:ui'; + +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; + +part 'text_input_component.g.dart'; + +@ComponentProxyExtension() +abstract class TextInputComponent extends Component + with CopyWithMixin<$TextInputComponentCWProxy> { + const TextInputComponent({ + this.backgroundColors, + this.borderColors, + this.radius, + this.controller, + this.focusNode, + this.decoration, + this.keyboardType, + this.smartDashesType, + this.smartQuotesType, + this.enableInteractiveSelection, + this.textInputAction, + this.textCapitalization, + this.style, + this.strutStyle, + this.textAlign, + this.textAlignVertical, + this.textDirection, + this.readOnly, + this.showCursor, + this.autofocus, + this.obscuringCharacter, + this.obscureText, + this.autocorrect, + this.enableSuggestions, + this.maxLines, + this.minLines, + this.expands, + this.maxLength, + this.maxLengthEnforcement, + this.onChanged, + this.onEditingComplete, + this.onSubmitted, + this.onAppPrivateCommand, + this.inputFormatters, + this.enabled, + this.cursorWidth, + this.cursorHeight, + this.cursorRadius, + this.cursorColor, + this.selectionHeightStyle, + this.selectionWidthStyle, + this.keyboardAppearance, + this.scrollPadding, + this.dragStartBehavior, + this.selectionControls, + this.onTap, + this.onTapOutside, + this.mouseCursor, + this.scrollController, + this.scrollPhysics, + this.autofillHints, + this.clipBehavior, + this.restorationId, + this.scribbleEnabled, + this.enableIMEPersonalizedLearning, + this.contextMenuBuilder, + this.spellCheckConfiguration, + this.magnifierConfiguration, + super.key, + }); + + final TextMagnifierConfiguration? magnifierConfiguration; + final TextEditingController? controller; + final FocusNode? focusNode; + final InputDecoration? decoration; + final TextInputType? keyboardType; + final TextInputAction? textInputAction; + final TextCapitalization? textCapitalization; + final TextStyle? style; + final StrutStyle? strutStyle; + final TextAlign? textAlign; + final TextAlignVertical? textAlignVertical; + final TextDirection? textDirection; + final bool? autofocus; + final String? obscuringCharacter; + final bool? obscureText; + final bool? autocorrect; + final SmartDashesType? smartDashesType; + final SmartQuotesType? smartQuotesType; + final bool? enableSuggestions; + final int? maxLines; + final int? minLines; + final bool? expands; + final bool? readOnly; + final bool? showCursor; + final int? maxLength; + final MaxLengthEnforcement? maxLengthEnforcement; + final ValueChanged? onChanged; + final VoidCallback? onEditingComplete; + final ValueChanged? onSubmitted; + final AppPrivateCommandCallback? onAppPrivateCommand; + final List? inputFormatters; + final bool? enabled; + final double? cursorWidth; + final double? cursorHeight; + final Radius? cursorRadius; + final Color? cursorColor; + final BoxHeightStyle? selectionHeightStyle; + final BoxWidthStyle? selectionWidthStyle; + final Brightness? keyboardAppearance; + final EdgeInsets? scrollPadding; + final bool? enableInteractiveSelection; + final TextSelectionControls? selectionControls; + final DragStartBehavior? dragStartBehavior; + final GestureTapCallback? onTap; + final TapRegionCallback? onTapOutside; + final MouseCursor? mouseCursor; + final ScrollPhysics? scrollPhysics; + final ScrollController? scrollController; + final Iterable? autofillHints; + final Clip? clipBehavior; + final String? restorationId; + final bool? scribbleEnabled; + final bool? enableIMEPersonalizedLearning; + final EditableTextContextMenuBuilder? contextMenuBuilder; + final SpellCheckConfiguration? spellCheckConfiguration; + + final List? backgroundColors; + final List? borderColors; + final double? radius; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/text_input_component.g.dart b/packages/wyatt_ui_components/lib/src/domain/entities/text_input_component.g.dart new file mode 100644 index 00000000..da0342ae --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/domain/entities/text_input_component.g.dart @@ -0,0 +1,139 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'text_input_component.dart'; + +// ************************************************************************** +// ComponentProxyGenerator +// ************************************************************************** + +abstract class $TextInputComponentCWProxy { + TextInputComponent backgroundColors(List? backgroundColors); + TextInputComponent borderColors(List? borderColors); + TextInputComponent radius(double? radius); + TextInputComponent controller(TextEditingController? controller); + TextInputComponent focusNode(FocusNode? focusNode); + TextInputComponent decoration(InputDecoration? decoration); + TextInputComponent keyboardType(TextInputType? keyboardType); + TextInputComponent smartDashesType(SmartDashesType? smartDashesType); + TextInputComponent smartQuotesType(SmartQuotesType? smartQuotesType); + TextInputComponent enableInteractiveSelection( + bool? enableInteractiveSelection); + TextInputComponent textInputAction(TextInputAction? textInputAction); + TextInputComponent textCapitalization(TextCapitalization? textCapitalization); + TextInputComponent style(TextStyle? style); + TextInputComponent strutStyle(StrutStyle? strutStyle); + TextInputComponent textAlign(TextAlign? textAlign); + TextInputComponent textAlignVertical(TextAlignVertical? textAlignVertical); + TextInputComponent textDirection(TextDirection? textDirection); + TextInputComponent readOnly(bool? readOnly); + TextInputComponent showCursor(bool? showCursor); + TextInputComponent autofocus(bool? autofocus); + TextInputComponent obscuringCharacter(String? obscuringCharacter); + TextInputComponent obscureText(bool? obscureText); + TextInputComponent autocorrect(bool? autocorrect); + TextInputComponent enableSuggestions(bool? enableSuggestions); + TextInputComponent maxLines(int? maxLines); + TextInputComponent minLines(int? minLines); + TextInputComponent expands(bool? expands); + TextInputComponent maxLength(int? maxLength); + TextInputComponent maxLengthEnforcement( + MaxLengthEnforcement? maxLengthEnforcement); + TextInputComponent onChanged(void Function(String)? onChanged); + TextInputComponent onEditingComplete(void Function()? onEditingComplete); + TextInputComponent onSubmitted(void Function(String)? onSubmitted); + TextInputComponent onAppPrivateCommand( + void Function(String, Map)? onAppPrivateCommand); + TextInputComponent inputFormatters(List? inputFormatters); + TextInputComponent enabled(bool? enabled); + TextInputComponent cursorWidth(double? cursorWidth); + TextInputComponent cursorHeight(double? cursorHeight); + TextInputComponent cursorRadius(Radius? cursorRadius); + TextInputComponent cursorColor(Color? cursorColor); + TextInputComponent selectionHeightStyle(BoxHeightStyle? selectionHeightStyle); + TextInputComponent selectionWidthStyle(BoxWidthStyle? selectionWidthStyle); + TextInputComponent keyboardAppearance(Brightness? keyboardAppearance); + TextInputComponent scrollPadding(EdgeInsets? scrollPadding); + TextInputComponent dragStartBehavior(DragStartBehavior? dragStartBehavior); + TextInputComponent selectionControls( + TextSelectionControls? selectionControls); + TextInputComponent onTap(void Function()? onTap); + TextInputComponent onTapOutside( + void Function(PointerDownEvent)? onTapOutside); + TextInputComponent mouseCursor(MouseCursor? mouseCursor); + TextInputComponent scrollController(ScrollController? scrollController); + TextInputComponent scrollPhysics(ScrollPhysics? scrollPhysics); + TextInputComponent autofillHints(Iterable? autofillHints); + TextInputComponent clipBehavior(Clip? clipBehavior); + TextInputComponent restorationId(String? restorationId); + TextInputComponent scribbleEnabled(bool? scribbleEnabled); + TextInputComponent enableIMEPersonalizedLearning( + bool? enableIMEPersonalizedLearning); + TextInputComponent contextMenuBuilder( + Widget Function(BuildContext, EditableTextState)? contextMenuBuilder); + TextInputComponent spellCheckConfiguration( + SpellCheckConfiguration? spellCheckConfiguration); + TextInputComponent magnifierConfiguration( + TextMagnifierConfiguration? magnifierConfiguration); + TextInputComponent key(Key? key); + TextInputComponent call({ + List? backgroundColors, + List? borderColors, + double? radius, + TextEditingController? controller, + FocusNode? focusNode, + InputDecoration? decoration, + TextInputType? keyboardType, + SmartDashesType? smartDashesType, + SmartQuotesType? smartQuotesType, + bool? enableInteractiveSelection, + TextInputAction? textInputAction, + TextCapitalization? textCapitalization, + TextStyle? style, + StrutStyle? strutStyle, + TextAlign? textAlign, + TextAlignVertical? textAlignVertical, + TextDirection? textDirection, + bool? readOnly, + bool? showCursor, + bool? autofocus, + String? obscuringCharacter, + bool? obscureText, + bool? autocorrect, + bool? enableSuggestions, + int? maxLines, + int? minLines, + bool? expands, + int? maxLength, + MaxLengthEnforcement? maxLengthEnforcement, + void Function(String)? onChanged, + void Function()? onEditingComplete, + void Function(String)? onSubmitted, + void Function(String, Map)? onAppPrivateCommand, + List? inputFormatters, + bool? enabled, + double? cursorWidth, + double? cursorHeight, + Radius? cursorRadius, + Color? cursorColor, + BoxHeightStyle? selectionHeightStyle, + BoxWidthStyle? selectionWidthStyle, + Brightness? keyboardAppearance, + EdgeInsets? scrollPadding, + DragStartBehavior? dragStartBehavior, + TextSelectionControls? selectionControls, + void Function()? onTap, + void Function(PointerDownEvent)? onTapOutside, + MouseCursor? mouseCursor, + ScrollController? scrollController, + ScrollPhysics? scrollPhysics, + Iterable? autofillHints, + Clip? clipBehavior, + String? restorationId, + bool? scribbleEnabled, + bool? enableIMEPersonalizedLearning, + Widget Function(BuildContext, EditableTextState)? contextMenuBuilder, + SpellCheckConfiguration? spellCheckConfiguration, + TextMagnifierConfiguration? magnifierConfiguration, + Key? key, + }); +}