I'am working on a flutter application where the user clicks on register button and if input has errors i don't wanna show the errors below the TextFormField, i've managed to create a form with a GlobalKey and added validator and it's working fine but i'm looking to show errors at the end of page not under TextFormField, any ideas how to do that ?
Thanks in advance
you can use visible widget to show your error text on error with a bool val to
validate your textfields.
Related
I am developing flutter calculator app
And when I am getting numbers from textfields just I want to show snackbar if the one of the textfield is empty or
If both of them are empty after clicking a button if they are not empty I am showing the sum result and in this case I don't have any problem
And to be more specific I am adding a picture of my simple app
I tried showsnakbarmassenger.of(context).showsnackbare and other codes after reading documentation and watching videos in YouTube but I got error no scaffold messenger widget found.
Those are deprecated APIs, currently you can show a snackBar with this:
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("example text")));
guys.
I'm having some trouble with TextFormFields on my app.
I've got Login screen with Form widget, that works pretty fine, i can put login and password and then do the login.
But after login every TextFormfFeld that i tap to write some words the keyboard appears and then the app crashes and moves back to HomeScreen.
each Form widget has its own Global Key, I don't know why this behavior is occurring.
Things that I've tried:
create a static GlobalKey, but when I do this an error is displayed saying that I'm using a unique global key in too many widgets.
Hi I am running into an issue where I am unable to save the state of the DropdownButton (the text shown in the Dropdown Button itself, which is the value that I have selected). I am using GetX for state navigation.
Due to the way my code has been structured, when I navigate from one screen to a second one, and wish to navigate back, I am utilising Get.to(First() instead of Get.back().
Here is my logic:
I will save the value the user has selected from the DropdownButton into SharedPreferences. This value will also be immediately shown to the user on the button itself due to the nature of the button.
When user navigates away (e.g. he is now on the second screen), and visits first screen again, I will load the selected value from SharedPreferences and construct the DropdownButton item such that this value will be shown at the top.
The issue I am facing:
Retrieving data from SharedPreferences is asynchronous, so I don't know how to construct the FirstScreen again while I am waiting for data to be retrieved from SharedPreferences. Could anyone help me out? Thank you!
Use GetStorage() instead of shared-preference . No Async issue
dependencies:
get_storage: ^2.0.3
use GetStorage through an instance or use directly GetStorage().read('key')
final box = GetStorage();
To write information you must use write :
box.write('quote', 'GetX is the best');
To read values you use read:
print(box.read('quote'));
// out: GetX is the best
I'm currently developing a flutter app on windows desktop and I want to make a navigation child in the same scaffold, i'm tried with PageTransitionSwitcher from animations package, but i'm get failed, how could do this?. thanks
This is an example
This is another example
You can do this by passing a widget to scaffold on a particular button press, Suppose you want to show Sign in and Sign Up in the same Scaffold their must be two buttons one with the name of Signin and one with the name of sign up so what you can do you can pass SIGNIN Widget on Signin Press while you can passs SignUp Widget on Signup Button Press in the same scaffold That's all.
I know there is DropDown Button but how dropdown button work is it show content in popup style and i want to implement autocomplete textfield and want to interact with textfield while suggestion come under textfield.
There is a package available for this that you can use and it works very nicely.
You can also fetch the suggestions list from API.
Here is the link
https://github.com/jebright/flutter_typeahead_plugin