Skip to content

Commit

Permalink
added on submitted
Browse files Browse the repository at this point in the history
  • Loading branch information
hrajwade96 committed Nov 17, 2023
1 parent 087ad06 commit ef3c4c7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pincode_fetcher/lib/widgets/views/desktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ class DesktopView extends StatelessWidget {
child: Center(
// Added this to center-align the TextField
child: TextField(
onSubmitted: (value) {
_handleOnClick();
},
controller: _searchController,
style: const TextStyle(fontSize: 18),
decoration: InputDecoration(
Expand All @@ -97,11 +100,7 @@ class DesktopView extends StatelessWidget {
iconSize: 20, // Adjust as per requirement
icon: const Icon(Icons.search),
onPressed: () {
store.count = 0;
store.searchQuery = _searchController.text;
if (store.searchQuery.isNotEmpty) {
store.fetchAddress(_searchController.text);
}
_handleOnClick();
},
),
border: OutlineInputBorder(
Expand Down Expand Up @@ -210,4 +209,12 @@ class DesktopView extends StatelessWidget {
),
);
}

void _handleOnClick() {
store.count = 0;
store.searchQuery = _searchController.text;
if (store.searchQuery.isNotEmpty) {
store.fetchAddress(_searchController.text);
}
}
}

0 comments on commit ef3c4c7

Please sign in to comment.