From 2d3de88fc67bf36b97c3fd11fb33bf788b44caf3 Mon Sep 17 00:00:00 2001 From: Moe Date: Mon, 16 May 2022 21:03:50 +0700 Subject: [PATCH] clear textfield after submit --- lib/components/newsletter.dart | 3 +-- lib/components/search_form.dart | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/components/newsletter.dart b/lib/components/newsletter.dart index b517927..fc85581 100644 --- a/lib/components/newsletter.dart +++ b/lib/components/newsletter.dart @@ -84,6 +84,7 @@ class _NewsletterState extends State { onPressed: () { if (emailController.text.isNotEmpty) { subscribe(emailController.text).then((status) { + emailController.clear(); if (status == 200) { return showDialog( context: context, @@ -112,8 +113,6 @@ class _NewsletterState extends State { ); } ); - } else { - } }); } diff --git a/lib/components/search_form.dart b/lib/components/search_form.dart index 68ef637..6ba2ebe 100644 --- a/lib/components/search_form.dart +++ b/lib/components/search_form.dart @@ -58,6 +58,7 @@ class _SearchFormState extends State { MaterialPageRoute( builder: (context) => SearchPage(query: searchController.text))); + searchController.clear(); }, child: const Text('Search'), ),