Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextField params pass through #69

Closed
vasilich6107 opened this issue Oct 18, 2021 · 8 comments · Fixed by #70
Closed

TextField params pass through #69

vasilich6107 opened this issue Oct 18, 2021 · 8 comments · Fixed by #70
Labels

Comments

@vasilich6107
Copy link

Is there any specific reason to pass through so few arguments to the textfield?
https://github.com/cedvdb/phone_form_field/blob/dev/lib/src/widgets/phone_field.dart#L150

The TextField has much more arguments that user would like to pass

@cedvdb
Copy link
Owner

cedvdb commented Oct 18, 2021

There is no technical reason. The reason originally was to keep it simple and for convenience of development, added on a request basis. I can add all of those at once though so it's done.

Those will be added, others do not make sens on such an input (capitalization, maxLines,...)

    this.style,
    this.strutStyle,
    this.textAlign = TextAlign.start,
    this.textAlignVertical,
    this.textDirection,
    ToolbarOptions? toolbarOptions,
    this.showCursor,
    obscuringCharacter = '•',
     obscureText = false,
    autocorrect = true,
    SmartDashesType? smartDashesType,
    SmartQuotesType? smartQuotesType,
    this.enableSuggestions = true,    
    this.onSubmitted,
    this.onAppPrivateCommand,
    this.cursorWidth = 2.0,
    this.cursorHeight,
    this.cursorRadius,
    this.cursorColor,
    this.selectionHeightStyle = ui.BoxHeightStyle.tight,
    this.selectionWidthStyle = ui.BoxWidthStyle.tight,
    this.keyboardAppearance,
    this.scrollPadding = const EdgeInsets.all(20.0),
    this.dragStartBehavior = DragStartBehavior.start,
    this.enableInteractiveSelection = true,
    this.selectionControls,
    this.onTap,
    this.mouseCursor,
    this.buildCounter,
    this.scrollController,
    this.scrollPhysics,
    this.enableIMEPersonalizedLearning = true,
    ```

@cedvdb
Copy link
Owner

cedvdb commented Oct 18, 2021

should be fixed for 4.3.0, not published yet, awaiting potential other requests from you

branch issue-69-params-passthrough

@vasilich6107
Copy link
Author

Hi @cedvdb
What about focusNode and controller?

@cedvdb
Copy link
Owner

cedvdb commented Oct 18, 2021

Those are both somewhat already there

The controller given to TextField is not the same as the controller given to the PhoneFormField. That's because the value of the controller is a PhoneNumber and not text (there is the country code as well as national phone number).

It would not make sens to give access to the underlying TextField controller.

As for the focusNode I added the possibility to override the one set by the lib.

Just to be clear:

    return TextField(
      focusNode: _focusNode,  // this can be overriden
      controller: _nationalNumberController, // this cannot

@vasilich6107
Copy link
Author

vasilich6107 commented Oct 18, 2021

Here is an example of possible issue if we will not expose controller
joanpablo/reactive_forms#210

@vasilich6107
Copy link
Author

vasilich6107 commented Oct 18, 2021

You can refer to this package history when you are thinking about properties exposure
https://pub.dev/packages/dropdown_search

10-20% of bugfixes was related to proper properties exposure)))
The next day your package become famous you'll be constantly getting those issues Please expose this, Please expose that)))

@cedvdb
Copy link
Owner

cedvdb commented Oct 18, 2021

I'm making some modification so the text is selectable from the main controller.

In flutter selecting the text does not mean that the text will have focus (You can't necessarily edit it). Is the expected behavior to have focus on the field automatically after selection, or to manually have to call focusNode.requestFocus() ?

@cedvdb
Copy link
Owner

cedvdb commented Oct 18, 2021

It is now published on 4.3.0.

You can now select from the main controller https://cedvdb.github.io/phone_form_field/#/

(there is a selection button at the bottom of the demo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants