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
ClampAndUpdate inconsitent while editing. #26
Comments
Initial simple fix might be to move the calls to In other words, the TextFormField that gets created by the widget always has an |
Sure, I will change it accordingly. I am thinking of a fix combining #27 #26 together by removing the regular expression check and only validate by parsing. I am checking in some changes in v0.6.8 branch. Its completely buggy. But you can see where I am going with it. Maybe Validating onChanged is an overkill. I will test it further and see if its unnecessary. I will work on this tomorrow and possibly on Monday. Got to get some sleep today. 😄 😴 |
@abulka I have merged a fix into v0.6.8 branch. If you could give it a test in the context of onSubmitted it would be great. Now clamping doesn't happen by default. So you need to pass this boolean flag New Changes
|
Thanks for this work - a few observations:
Also, nice to see the cleanup of attribute duplicates in the code! May I suggest that |
Thanks a lot for you feedback. 😃
Thank you and valid point. Also I see another issue with this. If the field is supposed to be optional and user tries to clear the field, it would disallow user to submit the form. Thanks for pointing it out. I will work out a way to remove this validation. Empty should be handle by other features like mandatory or optional. The user can handle it I suppose.
For a minus sign a validation on
Ideally provided onSubmitted should not be called with validation errors. I will check why this is not the case. This sounds like a bug. I have exposed a flag for this purpose to enable or disable clamping. I felt it was out of users control to clamp it and return when it is out of bounds. My line of thoughts.. Showing an error for min and max bounds and then clamping while
Do you have a better use case for the default clamping to be enforced?
Thanks to you for pointing it out. 😉 I am actually thinking of a refactoring where I split the files. I will definitely consider this. 👍 One thing I noticed with that clean up is that since all the fields are optional, I had to ensure that I properly pass down all the attributes in the super call. Most of the tests failed until I fixed them. I am not sure if there is a way to ensure that maybe some linter rules, will check it though. For now I will keep it like this. No more double declaration, yay. 🥳 PS: I really hope I didn't offend you by moving around the code you submitted as PR 😟. If yes please do let me know, We can discuss it out. I am new to open source collaboration. |
Thanks for your thoughts. Here are some more of mine! Re clamping, if you introduce a flag I'd want it to be on by default as clamping is a good thing. If you can't enter in values outside the min max range using the up/down arrows, then you shouldn't be able to do it via direct text entry either. If you enter in Here is an example of how I am using this widget in my first flutter app: In my case all the values depend on each other and I never want the user to type in anything crazy - or the app breaks. Yes there are nuances where a developer may want more control in which case they can switch the auto clamping off and deal with everything manually with explicit code. Presumably the onSubmit would be called with the bad value - and the developer can deal with that. This would need to be documented. |
This makes sense that the form should not allow values exceeding the min/max bounds even accidentally. One of the reasons we have min/max bound by itself is to keep the values within the bounds. I am convinced and I stand corrected. I will change the default value to enable clamping always. Thanks a lot for the valuable feedback. I was a bit worried it would look like the widget is opinionated but in reality this is very good safety mechanism, especially in case of dependent fields. I will change this and perhaps make all the fixes part of 0.7.0 and prepone it to mid of September, instead of 0.6.8 as I intended initially.
Sure 👍 |
As @abulka noted in the comments of another discusssion.
This needs to be addressed for all the manual edits.
Initial Thoughts: Exposing all form of callbacks in TextFormField and handling clamping could fix this issue.
The text was updated successfully, but these errors were encountered: