Skip to content

Commit 6c13162

Browse files
authored
Merge pull request #85 from deepikahr/rating
Rating
2 parents 0521133 + 991d6f2 commit 6c13162

File tree

4 files changed

+248
-187
lines changed

4 files changed

+248
-187
lines changed

example/lib/main.dart

Lines changed: 180 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -138,31 +138,48 @@ class _MyHomePageState extends State<MyHomePage>
138138
backgroundColor: Colors.teal,
139139
// centerTitle: true,
140140
// leading: GFIconButton(icon: Icon(Icons.directions_bus), onPressed: (){}),
141-
title:
142-
// const Text('UI Kit'),
143-
GFSegmentTabs(
144-
tabController: tabController,
145-
initialIndex: 0,
146-
length: 3,
147-
tabs: const <Widget>[
148-
Text(
149-
'Tab1',
150-
),
151-
Text(
152-
'Tab2',
153-
),
154-
Text(
155-
'Tab3',
156-
),
157-
],
158-
),
141+
title: const Text('UI Kit'),
142+
// GFSegmentTabs(
143+
// tabController: tabController,
144+
// initialIndex: 0,
145+
// length: 3,
146+
// tabs: const <Widget>[
147+
// Text(
148+
// 'Tab1',
149+
// ),
150+
// Text(
151+
// 'Tab2',
152+
// ),
153+
// Text(
154+
// 'Tab3',
155+
// ),
156+
// ],
157+
// ),
159158
// bottom: TabBar(
160159
// controller: tabController,
161-
// tabs: [
162-
// Tab(icon: Icon(Icons.directions_car)),
163-
// Tab(icon: Icon(Icons.directions_transit)),
164-
// Tab(icon: Icon(Icons.directions_bike)),
160+
// tabs: const [
161+
// Text(
162+
// 'Tab1',
163+
// ),
164+
// Text(
165+
// 'Tab1',
166+
// ),
167+
// Text(
168+
// 'Tab1',
169+
// ),
165170
// ],
171+
// labelStyle: TextStyle(
172+
// fontWeight: FontWeight.w900,
173+
// fontSize: 19,
174+
// color: Colors.deepOrange,
175+
// fontFamily: 'OpenSansBold',
176+
// ),
177+
// unselectedLabelStyle: TextStyle(
178+
// fontWeight: FontWeight.w500,
179+
// fontSize: 13,
180+
// color: Colors.black,
181+
// fontFamily: 'OpenSansBold',
182+
// ),
166183
// ),
167184
// searchBar: true,
168185
// searchHintText: "aaaaaaa",
@@ -197,38 +214,15 @@ class _MyHomePageState extends State<MyHomePage>
197214
mainAxisAlignment: MainAxisAlignment.center,
198215
crossAxisAlignment: CrossAxisAlignment.center,
199216
children: <Widget>[
200-
GFSearchBar(
201-
// searchBoxInputDecoration: InputDecoration(
202-
// enabledBorder: OutlineInputBorder(
203-
// borderSide: BorderSide(
204-
// color: Colors.teal,
205-
// ),
206-
// borderRadius: BorderRadius.circular(50)
207-
// ),
208-
// ),
209-
searchList: list,
210-
// hideSearchBoxWhenItemSelected: false,
211-
// overlaySearchListHeight: 100.0,
212-
searchQueryBuilder: (query, list) => list
213-
.where((item) =>
214-
item.toLowerCase().contains(query.toLowerCase()))
215-
.toList(),
216-
overlaySearchListItemBuilder: (item) => Container(
217-
padding: const EdgeInsets.all(8),
218-
child: Text(
219-
item,
220-
style: const TextStyle(fontSize: 18),
221-
),
222-
),
223-
// noItemsFoundWidget: Container(
224-
// color: Colors.green,
225-
// child: Text("no items found..."),
226-
// ),
227-
onItemSelected: (item) {
228-
setState(() {
229-
print('ssssssss $item');
230-
});
231-
}),
217+
GFRating(
218+
value: _rating,
219+
onChanged: (value) {
220+
setState(() {
221+
_rating = value;
222+
print('user selected $_rating');
223+
});
224+
},
225+
),
232226

233227
GFRating(
234228
value: _rating,
@@ -248,7 +242,7 @@ class _MyHomePageState extends State<MyHomePage>
248242
size: 40,
249243
color: Colors.teal.withOpacity(0.25),
250244
),
251-
spacing: 8,
245+
// spacing: 8,
252246
// color: Colors.teal,
253247
// borderColor: Colors.tealAccent,
254248
// allowHalfRating: false,
@@ -260,6 +254,31 @@ class _MyHomePageState extends State<MyHomePage>
260254
},
261255
),
262256

