Skip to content

Commit 24f6947

Browse files
authored
Merge pull request #20 from deepikahr/drawer
Drawer
2 parents 012e512 + fc7bbe3 commit 24f6947

5 files changed

Lines changed: 632 additions & 127 deletions

File tree

example/lib/main.dart

Lines changed: 174 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,16 @@ import 'package:flutter/cupertino.dart';
3030
import 'package:ui_kit/size/gf_size.dart';
3131
import 'package:ui_kit/position/gf_position.dart';
3232
import 'package:ui_kit/components/tabs/gf_tabs.dart';
33+
import 'package:ui_kit/components/slider/gf_items_slider.dart';
34+
import 'package:ui_kit/components/drawer/gf_drawer.dart';
3335

3436
final List<String> imageList = [
3537
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg",
3638
"https://cdn.pixabay.com/photo/2017/12/13/00/23/christmas-3015776_960_720.jpg",
3739
"https://cdn.pixabay.com/photo/2019/12/19/10/55/christmas-market-4705877_960_720.jpg",
38-
"https://cdn.pixabay.com/photo/2019/12/20/00/03/road-4707345_960_720.jpg"
40+
"https://cdn.pixabay.com/photo/2019/12/20/00/03/road-4707345_960_720.jpg",
41+
"https://cdn.pixabay.com/photo/2019/12/22/04/18/x-mas-4711785__340.jpg",
42+
"https://cdn.pixabay.com/photo/2016/11/22/07/09/spruce-1848543__340.jpg"
3943
];
4044

