11import 'package:flutter/material.dart' ;
22import 'package:getflutter/getflutter.dart' ;
3- import 'package:getflutter/components/search_bar/gf_search_bar.dart' ;
43
54final List <String > imageList = [
65 "https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg" ,
@@ -61,7 +60,14 @@ class _MyHomePageState extends State<MyHomePage>
6160 Icon actionIcon = new Icon (Icons .search);
6261
6362 List list = [
64- "Flutter" ,"Flutterjjk" ,"Flutterhy" ,"jhFlutter"
63+ "Flutter" ,
64+ "React" ,
65+ "Ionic" ,
66+ "Xamarin" ,
67+ "Flutter2" ,
68+ "React2" ,
69+ "Ionic2" ,
70+ "Xamarin2" ,
6571 ];
6672
6773 @override
@@ -141,15 +147,22 @@ class _MyHomePageState extends State<MyHomePage>
141147// Tab(icon: Icon(Icons.directions_bike)),
142148// ],
143149// ),
144- // searchBar: true,
150+ searchBar: true ,
145151// searchHintText: "aaaaaaa",
146152// searchHintStyle: TextStyle(fontSize: 18.0, color: Colors.redAccent),
147153// searchStyle: TextStyle(fontSize: 10.0, color: Colors.green),
148154// searchBarColorTheme: Colors.greenAccent,
149155
150156 actions: < Widget > [
151- GFIconButton (icon: Icon (Icons .access_time), onPressed: () {}),
152- GFIconButton (icon: Icon (Icons .favorite), onPressed: null ),
157+ // GFIconButton(icon: Icon(Icons.access_time), onPressed: () {}),
158+ GFIconButton (
159+ icon: Icon (
160+ Icons .favorite,
161+ color: Colors .white,
162+ ),
163+ onPressed: () {},
164+ type: GFButtonType .transparent,
165+ ),
153166 ],
154167 ),
155168// backgroundColor: Colors.blueGrey,
@@ -167,66 +180,36 @@ class _MyHomePageState extends State<MyHomePage>
167180 mainAxisAlignment: MainAxisAlignment .center,
168181 crossAxisAlignment: CrossAxisAlignment .center,
169182 children: < Widget > [
170- GFIconButton (
171- icon: Icon (Icons .title),
172- onPressed: null ,
173- // color: GFColor.secondary,
183+ GFSearchBar (
184+ searchList: list,
185+ hideSearchBoxWhenItemSelected: false ,
186+ overlaySearchListHeight: 100.0 ,
187+ searchQueryBuilder: (query, list) {
188+ return list
189+ .where ((item) =>
190+ item.toLowerCase ().contains (query.toLowerCase ()))
191+ .toList ();
192+ },
193+ overlaySearchListItemBuilder: (item) {
194+ return Container (
195+ padding: const EdgeInsets .all (12 ),
196+ child: Text (
197+ item,
198+ style: const TextStyle (fontSize: 18 ),
199+ ),
200+ );
201+ },
202+ noItemsFoundWidget: Container (
203+ color: Colors .green,
204+ child: Text ("no items found" ),
205+ ),
206+ onItemSelected: (item) {
207+ setState (() {
208+ print ('ssssssss $item ' );
209+ });
210+ },
174211 ),
175212
176- // GFSearchBar(
177- // dataList: list,
178- // hideSearchBoxWhenItemSelected: false,
179- // listContainerHeight: MediaQuery.of(context).size.height / 4,
180- // queryBuilder: (query, list) {
181- // return list
182- // .where((item) => item.username
183- // .toLowerCase()
184- // .contains(query.toLowerCase()))
185- // .toList();
186- // },
187- // popupListItemBuilder: (item) {
188- // return item;
189- // },
190- //// selectedItemBuilder: (selectedItem, deleteSelectedItem) {
191- //// return SelectedItemWidget(selectedItem, deleteSelectedItem);
192- //// },
193- // // widget customization
194- // noItemsFoundWidget: Container(child: Text("fgv"),),
195- // textFieldBuilder: (controller, focusNode) {
196- // return Padding(
197- // padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
198- // child: TextField(
199- // controller: controller,
200- // focusNode: focusNode,
201- // style: TextStyle(fontSize: 16, color: Colors.grey[600]),
202- // decoration: InputDecoration(
203- // enabledBorder: const OutlineInputBorder(
204- // borderSide: BorderSide(
205- // color: Color(0x4437474F),
206- // ),
207- // ),
208- // focusedBorder: OutlineInputBorder(
209- // borderSide: BorderSide(color: Theme.of(context).primaryColor),
210- // ),
211- // suffixIcon: Icon(Icons.search),
212- // border: InputBorder.none,
213- // hintText: "Search here...",
214- // contentPadding: const EdgeInsets.only(
215- // left: 16,
216- // right: 20,
217- // top: 14,
218- // bottom: 14,
219- // ),
220- // ),
221- // ));
222- // },
223- // onItemSelected: (item) {
224- // setState(() {
225- //// _selectedItem = item;
226- // });
227- // },
228- // ),
229-
230213// GFCard(
231214// content: Column(
232215// children: <Widget>[
@@ -304,18 +287,17 @@ class _MyHomePageState extends State<MyHomePage>
304287 height: 130.0 ,
305288 width: 105.0 ,
306289 decoration: BoxDecoration (
307- borderRadius: BorderRadius .circular (8.0 ),
308- gradient: LinearGradient (
309- begin: FractionalOffset .bottomLeft,
310- end: FractionalOffset .topRight,
311- colors: [
312- const Color (0x5a0b486b ),
313- const Color (0xFFF56217 ),
314- ]),
290+ borderRadius: BorderRadius .circular (8.0 ),
291+ gradient: LinearGradient (
292+ begin: FractionalOffset .bottomLeft,
293+ end: FractionalOffset .topRight,
294+ colors: [
295+ const Color (0x5a0b486b ),
296+ const Color (0xFFF56217 ),
297+ ]),
315298 ),
316299 ),
317300
318-
319301// GFCard(
320302// content: Column(
321303// children: <Widget>[
@@ -788,18 +770,15 @@ class _MyHomePageState extends State<MyHomePage>
788770 margin: EdgeInsets .all (8.0 ),
789771 child: ClipRRect (
790772 borderRadius: BorderRadius .all (Radius .circular (5.0 )),
791- child: Image .network (
792- url,
793- fit: BoxFit .cover,
794- width: 1000.0
795- ),
773+ child:
774+ Image .network (url, fit: BoxFit .cover, width: 1000.0 ),
796775 ),
797776 );
798777 },
799778 ).toList (),
800779 onPageChanged: (index) {
801780 setState (() {
802- index;
781+ // index;
803782 });
804783 },
805784 ),
@@ -888,7 +867,8 @@ class _MyHomePageState extends State<MyHomePage>
888867 const Color (0xFFF56217 ),
889868 ]),
890869 boxFit: BoxFit .fill,
891- colorFilter: new ColorFilter .mode (Colors .black.withOpacity (0.67 ), BlendMode .darken),
870+ colorFilter: new ColorFilter .mode (
871+ Colors .black.withOpacity (0.67 ), BlendMode .darken),
892872// image: Image.asset(
893873// "lib/assets/img.png",
894874// fit: BoxFit.fitWidth,
@@ -901,9 +881,14 @@ class _MyHomePageState extends State<MyHomePage>
901881 backgroundColor: Color (0x5a0b486b ),
902882 child: Text ("tb" ),
903883 ),
904- title: Text ('Flutter' ,),
905- subTitle: Text ("Flutter is Google's mobile UI" ,),
906- description: Text ("Flutter Flutter is Google's mobile UI framework for crafting" ),
884+ title: Text (
885+ 'Flutter' ,
886+ ),
887+ subTitle: Text (
888+ "Flutter is Google's mobile UI" ,
889+ ),
890+ description: Text (
891+ "Flutter Flutter is Google's mobile UI framework for crafting" ),
907892 icon: GFIconButton (
908893 onPressed: null ,
909894 icon: Icon (Icons .favorite),
@@ -1163,49 +1148,53 @@ class _MyHomePageState extends State<MyHomePage>
11631148 ],
11641149 ),
11651150 ),
1166- // bottomNavigationBar: GFTabBar(
1167- // initialIndex: 0,
1168- // length: 3,
1169- // controller: tabController,
1170- // tabs: [
1171- // Tab(
1172- // icon: Icon(Icons.directions_bike),
1173- // child: Text(
1174- // "Tab1",
1175- // ),
1176- // ),
1177- // Tab(
1178- // icon: Icon(Icons.directions_bus),
1179- // child: Text(
1180- // "Tab2",
1181- // ),
1182- // ),
1183- // Tab(
1184- // icon: Icon(Icons.directions_railway),
1185- // child: Text(
1186- // "Tab3",
1187- // ),
1188- // ),
1189- // ],
1190- // indicatorColor: Colors.white,
1191- //// indicatorSize: TabBarIndicatorSize.label,
1192- // labelColor: Colors.lightGreen,
1193- // labelPadding: EdgeInsets.all(8.0),
1194- // tabBarColor: Colors.blueGrey,
1195- // unselectedLabelColor: Colors.black,
1196- // labelStyle: TextStyle(
1197- // fontWeight: FontWeight.w500,
1198- // fontSize: 13.0,
1199- // color: Colors.deepOrange,
1200- // fontFamily: 'OpenSansBold',
1201- // ),
1202- // unselectedLabelStyle: TextStyle(
1203- // fontWeight: FontWeight.w500,
1204- // fontSize: 13.0,
1205- // color: Colors.black,
1206- // fontFamily: 'OpenSansBold',
1207- // ),
1208- // ),
1151+ bottomNavigationBar: GFTabBar (
1152+ initialIndex: 0 ,
1153+ length: 3 ,
1154+ controller: tabController,
1155+ tabs: [
1156+ Tab (
1157+ icon: Icon (Icons .directions_bike),
1158+ child: Text (
1159+ "Tab1" ,
1160+ ),
1161+ ),
1162+ Tab (
1163+ icon: Icon (Icons .directions_bus),
1164+ child: Text (
1165+ "Tab2" ,
1166+ ),
1167+ ),
1168+ Tab (
1169+ icon: Icon (Icons .directions_railway),
1170+ child: Text (
1171+ "Tab3" ,
1172+ ),
1173+ ),
1174+ ],
1175+ shape: RoundedRectangleBorder (
1176+ borderRadius: BorderRadius .only (
1177+ topLeft: Radius .circular (24.0 ),
1178+ topRight: Radius .circular (24.0 ))),
1179+ indicatorColor: Colors .white,
1180+ // indicatorSize: TabBarIndicatorSize.label,
1181+ labelColor: Colors .lightGreen,
1182+ labelPadding: EdgeInsets .all (8.0 ),
1183+ tabBarColor: Colors .blueGrey,
1184+ unselectedLabelColor: Colors .black,
1185+ labelStyle: TextStyle (
1186+ fontWeight: FontWeight .w500,
1187+ fontSize: 13.0 ,
1188+ color: Colors .deepOrange,
1189+ fontFamily: 'OpenSansBold' ,
1190+ ),
1191+ unselectedLabelStyle: TextStyle (
1192+ fontWeight: FontWeight .w500,
1193+ fontSize: 13.0 ,
1194+ color: Colors .black,
1195+ fontFamily: 'OpenSansBold' ,
1196+ ),
1197+ ),
12091198 );
12101199 }
12111200}
0 commit comments