Flutter TextFormField built in validators? - flutter

Are there no built in validators for common use cases such as emails, phone numbers, etc. in the Flutter framework?
The web is littered with examples of people implementing their own email validating functions in Dart, but I'm surprised that there doesn't seem to be any built in ones in Flutter, like a FormFieldValidator.email, etc. Or did I just not find it?

If you find that some sort of functionality is missing from Flutter out of the box, chances are that someone has created a package for Flutter (or you can). Just check the pub.dev website and filter by Flutter.
I've had a look and there is a package called 'flutter_form_builder' https://pub.dev/packages/flutter_form_builder
This package helps in generation of forms in Flutter by providing the
syntactic sugar for creating a Form Widget and reduce the boilerplate
needed to build a form, validate fields, react to changes, and collect
the value of the Form in the form of a map.
....
FormBuilderTextField - For text input. Allows input of single-line
text, multi-line text, password, email, urls etc by using different
configurations and validators

Related

How to refence widgets in flutter_test when they have no defining attributes?

Fairly new at mobile automation (working as automation QA with no mobile development experience), and I am having trouble with finding and interacting with specific elements. Coming from Web and Selenium, I thought that it would be fairly easy to reference elements based on their parents and other defining features such as classes, id's, or simply order of appearance etc.
What I found while trying my hand at mobile automation is that the UI elements were not written by our developers to have any identifiers (issue has been raised to project management). At any time during use of the app during integration testing, there could be multiple Widgets that are of the same type; see below:
There are 4 TextFormField inside Form with no other distinct attributes other than Text: "*" (added as an InputDecoration in the .dart as I've seen it).
Until this particular screen, I have only ever dealt with elements that return exactly one match when using find.widgetWithText(TextFormField, "*")
How does one go about with interacting with the first until last field without any changes to the application and how the elements are named/identified?
You can define a unique key for each one, and then find using Find a widget with key

Will getx automatically convert my string to the languages it supports

I wanted to enable internationalization in my app. I am already using getx so i am going to use it to enable internationalization. However i had a confusion, in the getx page, there are these many languages that it supports. I was wondering if i would have to give a Translations class with the strings i want to only convert to these languages or would getx automatically do it for me. In other words, would i have to provide strings for these languages too, or will my text automatically be translated to these languages by getx
These languages are available for Getx readme file and if you click on them you will see a readme in that language,
You must provide the translated strings to Getx material app.
You can use google translate, Excel, or this VS Code extension to translate strings automatically

Flutter text widgets to use

Need help to understand if Flutter can help us.
We are looking at flutter for app development for a rewrite of a js electron for desktop and js webview for mobiles.
It is basically a sophisticated reading app with multiple dictionaries and searching algorithms and other features specific to an Asian language and also English parallel translations.
We want to display Religious books in the native Unicode language with extensive dictionary support.
The books will have some bold and heading text markup (the markup style can be any format but we currently use html styles).
The books will be in a sqlite DB and streamed to the user.
The books will be stored in the db by paragraph.. We need to display this in a built up flow to the user.
The books will have some items which can be displayed or hidden upon user request but we can regenerate the display if needed. (currently it does live through js).
The books will need to communicate if a tap() or Textselect() event has been called (we often tap to select a word and it goes to a custom dictionary).
Searching for strings in the book will be done by paragraph and then we need to 1) highlight the text and bring the user to that text.
We wish to implement infinite scroll or "Lazy load" as the books are very big and often text processing to change the native script font is involved before display.
Conclusion
I think this captures much of what we want to have.
I have done some work in flutter, but i'm very new to it.
It seems that there is a SelectableText.rich widget and perhaps we could connect them together in an infinite scroll list widget from pub.dev
For hiding the page numbers.. and alt readings, it is fine to reload the book and remove those as we feed the widget with text.
There are a few html widgets, but I'm not sure if it gives select and tap events.
Can Flutter do this for us?
Are there packages that I'm not aware of?
Am I heading in the wrong direction?
I have done a test called https://github.com/bksubhuti/mydbtest
It seems to work.. the selecting of texts are off by a few bits, but it is workable..
However, I have found a full app for my purpose already written in flutter with a sqlite philosophy already working. The dev and myself are in touch and the project has been upgraded to null safety. Flutter is awesome. In about a month.. part time.. I have learned flutter and written my first app and submitted it to the play store called Buddhist Sun. (pending approval). I use sqflite and the multiplatform eq for getting cities.. the db search of cities was more of a flutter tutorial for me than purpose.
https://github.com/bksubhuti/buddhist_sun
Flutter will be the language of the future. I'm so amazed at how great it works and all the packages on pub.dev

Should I use a common prefix for my custom widget in flutter?

I am new to flutter and I had a quick look at the style guide but I didn't find anything about a 'common prefix' for a custom widget.
I come from angular where all the components of a package have a common prefix, so it's easier to choose between a library component and the personalized version (e.g. 'dx-button' and 'app-dx-button' where 'app' is my common prefix). This is because Angular uses a prefix that is defined in the file config of the app and is automatically added to the creation of the new component.
Is there something similar for Flutter?
Should I follow this 'prefix' patter?
I don't think there is something similar in Flutter. My custom widgets are manually tagged like this: PROJECTINITIALS_NAMEOFTHECOMPONENT.
For example, my ExtendedFab is called QFExtendedFab and has all the kinds of features that I reuse throughout the app.

Any wordpress form building plugin for my requirements?

I'm looking for a WP plugin which can allow me to create different forms and embed them on pages and following are the requirements:
Only a single textbox required in each of those forms
The submit button will only be shown if a custom entry/answer is inputted into the textbox. (basically a client-side validation)
The submitted answer should be stored in the back-end with the usermeta (or just the username of the user logged in) so that I can export the entries in a format like csv, etc.
Any thoughts?
P.S. I have found one but not sure if the PRO version of this allows me to have a validation for a custom text. This is the plugin: http://wordpress.org/extend/plugins/visual-form-builder/
Gravity Forms is the most robust form builder plugin for WordPress. You can, with the right knowledge and skills, make it do pretty much anything you'd like. You can find it here: Gravity Forms.
Very well, I've found this. There are actually good plugins however, you will have to purchase it. I'm looking for a free one. http://www.webdesignboom.com/2013/formcraft-wordpress-form-builder/