maheshj01 / searchfield

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.
MIT License
84 stars 63 forks source link

Suggestions Elevation same like dropdown button #110

Closed WaseemAbbasi22 closed 8 months ago

WaseemAbbasi22 commented 9 months ago

Thanks for such awesome package i just want a small improvement with the suggestion decoration i want elevation same like normal dropdown buttons options has cool elevation you have the suggestionDecoration with boxshow property but it's not working properly if color is same with the screen background and also hide the suggestion when user scroll on the other part of screen or disable the scroll when suggestions are showing same like dropdown buttons

Describe the solution you'd like The most simple solution is to wrap the suggestions containers with Material and add elevation property and add a parameter of suggestionElevation to make it dynamic any one can set it according to the requirements

Describe alternatives you've considered alternate solution would be adding a card instead of container

Additional context

Screenshot 2024-02-15 at 11 33 52 AM

i want this to look like this

WaseemAbbasi22 commented 9 months ago
 final Widget listView = Material(
            elevation:widget.suggestionsDecoration?.elevation?? 8,
            borderRadius: widget.suggestionsDecoration?.borderRadius ??
                BorderRadius.zero,
            child: ListView.builder(
              reverse: _suggestionDirection == SuggestionDirection.up,
              padding: EdgeInsets.zero,
              controller: _scrollController,
              itemCount: snapshot.data!.length, wrap listview with material  and also need to remove  "ClipRRect" 
return Positioned(
              left: offset.dx,
              width: textFieldsize.width,
              child: CompositedTransformFollower(
                  offset: widget.offset ?? yOffset,
                  link: _layerLink,
                  child: ClipRRect(
                    borderRadius: widget.suggestionsDecoration?.borderRadius ??
                        BorderRadius.zero,
                    child: Material(
                      child: _suggestionsBuilder(),
                    ),
                  )),
            );
//replace with this 
  return Positioned(
              left: offset.dx,
              width: textFieldsize.width,
              child: CompositedTransformFollower(
                  offset: widget.offset ?? yOffset,
                  link: _layerLink,
                  child: _suggestionsBuilder()),
            ); 

add elevation parameter to the suggestion decoration

WaseemAbbasi22 commented 9 months ago

this will fix the issue

maheshj01 commented 9 months ago

Hi @WaseemAbbasi22, Thanks for filing the issue, elevation is required I will get this out ASAP.

maheshj01 commented 9 months ago

Bumping down the priority of this doesn't look straightforward to me. Also, this is not really a show-stopper so the package should work as intended. I'll come back to this issue soon.

maheshj01 commented 8 months ago

released in v0.9.8. Thank you for your contribution!