Skip to content

Commit f047d3d

Browse files
Merge pull request #67 from Sandipkakadiya/review
Review
2 parents edbcbfb + 0a15f25 commit f047d3d

File tree

3 files changed

+106
-100
lines changed

3 files changed

+106
-100
lines changed

example/lib/main.dart

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/material.dart';
22
import 'package:getflutter/getflutter.dart';
3-
import 'package:getflutter/components/search_bar/gf_search_bar.dart';
43

54
final List<String> imageList = [
65
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg",
@@ -60,9 +59,7 @@ class _MyHomePageState extends State<MyHomePage>
6059
Widget appBarTitle = new Text("UI Kit");
6160
Icon actionIcon = new Icon(Icons.search);
6261

63-
List list = [
64-
"Flutter","Flutterjjk","Flutterhy","jhFlutter"
65-
];
62+
List list = ["Flutter", "Flutterjjk", "Flutterhy", "jhFlutter"];
6663

6764
@override
6865
Widget build(BuildContext context) {
@@ -304,18 +301,17 @@ class _MyHomePageState extends State<MyHomePage>
304301
height: 130.0,
305302
width: 105.0,
306303
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-
]),
304+
borderRadius: BorderRadius.circular(8.0),
305+
gradient: LinearGradient(
306+
begin: FractionalOffset.bottomLeft,
307+
end: FractionalOffset.topRight,
308+
colors: [
309+
const Color(0x5a0b486b),
310+
const Color(0xFFF56217),
311+
]),
315312
),
316313
),
317314

318-
319315
// GFCard(
320316
// content: Column(
321317
// children: <Widget>[
@@ -788,18 +784,15 @@ class _MyHomePageState extends State<MyHomePage>
788784
margin: EdgeInsets.all(8.0),
789785
child: ClipRRect(
790786
borderRadius: BorderRadius.all(Radius.circular(5.0)),
791-
child: Image.network(
792-
url,
793-
fit: BoxFit.cover,
794-
width: 1000.0
795-
),
787+
child:
788+
Image.network(url, fit: BoxFit.cover, width: 1000.0),
796789
),
797790
);
798791
},
799792
).toList(),
800793
onPageChanged: (index) {
801794
setState(() {
802-
index;
795+
// index;
803796
});
804797
},
805798
),
@@ -888,7 +881,8 @@ class _MyHomePageState extends State<MyHomePage>
888881
const Color(0xFFF56217),
889882
]),
890883
boxFit: BoxFit.fill,
891-
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.67), BlendMode.darken),
884+
colorFilter: new ColorFilter.mode(
885+
Colors.black.withOpacity(0.67), BlendMode.darken),
892886
// image: Image.asset(
893887
// "lib/assets/img.png",
894888
// fit: BoxFit.fitWidth,
@@ -901,9 +895,14 @@ class _MyHomePageState extends State<MyHomePage>
901895
backgroundColor: Color(0x5a0b486b),
902896
child: Text("tb"),
903897
),
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"),
898+
title: Text(
899+
'Flutter',
900+
),
901+
subTitle: Text(
902+
"Flutter is Google's mobile UI",
903+
),
904+
description: Text(
905+
"Flutter Flutter is Google's mobile UI framework for crafting"),
907906
icon: GFIconButton(
908907
onPressed: null,
909908
icon: Icon(Icons.favorite),

lib/components/card/gf_card.dart

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ class GFCard extends StatelessWidget {
3636
this.gradient})
3737
: assert(elevation == null || elevation >= 0.0),
3838
assert(borderOnForeground != null),
39-
assert(color == null || gradient == null,
40-
'Cannot provide both a color and a decoration\n'
41-
'The color argument is just a shorthand for "decoration: new BoxDecoration(color: color)".'
42-
),
39+
assert(
40+
color == null || gradient == null,
41+
'Cannot provide both a color and a decoration\n'
42+
'The color argument is just a shorthand for "decoration: new BoxDecoration(color: color)".'),
4343
super(key: key);
4444

4545
/// defines the card's height
@@ -149,23 +149,29 @@ class GFCard extends StatelessWidget {
149149
return Container(
150150
height: height,
151151
margin: margin ?? cardTheme.margin ?? const EdgeInsets.all(16.0),
152-
decoration: gradient != null ? BoxDecoration(
153-
gradient: gradient,
154-
borderRadius: BorderRadius.all(Radius.circular(4.0)),
155-
) : null,
156-
child: gradient == null ? Material(
157-
type: MaterialType.card,
158-
color: color ?? cardTheme.color ?? Theme.of(context).cardColor,
159-
elevation: elevation ?? cardTheme.elevation ?? _defaultElevation,
160-
shape: shape ??
161-
cardTheme.shape ??
162-
const RoundedRectangleBorder(
152+
decoration: gradient != null
153+
? BoxDecoration(
154+
gradient: gradient,
163155
borderRadius: BorderRadius.all(Radius.circular(4.0)),
164-
),
165-
borderOnForeground: borderOnForeground,
166-
clipBehavior: clipBehavior ?? cardTheme.clipBehavior ?? _defaultClipBehavior,
167-
child: imageOverlay == null ? cardChild : overlayImage,
168-
) : imageOverlay == null ? cardChild : overlayImage,
156+
)
157+
: null,
158+
child: gradient == null
159+
? Material(
160+
type: MaterialType.card,
161+
color: color ?? cardTheme.color ?? Theme.of(context).cardColor,
162+
elevation: elevation ?? cardTheme.elevation ?? _defaultElevation,
163+
shape: shape ??
164+
cardTheme.shape ??
165+
const RoundedRectangleBorder(
166+
borderRadius: BorderRadius.all(Radius.circular(4.0)),
167+
),
168+
borderOnForeground: borderOnForeground,
169+
clipBehavior: clipBehavior ??
170+
cardTheme.clipBehavior ??
171+
_defaultClipBehavior,
172+
child: imageOverlay == null ? cardChild : overlayImage,
173+
)
174+
: imageOverlay == null ? cardChild : overlayImage,
169175
);
170176
}
171177
}

lib/components/search_bar/gf_search_bar.dart

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import 'package:flutter/material.dart';
33
typedef QueryListItemBuilder<T> = Widget Function(T item);
44
typedef OnItemSelected<T> = void Function(T item);
55
typedef SelectedItemBuilder<T> = Widget Function(
6-
T item,
7-
VoidCallback deleteSelectedItem,
8-
);
6+
T item,
7+
VoidCallback deleteSelectedItem,
8+
);
99
typedef QueryBuilder<T> = List<T> Function(
10-
String query,
11-
List<T> list,
12-
);
10+
String query,
11+
List<T> list,
12+
);
1313
typedef TextFieldBuilder = Widget Function(
14-
TextEditingController controller,
15-
FocusNode focus,
16-
);
14+
TextEditingController controller,
15+
FocusNode focus,
16+
);
1717

1818
class 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

Comments
 (0)