Skip to content

Commit 5a2f656

Browse files
committed
GFTabBar updated with shape
1 parent d9f6301 commit 5a2f656

File tree

3 files changed

+302
-221
lines changed

3 files changed

+302
-221
lines changed

example/lib/main.dart

Lines changed: 104 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:getflutter/getflutter.dart';
33
import 'package:getflutter/components/search_bar/gf_search_bar.dart';
4+
import 'dart:io';
45

56
final List<String> imageList = [
67
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg",
@@ -61,7 +62,14 @@ class _MyHomePageState extends State<MyHomePage>
6162
Icon actionIcon = new Icon(Icons.search);
6263

6364
List list = [
64-
"Flutter","Flutterjjk","Flutterhy","jhFlutter"
65+
"Flutter",
66+
"React",
67+
"Ionic",
68+
"Xamarin",
69+
"Flutter2",
70+
"React2",
71+
"Ionic2",
72+
"Xamarin2",
6573
];
6674

6775
@override
@@ -141,15 +149,15 @@ class _MyHomePageState extends State<MyHomePage>
141149
// Tab(icon: Icon(Icons.directions_bike)),
142150
// ],
143151
// ),
144-
// searchBar: true,
152+
searchBar: true,
145153
// searchHintText: "aaaaaaa",
146154
// searchHintStyle: TextStyle(fontSize: 18.0, color: Colors.redAccent),
147155
// searchStyle: TextStyle(fontSize: 10.0, color: Colors.green),
148156
// searchBarColorTheme: Colors.greenAccent,
149157

150158
actions: <Widget>[
151-
GFIconButton(icon: Icon(Icons.access_time), onPressed: () {}),
152-
GFIconButton(icon: Icon(Icons.favorite), onPressed: null),
159+
// GFIconButton(icon: Icon(Icons.access_time), onPressed: () {}),
160+
GFIconButton(icon: Icon(Icons.favorite, color: Colors.white,), onPressed: (){}, type: GFButtonType.transparent,),
153161
],
154162
),
155163
// backgroundColor: Colors.blueGrey,
@@ -167,65 +175,36 @@ class _MyHomePageState extends State<MyHomePage>
167175
mainAxisAlignment: MainAxisAlignment.center,
168176
crossAxisAlignment: CrossAxisAlignment.center,
169177
children: <Widget>[
170-
GFIconButton(
171-
icon: Icon(Icons.title),
172-
onPressed: null,
173-
// color: GFColor.secondary,
174-
),
175178

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-
// ),
179+
GFSearchBar(
180+
dataList: list,
181+
hideSearchBoxWhenItemSelected: false,
182+
listContainerHeight: 100.0,
183+
queryBuilder: (query, list) {
184+
return list
185+
.where((item) =>
186+
item.toLowerCase().contains(query.toLowerCase()))
187+
.toList();
188+
},
189+
popupListItemBuilder: (item) {
190+
return Container(
191+
padding: const EdgeInsets.all(12),
192+
child: Text(
193+
item,
194+
style: const TextStyle(fontSize: 18),
195+
),
196+
);
197+
},
198+
noItemsFoundWidget: Container(
199+
color: Colors.green,
200+
child: Text("no items found"),
201+
),
202+
onItemSelected: (item) {
203+
setState(() {
204+
print('ssssssss $item');
205+
});
206+
},
207+
),
229208

230209
// GFCard(
231210
// content: Column(
@@ -304,18 +283,17 @@ class _MyHomePageState extends State<MyHomePage>
304283
height: 130.0,
305284
width: 105.0,
306285
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-
]),
286+
borderRadius: BorderRadius.circular(8.0),
287+
gradient: LinearGradient(
288+
begin: FractionalOffset.bottomLeft,
289+
end: FractionalOffset.topRight,
290+
colors: [
291+
const Color(0x5a0b486b),
292+
const Color(0xFFF56217),
293+
]),
315294
),
316295
),
317296

318-
319297
// GFCard(
320298
// content: Column(
321299
// children: <Widget>[
@@ -788,11 +766,8 @@ class _MyHomePageState extends State<MyHomePage>
788766
margin: EdgeInsets.all(8.0),
789767
child: ClipRRect(
790768
borderRadius: BorderRadius.all(Radius.circular(5.0)),
791-
child: Image.network(
792-
url,
793-
fit: BoxFit.cover,
794-
width: 1000.0
795-
),
769+
child:
770+
Image.network(url, fit: BoxFit.cover, width: 1000.0),
796771
),
797772
);
798773
},
@@ -888,7 +863,8 @@ class _MyHomePageState extends State<MyHomePage>
888863
const Color(0xFFF56217),
889864
]),
890865
boxFit: BoxFit.fill,
891-
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.67), BlendMode.darken),
866+
colorFilter: new ColorFilter.mode(
867+
Colors.black.withOpacity(0.67), BlendMode.darken),
892868
// image: Image.asset(
893869
// "lib/assets/img.png",
894870
// fit: BoxFit.fitWidth,
@@ -901,9 +877,14 @@ class _MyHomePageState extends State<MyHomePage>
901877
backgroundColor: Color(0x5a0b486b),
902878
child: Text("tb"),
903879
),
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"),
880+
title: Text(
881+
'Flutter',
882+
),
883+
subTitle: Text(
884+
"Flutter is Google's mobile UI",
885+
),
886+
description: Text(
887+
"Flutter Flutter is Google's mobile UI framework for crafting"),
907888
icon: GFIconButton(
908889
onPressed: null,
909890
icon: Icon(Icons.favorite),
@@ -1163,49 +1144,49 @@ class _MyHomePageState extends State<MyHomePage>
11631144
],
11641145
),
11651146
),
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-
// ),
1147+
bottomNavigationBar: GFTabBar(
1148+
initialIndex: 0,
1149+
length: 3,
1150+
controller: tabController,
1151+
tabs: [
1152+
Tab(
1153+
icon: Icon(Icons.directions_bike),
1154+
child: Text(
1155+
"Tab1",
1156+
),
1157+
),
1158+
Tab(
1159+
icon: Icon(Icons.directions_bus),
1160+
child: Text(
1161+
"Tab2",
1162+
),
1163+
),
1164+
Tab(
1165+
icon: Icon(Icons.directions_railway),
1166+
child: Text(
1167+
"Tab3",
1168+
),
1169+
),
1170+
],
1171+
indicatorColor: Colors.white,
1172+
// indicatorSize: TabBarIndicatorSize.label,
1173+
labelColor: Colors.lightGreen,
1174+
labelPadding: EdgeInsets.all(8.0),
1175+
tabBarColor: Colors.blueGrey,
1176+
unselectedLabelColor: Colors.black,
1177+
labelStyle: TextStyle(
1178+
fontWeight: FontWeight.w500,
1179+
fontSize: 13.0,
1180+
color: Colors.deepOrange,
1181+
fontFamily: 'OpenSansBold',
1182+
),
1183+
unselectedLabelStyle: TextStyle(
1184+
fontWeight: FontWeight.w500,
1185+
fontSize: 13.0,
1186+
color: Colors.black,
1187+
fontFamily: 'OpenSansBold',
1188+
),
1189+
),
12091190
);
12101191
}
12111192
}

0 commit comments

Comments
 (0)