diff --git a/CHANGELOG.md b/CHANGELOG.md index 59a1f23..1ed9125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +#### [1.1.7] - October 22, 2024 +- Refactor: Overlay condition too strict [Issue: 182](https://github.com/maheshj01/searchfield/issues/182) + +#### [1.1.6] - September 25, 2024 +- Fix: new properties were missing in CopyWith Constructor [Issue: 177 comment](https://github.com/maheshj01/searchfield/issues/177#issuecomment-2376401417) + #### [1.1.5] - September 25, 2024 - remove custom assertions for `SearchInputDecoration` properties diff --git a/README.md b/README.md index 4eafd52..3c36af4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [searchfield: ^1.1.5](https://pub.dev/packages/searchfield) +# [searchfield: ^1.1.7](https://pub.dev/packages/searchfield) Flutter Platform Badge Pub diff --git a/lib/src/input_decoration.dart b/lib/src/input_decoration.dart index d78cca1..6f148dd 100644 --- a/lib/src/input_decoration.dart +++ b/lib/src/input_decoration.dart @@ -123,7 +123,7 @@ class SearchInputDecoration extends InputDecoration { super.errorStyle, super.suffixIconConstraints, }); - + @override SearchInputDecoration copyWith({ Key? key, @@ -191,6 +191,20 @@ class SearchInputDecoration extends InputDecoration { String? suffixText, }) { return SearchInputDecoration( + cursorColor: cursorColor ?? this.cursorColor, + textCapitalization: textCapitalization ?? this.textCapitalization, + searchStyle: searchStyle ?? this.searchStyle, + prefixIconConstraints: + prefixIconConstraints ?? this.prefixIconConstraints, + suffixIconConstraints: + suffixIconConstraints ?? this.suffixIconConstraints, + hintMaxLines: hintMaxLines ?? this.hintMaxLines, + floatingLabelStyle: floatingLabelStyle ?? this.floatingLabelStyle, + errorText: errorText ?? this.errorText, + error: error ?? this.error, + hintTextDirection: hintTextDirection ?? this.hintTextDirection, + hintFadeDuration: hintFadeDuration ?? this.hintFadeDuration, + helper: helper ?? this.helper, cursorErrorColor: cursorErrorColor ?? this.cursorErrorColor, cursorHeight: cursorHeight ?? this.cursorHeight, cursorWidth: cursorWidth ?? this.cursorWidth, diff --git a/lib/src/searchfield.dart b/lib/src/searchfield.dart index 4128de4..5caa5f9 100644 --- a/lib/src/searchfield.dart +++ b/lib/src/searchfield.dart @@ -444,7 +444,7 @@ class _SearchFieldState extends State> { // When focus shifts to ListView prevent suggestions from rebuilding // when user navigates through suggestions using keyboard if (_searchFocus!.hasFocus) { - _overlayEntry ??= _createOverlay(); + _overlayEntry = _createOverlay(); if (widget.suggestionState == Suggestion.expand) { isSuggestionsShown = true; Future.delayed(Duration(milliseconds: 100), () { @@ -866,15 +866,17 @@ class _SearchFieldState extends State> { return null; } + Widget? _streamBuilder; OverlayEntry _createOverlay() { return OverlayEntry(builder: (context) { + if (_streamBuilder != null) return _streamBuilder!; final textFieldRenderBox = key.currentContext!.findRenderObject() as RenderBox; final textFieldsize = textFieldRenderBox.size; final offset = textFieldRenderBox.localToGlobal(Offset.zero); var yOffset = Offset.zero; _totalHeight = widget.maxSuggestionsInViewPort * widget.itemHeight; - return StreamBuilder?>( + _streamBuilder = StreamBuilder?>( stream: suggestionStream.stream, builder: (BuildContext context, AsyncSnapshot?> snapshot) { @@ -900,6 +902,7 @@ class _SearchFieldState extends State> { ), ); }); + return _streamBuilder!; }); } diff --git a/pubspec.yaml b/pubspec.yaml index 26f9e1c..28b3918 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: searchfield description: A highly customizable, simple and easy to use flutter Widget to add a searchfield to your Flutter Application. This Widget allows you to search and select from list of suggestions. -version: 1.1.5 +version: 1.1.7 homepage: https://github.com/maheshj01/searchfield repository: https://github.com/maheshj01/searchfield issue_tracker: https://github.com/maheshj01/searchfield/issues