@@ -3,17 +3,17 @@ import 'package:flutter/material.dart';
33typedef QueryListItemBuilder <T > = Widget Function (T item);
44typedef OnItemSelected <T > = void Function (T item);
55typedef SelectedItemBuilder <T > = Widget Function (
6- T item,
7- VoidCallback deleteSelectedItem,
8- );
6+ T item,
7+ VoidCallback deleteSelectedItem,
8+ );
99typedef QueryBuilder <T > = List <T > Function (
10- String query,
11- List <T > list,
12- );
10+ String query,
11+ List <T > list,
12+ );
1313typedef TextFieldBuilder = Widget Function (
14- TextEditingController controller,
15- FocusNode focus,
16- );
14+ TextEditingController controller,
15+ FocusNode focus,
16+ );
1717
1818class GFSearchBar <T > extends StatefulWidget {
1919 const GFSearchBar ({
@@ -142,34 +142,34 @@ class MySingleChoiceSearchState<T> extends State<GFSearchBar<T>> {
142142 textField = widget.textFieldBuilder != null
143143 ? widget.textFieldBuilder (_controller, _focusNode)
144144 : Padding (
145- padding: const EdgeInsets .symmetric (vertical: 8 , horizontal: 16 ),
146- child: TextField (
147- controller: _controller,
148- focusNode: _focusNode,
149- style: TextStyle (fontSize: 16 , color: Colors .grey[600 ]),
150- decoration: InputDecoration (
151- enabledBorder: const OutlineInputBorder (
152- borderSide: BorderSide (
153- color: Color (0x4437474F ),
154- ),
155- ),
156- focusedBorder: OutlineInputBorder (
157- borderSide: BorderSide (
158- color: Theme .of (context).primaryColor,
145+ padding: const EdgeInsets .symmetric (vertical: 8 , horizontal: 16 ),
146+ child: TextField (
147+ controller: _controller,
148+ focusNode: _focusNode,
149+ style: TextStyle (fontSize: 16 , color: Colors .grey[600 ]),
150+ decoration: InputDecoration (
151+ enabledBorder: const OutlineInputBorder (
152+ borderSide: BorderSide (
153+ color: Color (0x4437474F ),
154+ ),
155+ ),
156+ focusedBorder: OutlineInputBorder (
157+ borderSide: BorderSide (
158+ color: Theme .of (context).primaryColor,
159+ ),
160+ ),
161+ suffixIcon: Icon (Icons .search),
162+ border: InputBorder .none,
163+ hintText: "Search here..." ,
164+ contentPadding: const EdgeInsets .only (
165+ left: 16 ,
166+ right: 20 ,
167+ top: 14 ,
168+ bottom: 14 ,
169+ ),
170+ ),
159171 ),
160- ),
161- suffixIcon: Icon (Icons .search),
162- border: InputBorder .none,
163- hintText: "Search here..." ,
164- contentPadding: const EdgeInsets .only (
165- left: 16 ,
166- right: 20 ,
167- top: 14 ,
168- bottom: 14 ,
169- ),
170- ),
171- ),
172- );
172+ );
173173
174174 final column = Column (
175175 mainAxisSize: MainAxisSize .min,
@@ -259,29 +259,30 @@ class MySingleChoiceSearchState<T> extends State<GFSearchBar<T>> {
259259 ),
260260 child: _tempList.isNotEmpty
261261 ? Scrollbar (
262- child: ListView .separated (
263- padding: const EdgeInsets .symmetric (vertical: 4 ),
264- separatorBuilder: (context, index) => const Divider (
265- height: 1 ,
266- ),
267- itemBuilder: (context, index) => Material (
268- color: Colors .transparent,
269- child: InkWell (
270- onTap: () => onDropDownItemTap (_tempList[index]),
271- child: widget.popupListItemBuilder (
272- _tempList.elementAt (index),
262+ child: ListView .separated (
263+ padding: const EdgeInsets .symmetric (vertical: 4 ),
264+ separatorBuilder: (context, index) => const Divider (
265+ height: 1 ,
266+ ),
267+ itemBuilder: (context, index) => Material (
268+ color: Colors .transparent,
269+ child: InkWell (
270+ onTap: () => onDropDownItemTap (_tempList[index]),
271+ child: widget.popupListItemBuilder (
272+ _tempList.elementAt (index),
273+ ),
274+ ),
275+ ),
276+ itemCount: _tempList.length,
273277 ),
274- ),
275- ),
276- itemCount: _tempList.length,
277- ),
278- )
278+ )
279279 : widget.noItemsFoundWidget != null
280- ? Center (
281- child: widget.noItemsFoundWidget,
282- ) : Container (
283- child: Text ("no items found" ),
284- ),
280+ ? Center (
281+ child: widget.noItemsFoundWidget,
282+ )
283+ : Container (
284+ child: Text ("no items found" ),
285+ ),
285286 ),
286287 ),
287288 ),
0 commit comments