clear textfield after submit

This commit is contained in:
Moe Poi ~ 2022-05-16 21:03:50 +07:00
parent 6393d1a053
commit 2d3de88fc6
2 changed files with 2 additions and 2 deletions

View file

@ -84,6 +84,7 @@ class _NewsletterState extends State<Newsletter> {
onPressed: () { onPressed: () {
if (emailController.text.isNotEmpty) { if (emailController.text.isNotEmpty) {
subscribe(emailController.text).then((status) { subscribe(emailController.text).then((status) {
emailController.clear();
if (status == 200) { if (status == 200) {
return showDialog( return showDialog(
context: context, context: context,
@ -112,8 +113,6 @@ class _NewsletterState extends State<Newsletter> {
); );
} }
); );
} else {
} }
}); });
} }

View file

@ -58,6 +58,7 @@ class _SearchFormState extends State<SearchForm> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
SearchPage(query: searchController.text))); SearchPage(query: searchController.text)));
searchController.clear();
}, },
child: const Text('Search'), child: const Text('Search'),
), ),