4145
void main() => runApp(MyApp());
@@ -68,23 +72,87 @@ class _MyHomePageState extends State<MyHomePage> {
6872
@override
6973
Widget build(BuildContext context) {
7074
return Scaffold(
75+
drawer: GFDrawer(
76+
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.6), BlendMode.darken),
77+
backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
78+
gradient: LinearGradient(
79+
begin: Alignment.topRight,
80+
end: Alignment.bottomLeft,
81+
stops: [0.1, 0.5, 0.7, 0.9],
82+
colors: [
83+
Colors.teal[800],
84+
Colors.teal[600],
85+
Colors.teal[400],
86+
Colors.teal[200],
87+
],
88+
),
89+
child: ListView(
90+
padding: EdgeInsets.zero,
91+
children: <Widget>[
92+
UserAccountsDrawerHeader(),
93+
DrawerHeader(
94+
child: Column(
95+
children: <Widget>[
96+
Text('Drawer Header'),
97+
Text('Drawer Header'),
98+
Text('Drawer Header'),
99+
],
100+
),
101+
decoration: BoxDecoration(
102+
color: Colors.blue,
103+
),
104+
),
105+
ListTile(
106+
title: Text('Item 1'),
107+
onTap: () {
108+
},
109+
),
110+
ListTile(
111+
title: Text('Item 2'),
112+
onTap: () {
113+
},
114+
),
115+
],
116+
),
117+
),
71118
backgroundColor: Colors.cyanAccent,
72119
appBar: AppBar(
73120
title: Text(widget.title),
121+
74122
),
75123
body: SingleChildScrollView(
76124
child: Column(
77125
mainAxisAlignment: MainAxisAlignment.center,
78126
crossAxisAlignment: CrossAxisAlignment.center,
79127
children: <Widget>[
80128

129+
GFItemsSlider(
130+
rowCount: 3,
131+
children: imageList.map(
132+
(url) {
133+
return Container(
134+
margin: EdgeInsets.all(5.0),
135+
child: ClipRRect(
136+
borderRadius: BorderRadius.all(Radius.circular(5.0)),
137+
child: Image.network(
138+
url,
139+
fit: BoxFit.cover,
140+
width: 1000.0
141+
),
142+
),
143+
);
144+
},
145+
).toList(),
146+
),
147+
81148
GFSlider(
82-
// pagerSize: 12.0,
83-
// activeIndicator: Colors.pink,
84-
// passiveIndicator: Colors.pink.withOpacity(0.4),
85-
viewportFraction: 0.9,
149+
rowCount: 3,
150+
pagerSize: 12.0,
151+
activeIndicator: Colors.pink,
152+
passiveIndicator: Colors.pink.withOpacity(0.4),
153+
viewportFraction: 1.0,
86154
aspectRatio: 2.0,
87-
// autoPlay: true,
155+
autoPlay: true,
88156
enlargeMainPage: true,
89157
pagination: true,
90158
items: imageList.map(
@@ -96,7 +164,7 @@ class _MyHomePageState extends State<MyHomePage> {
96164
child: Image.network(
97165
url,
98166
fit: BoxFit.cover,
99-
width: 1000.0,
167+
width: 1000.0
100168
),
101169
),
102170
);
@@ -109,20 +177,20 @@ class _MyHomePageState extends State<MyHomePage> {
109177
},
110178
),
111179

112-
GFButton(
113-
color: Colors.orange,
114-
onPressed: null,
115-
child: Text("share"),
116-
type: GFType.outline,
117-
shape: GFShape.pills,
118-
// buttonBoxShadow: true,
119-
// boxShadow: BoxShadow(
120-
// color: Colors.pink,
121-
// blurRadius: 1.5,
122-
// spreadRadius: 2.0,
123-
// offset: Offset.zero,
124-
// ),
125-
),
180+
// GFButton(
181+
// color: Colors.orange,
182+
// onPressed: null,
183+
// child: Text("share"),
184+
// type: GFType.outline,
185+
// shape: GFShape.pills,
186+
//// buttonBoxShadow: true,
187+
//// boxShadow: BoxShadow(
188+
//// color: Colors.pink,
189+
//// blurRadius: 1.5,
190+
//// spreadRadius: 2.0,
191+
//// offset: Offset.zero,
192+
//// ),
193+
// ),
126194

127195
GFTabs(
128196
initialIndex: 0,
@@ -174,22 +242,22 @@ class _MyHomePageState extends State<MyHomePage> {
174242
Icon(Icons.directions_transit),
175243
],
176244
),
177-
// indicatorColor: Colors.teal,
178-
// indicatorSize: TabBarIndicatorSize.label,
179-
// labelColor: Colors.lightGreen,
180-
// unselectedLabelColor: Colors.black,
181-
// labelStyle: TextStyle(
182-
// fontWeight: FontWeight.w500,
183-
// fontSize: 13.0,
184-
// color: Colors.deepOrange,
185-
// fontFamily: 'OpenSansBold',
186-
// ),
187-
// unselectedLabelStyle: TextStyle(
188-
// fontWeight: FontWeight.w500,
189-
// fontSize: 13.0,
190-
// color: Colors.black,
191-
// fontFamily: 'OpenSansBold',
192-
// ),
245+
indicatorColor: Colors.teal,
246+
indicatorSize: TabBarIndicatorSize.label,
247+
labelColor: Colors.lightGreen,
248+
unselectedLabelColor: Colors.black,
249+
labelStyle: TextStyle(
250+
fontWeight: FontWeight.w500,
251+
fontSize: 13.0,
252+
color: Colors.deepOrange,
253+
fontFamily: 'OpenSansBold',
254+
),
255+
unselectedLabelStyle: TextStyle(
256+
fontWeight: FontWeight.w500,
257+
fontSize: 13.0,
258+
color: Colors.black,
259+
fontFamily: 'OpenSansBold',
260+
),
193261
),
194262

195263
// GFSlider(
@@ -217,77 +285,80 @@ class _MyHomePageState extends State<MyHomePage> {
217285
// });
218286
// },
219287
// ),
220-
GFCard(
221-
boxFit: BoxFit.cover,
222-
colorFilter: new ColorFilter.mode(
223-
Colors.black.withOpacity(0.67), BlendMode.darken),
224-
image: Image.asset("lib/assets/food.jpeg"),
225-
// imageOverlay: AssetImage("lib/assets/food.jpeg"),
226-
titlePosition: GFPosition.end,
227-
title: GFListTile(
228-
avatar: GFAvatar(
229-
child: Text("tb"),
230-
),
231-
title: Text(
232-
'title',
233-
style: TextStyle(color: Colors.grey),
234-
),
235-
subTitle: Text(
236-
'subtitle',
237-
style: TextStyle(color: Colors.grey),
238-
),
239-
icon: GFIconButton(
240-
onPressed: null,
241-
icon: Icon(Icons.favorite_border),
242-
type: GFType.transparent,
243-
),
244-
),
245-
content: Text(
246-
"Flutter "
247-
"Flutter is Google's mobile UI framework for crafting"
248-
" high-quality native interfaces on iOS and Android in "
249-
"Flutter ",
250-
style: TextStyle(color: Colors.grey),
251-
),
252-
buttonBar: GFButtonBar(
253-
mainAxisSize: MainAxisSize.min,
254-
children: <Widget>[
255-
GFButton(
256-
onPressed: null,
257-
child: Text("favorite"),
258-
icon: Icon(Icons.favorite_border),
259-
type: GFType.transparent,
260-
),
261-
GFButton(
262-
onPressed: null,
263-
child: Text("share"),
264-
icon: Icon(Icons.share),
265-
type: GFType.outline,
266-
),
267-
],
268-
),
269-
),
270-
GFButtonBar(
271-
mainAxisSize: MainAxisSize.min,
272-
children: <Widget>[
273-
GFButton(
274-
onPressed: null,
275-
child: Text("like"),
276-
icon: Icon(Icons.favorite_border),
277-
type: GFType.transparent,
278-
),
279-
GFButton(
280-
onPressed: null,
281-
child: Text("comment"),
282-
),
288+
// GFCard(
289+
// boxFit: BoxFit.cover,
290+
// colorFilter: new ColorFilter.mode(
291+
// Colors.black.withOpacity(0.67), BlendMode.darken),
292+
// image: Image.asset("lib/assets/food.jpeg"),
293+
//// imageOverlay: AssetImage("lib/assets/food.jpeg"),
294+
// titlePosition: GFPosition.end,
295+
// title: GFListTile(
296+
// avatar: GFAvatar(
297+
// child: Text("tb"),
298+
// ),
299+
// title: Text(
300+
// 'title',
301+
// style: TextStyle(color: Colors.grey),
302+
// ),
303+
// subTitle: Text(
304+
// 'subtitle',
305+
// style: TextStyle(color: Colors.grey),
306+
// ),
307+
// icon: GFIconButton(
308+
// onPressed: null,
309+
// icon: Icon(Icons.favorite_border),
310+
// type: GFType.transparent,
311+
// ),
312+
// ),
313+
// content: Text(
314+
// "Flutter "
315+
// "Flutter is Google's mobile UI framework for crafting"
316+
// " high-quality native interfaces on iOS and Android in "
317+
// "Flutter ",
318+
// style: TextStyle(color: Colors.grey),
319+
// ),
320+
// buttonBar: GFButtonBar(
321+
// mainAxisSize: MainAxisSize.min,
322+
// children: <Widget>[
323+
// GFButton(
324+
// onPressed: null,
325+
// child: Text("favorite"),
326+
// icon: Icon(Icons.favorite_border),
327+
// type: GFType.transparent,
328+
// ),
329+
// GFButton(
330+
// onPressed: null,
331+
// child: Text("share"),
332+
// icon: Icon(Icons.share),
333+
// type: GFType.outline,
334+
// ),
335+
// ],
336+
// ),
337+
// ),
338+
// GFButtonBar(
339+
// mainAxisSize: MainAxisSize.min,
340+
// children: <Widget>[
341+
// GFButton(
342+
// onPressed: null,
343+
// child: Text("like"),
344+
// icon: Icon(Icons.favorite_border),
345+
// type: GFType.transparent,
346+
// ),
347+
// GFButton(
348+
// onPressed: null,
349+
// child: Text("comment"),
350+
// ),
283351
GFButton(
284-
onPressed: null,
352+
color: Colors.teal,
353+
onPressed: (){},
285354
child: Text("share"),
286355
icon: Icon(Icons.share),
287356
type: GFType.outline,
288357
),
289-
],
290-
),
358+
// ],
359+
// ),
360+
361+
291362
// GFListItem(
292363
// avatar: GFAvatar(
293364
// child: Text("tb"),

lib/components/button/gf_button.dart

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -302,32 +302,11 @@ class _GFButtonState extends State<GFButton> {
302302
}
303303

304304

305-
double get _effectiveElevation {
306-
// These conditionals are in order of precedence, so be careful about
307-
// reorganizing them.
308-
if (_disabled) {
309-
return widget.disabledElevation;
310-
}
311-
if (_pressed) {
312-
return widget.highlightElevation;
313-
}
314-
if (_hovered) {
315-
return widget.hoverElevation;
316-
}
317-
if (_focused) {
318-
return widget.focusElevation;
319-
}
320-
return widget.elevation;
321-
}
322-
323-
324305
@override
325306
Widget build(BuildContext context) {
326307

327308
ShapeBorder shape;
328309

329-
final ShapeBorder effectiveShape = MaterialStateProperty.resolveAs<ShapeBorder>(shape, _states);
330-
331310
final Color effectiveTextColor = MaterialStateProperty.resolveAs<Color>(
332311
widget.textStyle?.color, _states);
333312
final Color themeColor =
@@ -410,7 +389,6 @@ class _GFButtonState extends State<GFButton> {
410389
BoxConstraints(minHeight: 26.0, minWidth: 98.0),
411390
decoration: getBoxShadow(),
412391
child: Material(
413-
elevation: _effectiveElevation,
414392
textStyle: widget.textStyle == null ? TextStyle(color: this.textColor, fontSize: 14) : widget.textStyle,
415393
shape: widget.type == GFType.transparent ? null : widget.borderShape == null ? shape : widget.borderShape,
416394
color: widget.type == GFType.transparent || widget.type == GFType.outline ? Colors.transparent : this.color,

0 commit comments

Comments
 (0)