Skip to content

Commit a512610

Browse files
committed
gfsearchbar position fixed
1 parent 1ca8668 commit a512610

File tree

2 files changed

+43
-42
lines changed

2 files changed

+43
-42
lines changed

example/lib/main.dart

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -215,38 +215,7 @@ class _MyHomePageState extends State<MyHomePage>
215215
mainAxisAlignment: MainAxisAlignment.center,
216216
crossAxisAlignment: CrossAxisAlignment.center,
217217
children: <Widget>[
218-
GFSearchBar(
219-
// searchBoxInputDecoration: InputDecoration(
220-
// enabledBorder: OutlineInputBorder(
221-
// borderSide: BorderSide(
222-
// color: Colors.teal,
223-
// ),
224-
// borderRadius: BorderRadius.circular(50)
225-
// ),
226-
// ),
227-
searchList: list,
228-
// hideSearchBoxWhenItemSelected: false,
229-
// overlaySearchListHeight: 100.0,
230-
searchQueryBuilder: (query, list) => list
231-
.where((item) =>
232-
item.toLowerCase().contains(query.toLowerCase()))
233-
.toList(),
234-
overlaySearchListItemBuilder: (item) => Container(
235-
padding: const EdgeInsets.all(8),
236-
child: Text(
237-
item,
238-
style: const TextStyle(fontSize: 18),
239-
),
240-
),
241-
// noItemsFoundWidget: Container(
242-
// color: Colors.green,
243-
// child: Text("no items found..."),
244-
// ),
245-
onItemSelected: (item) {
246-
setState(() {
247-
print('ssssssss $item');
248-
});
249-
}),
218+
250219

251220
GFRating(
252221
value: _rating,
@@ -315,6 +284,39 @@ class _MyHomePageState extends State<MyHomePage>
315284
),
316285
),
317286

287+
GFSearchBar(
288+
// searchBoxInputDecoration: InputDecoration(
289+
// enabledBorder: OutlineInputBorder(
290+
// borderSide: BorderSide(
291+
// color: Colors.teal,
292+
// ),
293+
// borderRadius: BorderRadius.circular(50)
294+
// ),
295+
// ),
296+
searchList: list,
297+
// hideSearchBoxWhenItemSelected: false,
298+
// overlaySearchListHeight: 100.0,
299+
searchQueryBuilder: (query, list) => list
300+
.where((item) =>
301+
item.toLowerCase().contains(query.toLowerCase()))
302+
.toList(),
303+
overlaySearchListItemBuilder: (item) => Container(
304+
padding: const EdgeInsets.all(8),
305+
child: Text(
306+
item,
307+
style: const TextStyle(fontSize: 18),
308+
),
309+
),
310+
// noItemsFoundWidget: Container(
311+
// color: Colors.green,
312+
// child: Text("no items found..."),
313+
// ),
314+
onItemSelected: (item) {
315+
setState(() {
316+
print('ssssssss $item');
317+
});
318+
}),
319+
318320
// GFCard(
319321
// content: Column(
320322
// children: <Widget>[
@@ -585,11 +587,13 @@ class _MyHomePageState extends State<MyHomePage>
585587
// )
586588
// ),
587589

588-
// GFButton(
589-
// onPressed: (){},
590-
// text: "whatsapp",
591-
// icon: Icon(Icons.directions_bike),
592-
// ),
590+
GFButton(
591+
type: GFButtonType.transparent,
592+
color: GFColor.warning,
593+
onPressed: (){},
594+
text: 'whatsapp',
595+
icon: Icon(Icons.directions_bike),
596+
),
593597
//
594598
// GFButton(
595599
// text: "linkedin",

lib/components/search_bar/gf_search_bar.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,8 @@ class MySingleChoiceSearchState<T> extends State<GFSearchBar<T>> {
235235
left: position.left,
236236
width: width,
237237
child: CompositedTransformFollower(
238-
offset: Offset(
239-
0,
240-
height - position.bottom < overlaySearchListHeight
241-
? (textBoxHeight + 6.0)
242-
: -(overlaySearchListHeight - 8.0),
238+
offset: const Offset(
239+
0, 56,
243240
),
244241
showWhenUnlinked: false,
245242
link: _layerLink,

0 commit comments

Comments
 (0)