257+
GFRating(
258+
value: _rating,
259+
filledIcon: Icon(
260+
Icons.sentiment_very_satisfied,
261+
color: Colors.green,
262+
size: 50,
263+
),
264+
halfFilledIcon: Icon(
265+
Icons.sentiment_neutral,
266+
color: Colors.amber,
267+
size: 50,
268+
),
269+
defaultIcon: Icon(
270+
Icons.sentiment_very_dissatisfied,
271+
color: Colors.red,
272+
size: 50,
273+
),
274+
onChanged: (value) {
275+
setState(() {
276+
_rating = value;
277+
print('user selected $_rating');
278+
});
279+
},
280+
),
281+
263282
GFRating(
264283
value: _userRating,
265284
filledIcon: Image.asset(
@@ -284,7 +303,7 @@ class _MyHomePageState extends State<MyHomePage>
284303
color: Colors.teal,
285304
borderColor: Colors.tealAccent,
286305
controller: _ratingController,
287-
textForm: true,
306+
showTextForm: true,
288307
suffixIcon: GFButton(
289308
type: GFButtonType.transparent,
290309
onPressed: () {
@@ -297,6 +316,39 @@ class _MyHomePageState extends State<MyHomePage>
297316
),
298317
),
299318

319+
GFSearchBar(
320+
// searchBoxInputDecoration: InputDecoration(
321+
// enabledBorder: OutlineInputBorder(
322+
// borderSide: BorderSide(
323+
// color: Colors.teal,
324+
// ),
325+
// borderRadius: BorderRadius.circular(50)
326+
// ),
327+
// ),
328+
searchList: list,
329+
// hideSearchBoxWhenItemSelected: false,
330+
// overlaySearchListHeight: 100.0,
331+
searchQueryBuilder: (query, list) => list
332+
.where((item) =>
333+
item.toLowerCase().contains(query.toLowerCase()))
334+
.toList(),
335+
overlaySearchListItemBuilder: (item) => Container(
336+
padding: const EdgeInsets.all(8),
337+
child: Text(
338+
item,
339+
style: const TextStyle(fontSize: 18),
340+
),
341+
),
342+
// noItemsFoundWidget: Container(
343+
// color: Colors.green,
344+
// child: Text("no items found..."),
345+
// ),
346+
onItemSelected: (item) {
347+
setState(() {
348+
print('selected item $item');
349+
});
350+
}),
351+
300352
// GFCard(
301353
// content: Column(
302354
// children: <Widget>[
@@ -567,11 +619,13 @@ class _MyHomePageState extends State<MyHomePage>
567619
// )
568620
// ),
569621

570-
// GFButton(
571-
// onPressed: (){},
572-
// text: "whatsapp",
573-
// icon: Icon(Icons.directions_bike),
574-
// ),
622+
GFButton(
623+
type: GFButtonType.transparent,
624+
color: GFColor.warning,
625+
onPressed: () {},
626+
text: 'whatsapp',
627+
icon: Icon(Icons.directions_bike),
628+
),
575629
//
576630
// GFButton(
577631
// text: "linkedin",
@@ -804,22 +858,34 @@ class _MyHomePageState extends State<MyHomePage>
804858
// backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
805859
// ),
806860

807-
// GFSegmentTabs(
808-
// tabController: tabController,
809-
// initialIndex: 0,
810-
// length: 3,
811-
// tabs: <Widget>[
812-
// Text(
813-
// "Tab1",
814-
// ),
815-
// Text(
816-
// "Tab2",
817-
// ),
818-
// Text(
819-
// "Tab3",
820-
// ),
821-
// ],
822-
// ),
861+
GFSegmentTabs(
862+
tabController: tabController,
863+
initialIndex: 0,
864+
length: 3,
865+
tabs: const <Widget>[
866+
Text(
867+
'Tab1',
868+
),
869+
Text(
870+
'Tab2',
871+
),
872+
Text(
873+
'Tab3',
874+
),
875+
],
876+
indicatorColor: Colors.teal,
877+
border: Border.all(color: Colors.teal),
878+
labelColor: Colors.white,
879+
unselectedLabelColor: Colors.teal,
880+
labelStyle: TextStyle(
881+
fontWeight: FontWeight.w500,
882+
fontSize: 14,
883+
),
884+
unselectedLabelStyle: TextStyle(
885+
fontWeight: FontWeight.w400,
886+
fontSize: 12,
887+
),
888+
),
823889
//
824890
// GFTabBarView(controller: tabController, children: <Widget>[
825891
// Container(color: Colors.red),
@@ -1235,53 +1301,47 @@ class _MyHomePageState extends State<MyHomePage>
12351301
// ),
12361302
],
12371303
),
1238-
// ),
1239-
// bottomNavigationBar: GFTabBar(
1240-
// initialIndex: 0,
1241-
// length: 3,
1242-
// controller: tabController,
1243-
// tabs: [
1244-
// Tab(
1245-
// icon: Icon(Icons.directions_bike),
1246-
// child: Text(
1247-
// "Tab1",
1304+
),
1305+
// bottomNavigationBar: GFTabBar(
1306+
// initialIndex: 0,
1307+
// length: 3,
1308+
// controller: tabController,
1309+
// tabs: const [
1310+
// Text(
1311+
// 'Tab1',
12481312
// ),
1249-
// ),
1250-
// Tab(
1251-
// icon: Icon(Icons.directions_bus),
1252-
// child: Text(
1253-
// "Tab2",
1313+
// Text(
1314+
// 'Tab2',
12541315
// ),
1255-
// ),
1256-
// Tab(
1257-
// icon: Icon(Icons.directions_railway),
1258-
// child: Text(
1259-
// "Tab3",
1316+
// Tab(
1317+
// icon: Icon(Icons.directions_railway),
1318+
// child: Text(
1319+
// 'Tab3',
1320+
// ),
12601321
// ),
1322+
// ],
1323+
// shape: RoundedRectangleBorder(
1324+
// borderRadius: BorderRadius.only(
1325+
// topLeft: Radius.circular(24.0),
1326+
// topRight: Radius.circular(24.0))),
1327+
//// indicatorColor: Colors.white,
1328+
// indicatorSize: TabBarIndicatorSize.label,
1329+
//// labelColor: Colors.lightGreen,
1330+
//// labelPadding: EdgeInsets.all(8.0),
1331+
//// tabBarColor: Colors.blueGrey,
1332+
//// unselectedLabelColor: Colors.black,
1333+
// labelStyle: TextStyle(
1334+
// fontWeight: FontWeight.w500,
1335+
// fontSize: 13,
1336+
// color: Colors.deepOrange,
1337+
// fontFamily: 'OpenSansBold',
1338+
// ),
1339+
// unselectedLabelStyle: TextStyle(
1340+
// fontWeight: FontWeight.w500,
1341+
// fontSize: 13,
1342+
// color: Colors.black,
1343+
// fontFamily: 'OpenSansBold',
12611344
// ),
1262-
// ],
1263-
// shape: RoundedRectangleBorder(
1264-
// borderRadius: BorderRadius.only(
1265-
// topLeft: Radius.circular(24.0),
1266-
// topRight: Radius.circular(24.0))),
1267-
// indicatorColor: Colors.white,
1268-
//// indicatorSize: TabBarIndicatorSize.label,
1269-
// labelColor: Colors.lightGreen,
1270-
// labelPadding: EdgeInsets.all(8.0),
1271-
// tabBarColor: Colors.blueGrey,
1272-
// unselectedLabelColor: Colors.black,
1273-
// labelStyle: TextStyle(
1274-
// fontWeight: FontWeight.w500,
1275-
// fontSize: 13.0,
1276-
// color: Colors.deepOrange,
1277-
// fontFamily: 'OpenSansBold',
1278-
// ),
1279-
// unselectedLabelStyle: TextStyle(
1280-
// fontWeight: FontWeight.w500,
1281-
// fontSize: 13.0,
1282-
// color: Colors.black,
1283-
// fontFamily: 'OpenSansBold',
12841345
// ),
1285-
),
12861346
);
12871347
}

lib/components/drawer/gf_drawer_header.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ class GFDrawerHeaderPictures extends StatelessWidget {
1212
this.closeButton,
1313
}) : super(key: key);
1414

15+
/// A widget placed in the upper-left corner that represents the current
16+
/// user's account. Normally a [CircleAvatar].
1517
final Widget currentAccountPicture;
1618

19+
/// A list of widgets that represent the current user's other accounts.
20+
/// Up to three of these widgets will be arranged in a row in the header's
21+
/// upper-right corner. Normally a list of [CircleAvatar] widgets.
1722
final List<Widget> otherAccountsPictures;
1823

1924
/// widget onTap drawer get closed

0 commit comments

Comments
 (0)