@@ -229,72 +229,71 @@ class MySingleChoiceSearchState<T> extends State<GFSearchBar<T>> {
229229 Offset .zero & overlay.size,
230230 );
231231 overlaySearchList = OverlayEntry (
232- builder: (context) {
233- final height = MediaQuery .of (context).size.height;
234- return Positioned (
235- left: position.left,
236- width: width,
237- child: CompositedTransformFollower (
238- offset: const Offset (
239- 0 , 56 ,
240- ),
241- showWhenUnlinked: false ,
242- link: _layerLink,
243- child: GFCard (
244- color: Colors .white,
245- elevation: 5 ,
246- shape: const RoundedRectangleBorder (
247- borderRadius: BorderRadius .all (Radius .circular (4 )),
248- ),
249- content: _searchList.isNotEmpty
250- ? Column (
251- mainAxisAlignment: MainAxisAlignment .end,
252- crossAxisAlignment: CrossAxisAlignment .end,
253- children: < Widget > [
254- InkWell (
255- child: Icon (
256- Icons .close,
257- size: 22 ,
258- ),
259- onTap: onCloseOverlaySearchList,
260- ),
261- Container (
262- height: overlaySearchListHeight,
263- child: Scrollbar (
264- child: ListView .separated (
265- padding: const EdgeInsets .symmetric (vertical: 4 ),
266- separatorBuilder: (context, index) =>
267- const Divider (
268- height: 1 ,
232+ builder: (context) => Positioned (
233+ left: position.left,
234+ width: width,
235+ child: CompositedTransformFollower (
236+ offset: const Offset (
237+ 0 ,
238+ 56 ,
239+ ),
240+ showWhenUnlinked: false ,
241+ link: _layerLink,
242+ child: GFCard (
243+ color: Colors .white,
244+ elevation: 5 ,
245+ shape: const RoundedRectangleBorder (
246+ borderRadius: BorderRadius .all (Radius .circular (4 )),
247+ ),
248+ content: _searchList.isNotEmpty
249+ ? Column (
250+ mainAxisAlignment: MainAxisAlignment .end,
251+ crossAxisAlignment: CrossAxisAlignment .end,
252+ children: < Widget > [
253+ InkWell (
254+ child: Icon (
255+ Icons .close,
256+ size: 22 ,
269257 ),
270- itemBuilder: (context, index) => Material (
271- color: Colors .transparent,
272- child: InkWell (
273- onTap: () => onSearchListItemSelected (
274- _searchList[index]),
275- child: widget.overlaySearchListItemBuilder (
276- _searchList.elementAt (index),
258+ onTap: onCloseOverlaySearchList,
259+ ),
260+ Container (
261+ height: overlaySearchListHeight,
262+ child: Scrollbar (
263+ child: ListView .separated (
264+ padding:
265+ const EdgeInsets .symmetric (vertical: 4 ),
266+ separatorBuilder: (context, index) =>
267+ const Divider (
268+ height: 1 ,
269+ ),
270+ itemBuilder: (context, index) => Material (
271+ color: Colors .transparent,
272+ child: InkWell (
273+ onTap: () => onSearchListItemSelected (
274+ _searchList[index]),
275+ child:
276+ widget.overlaySearchListItemBuilder (
277+ _searchList.elementAt (index),
278+ ),
279+ ),
277280 ),
281+ itemCount: _searchList.length,
278282 ),
279283 ),
280- itemCount: _searchList.length,
281284 ),
282- ),
283- ),
284- ],
285- )
286- : widget.noItemsFoundWidget != null
287- ? Center (
288- child: widget.noItemsFoundWidget,
285+ ],
289286 )
290- : Container (
291- child: const Text ('no items found' ),
292- ),
293- ),
294- ),
295- );
296- },
297- );
287+ : widget.noItemsFoundWidget != null
288+ ? Center (
289+ child: widget.noItemsFoundWidget,
290+ )
291+ : Container (
292+ child: const Text ('no items found' ),
293+ ),
294+ ),
295+ ),
296+ ));
298297 Overlay .of (context).insert (overlaySearchList);
299298 }
300299}
0 commit comments