From 7a9adf8f06d7db7004aec6df4834d096d32eb08c Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Tue, 18 Jul 2023 11:28:35 +0530 Subject: [PATCH] fixed search bug --- lib/pages/search/search_page.dart | 76 +++++++++++++++++++------------ pubspec.yaml | 2 +- 2 files changed, 48 insertions(+), 30 deletions(-) diff --git a/lib/pages/search/search_page.dart b/lib/pages/search/search_page.dart index d404527..44925e6 100644 --- a/lib/pages/search/search_page.dart +++ b/lib/pages/search/search_page.dart @@ -35,40 +35,58 @@ class SearchPage extends StatelessWidget { backgroundColor: Colors.white, leading: IconButton( onPressed:(){ - Navigator.pop(context); + Get.back(); }, - icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)), - title: TypeAheadField( - textFieldConfiguration: TextFieldConfiguration( - autofocus: true, - ), - suggestionsCallback: (pattern) async{ - return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern)); - //return await - }, - itemBuilder: (context, GeoJsonFeature suggestion){ - return ListTile( - title: Text(suggestion.properties!["location_name"]), - subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""), - //leading: getImage(index), - ); - }, - onSuggestionSelected: (GeoJsonFeature suggestion){ - indexController.currentFeature.clear(); - indexController.currentFeature.add(suggestion); - Get.back(); - showModalBottomSheet( - isScrollControlled: true, - context: context, - //builder: (context) => BottomSheetWidget(), - builder:((context) => BottomSheetNew()) - ); - }, + icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,) ), + centerTitle: true, //title: const CupertinoSearchTextField(), ), - //body: + body: SingleChildScrollView( + child: TypeAheadField( + textFieldConfiguration: TextFieldConfiguration( + autofocus: true, + style: DefaultTextStyle.of(context).style.copyWith( + fontStyle: FontStyle.normal, + fontSize: 15.0, + ), + decoration: InputDecoration( + border: OutlineInputBorder(), + hintText: "検索", + prefixIcon: Icon(Icons.search), + suffixIcon: IconButton( + icon: Icon(Icons.clear), + onPressed: () { + // clear the text field + }, + ), + ), + ), + suggestionsCallback: (pattern) async{ + return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern)); + //return await + }, + itemBuilder: (context, GeoJsonFeature suggestion){ + return ListTile( + title: Text(suggestion.properties!["location_name"]), + subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""), + //leading: getImage(index), + ); + }, + onSuggestionSelected: (GeoJsonFeature suggestion){ + indexController.currentFeature.clear(); + indexController.currentFeature.add(suggestion); + Get.back(); + showModalBottomSheet( + isScrollControlled: true, + context: context, + //builder: (context) => BottomSheetWidget(), + builder:((context) => BottomSheetNew()) + ); + }, + ), + ), // Obx(() => // ListView.builder( // itemCount: searchController.searchResults.length, diff --git a/pubspec.yaml b/pubspec.yaml index 4fa69e3..a95e0d2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.12+12 +version: 1.0.13+13 environment: sdk: ">=2.16.0 <3.0.0"