File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ class HomeController extends GetxController {
6161 late RxBool serverCertExists;
6262 final Rx <SupportedLanguage > selectedLanguage = SupportedLanguage .english.obs;
6363 final ScrollController scrollController = ScrollController ();
64+ final FocusNode searchFocusNode = FocusNode ();
6465 final RxBool showbtn = false .obs;
6566 late TaskDatabase taskdb;
6667 var tasks = < TaskForC > [].obs;
@@ -480,6 +481,11 @@ class HomeController extends GetxController {
480481
481482 void toggleSearch () {
482483 searchVisible.value = ! searchVisible.value;
484+ if (searchVisible.value) {
485+ Future .delayed (const Duration (milliseconds: 300 ), () {
486+ searchFocusNode.requestFocus ();
487+ });
488+ }
483489 if (! searchVisible.value) {
484490 searchedTasks.assignAll (queriedTasks);
485491 searchController.text = '' ;
@@ -874,4 +880,9 @@ class HomeController extends GetxController {
874880 // forReplica: taskReplica.value));
875881 // Get.dialog(showDialog);
876882 // }
883+ @override
884+ void onClose () {
885+ searchFocusNode.dispose ();
886+ super .onClose ();
887+ }
877888}
Original file line number Diff line number Diff line change @@ -43,9 +43,13 @@ class HomePageBody extends StatelessWidget {
4343 (tColors.primaryBackgroundColor! )),
4444 controller: controller.searchController,
4545 // shape:,
46+ focusNode: controller.searchFocusNode,
4647 onChanged: (value) {
4748 controller.search (value);
4849 },
50+ onTapOutside: (event) {
51+ controller.searchFocusNode.unfocus ();
52+ },
4953
5054 shape: WidgetStateProperty .resolveWith <OutlinedBorder ?>(
5155 (Set <WidgetState > states) {
You can’t perform that action at this time.
0 commit comments