Skip to content

Commit 4e9183e

Browse files
authored
Merge pull request #12 from deepikahr/slider
Slider
2 parents b43b56f + 4a223e4 commit 4e9183e

5 files changed

Lines changed: 419 additions & 117 deletions

File tree

example/lib/assets/food.jpeg

33.6 KB
Loading

example/lib/main.dart

Lines changed: 159 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ import 'package:ui_kit/position/gf_position.dart';
1414
import 'package:ui_kit/types/gf_type.dart';
1515
import 'package:ui_kit/components/image/gf_image_overlay.dart';
1616
import 'package:ui_kit/shape/gf_shape.dart';
17+
import 'package:ui_kit/components/slider/gf_slider.dart';
18+
19+
final List<String> imageList = [
20+
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg",
21+
"https://cdn.pixabay.com/photo/2017/12/13/00/23/christmas-3015776_960_720.jpg",
22+
"https://cdn.pixabay.com/photo/2019/12/19/10/55/christmas-market-4705877_960_720.jpg",
23+
"https://cdn.pixabay.com/photo/2019/12/20/00/03/road-4707345_960_720.jpg"
24+
];
25+
1726

1827
void main() => runApp(MyApp());
1928

@@ -51,56 +60,93 @@ class _MyHomePageState extends State<MyHomePage> {
5160
mainAxisAlignment: MainAxisAlignment.center,
5261
crossAxisAlignment: CrossAxisAlignment.center,
5362
children: <Widget>[
54-
GFCard(
55-
boxFit: BoxFit.cover,
56-
colorFilter: new ColorFilter.mode(
57-
Colors.black.withOpacity(0.67), BlendMode.darken),
58-
image: Image.asset("lib/assets/pizza.jpeg"),
59-
// imageOverlay: AssetImage("lib/assets/pizza.jpeg"),
60-
titlePosition: GFPosition.end,
61-
title: GFTitleBar(
62-
avatar: GFAvatar(
63-
child: Text("tb"),
64-
),
65-
title: Text(
66-
'title',
67-
style: TextStyle(color: Colors.grey),
68-
),
69-
subTitle: Text(
70-
'subtitle',
71-
style: TextStyle(color: Colors.grey),
72-
),
73-
icon: GFIconButton(
74-
onPressed: null,
75-
icon: Icon(Icons.favorite_border),
76-
type: GFType.transparent,
77-
),
78-
),
79-
content: Text(
80-
"Flutter "
81-
"Flutter is Google's mobile UI framework for crafting"
82-
" high-quality native interfaces on iOS and Android in "
83-
"Flutter ",
84-
style: TextStyle(color: Colors.grey),
85-
),
86-
buttonBar: GFButtonBar(
87-
mainAxisSize: MainAxisSize.min,
88-
children: <Widget>[
89-
GFButton(
90-
onPressed: null,
91-
child: Text("favorite"),
92-
icon: Icon(Icons.favorite_border),
93-
type: GFType.transparent,
94-
),
95-
GFButton(
96-
onPressed: null,
97-
child: Text("share"),
98-
icon: Icon(Icons.share),
99-
type: GFType.outline,
63+
64+
GFSlider(
65+
viewportFraction: 0.9,
66+
aspectRatio: 2.0,
67+
autoPlay: true,
68+
enlargeMainPage: true,
69+
items: imageList.map(
70+
(url) {
71+
return Container(
72+
margin: EdgeInsets.all(5.0),
73+
child: ClipRRect(
74+
borderRadius: BorderRadius.all(Radius.circular(5.0)),
75+
child: Image.network(
76+
url,
77+
fit: BoxFit.cover,
78+
width: 1000.0,
10079
),
101-
],
102-
),
103-
),
80+
),
81+
);
82+
},
83+
).toList(),
84+
),
85+
86+
// GFSlider(
87+
// autoPlay: true,
88+
// viewportFraction: 1.0,
89+
// aspectRatio: MediaQuery.of(context).size.aspectRatio,
90+
// items: imageList.map((url) {
91+
// return Image.network(
92+
// url,
93+
// fit: BoxFit.cover,
94+
// width: 1000.0,
95+
// );
96+
// },
97+
// ).toList(),
98+
// ),
99+
100+
// GFCard(
101+
// boxFit: BoxFit.cover,
102+
// colorFilter: new ColorFilter.mode(
103+
// Colors.black.withOpacity(0.67), BlendMode.darken),
104+
// image: Image.asset("lib/assets/food.jpeg"),
105+
//// imageOverlay: AssetImage("lib/assets/food.jpeg"),
106+
// titlePosition: GFPosition.end,
107+
// title: GFTitleBar(
108+
// avatar: GFAvatar(
109+
// child: Text("tb"),
110+
// ),
111+
// title: Text(
112+
// 'title',
113+
// style: TextStyle(color: Colors.grey),
114+
// ),
115+
// subTitle: Text(
116+
// 'subtitle',
117+
// style: TextStyle(color: Colors.grey),
118+
// ),
119+
// icon: GFIconButton(
120+
// onPressed: null,
121+
// icon: Icon(Icons.favorite_border),
122+
// type: GFType.transparent,
123+
// ),
124+
// ),
125+
// content: Text(
126+
// "Flutter "
127+
// "Flutter is Google's mobile UI framework for crafting"
128+
// " high-quality native interfaces on iOS and Android in "
129+
// "Flutter ",
130+
// style: TextStyle(color: Colors.grey),
131+
// ),
132+
// buttonBar: GFButtonBar(
133+
// mainAxisSize: MainAxisSize.min,
134+
// children: <Widget>[
135+
// GFButton(
136+
// onPressed: null,
137+
// child: Text("favorite"),
138+
// icon: Icon(Icons.favorite_border),
139+
// type: GFType.transparent,
140+
// ),
141+
// GFButton(
142+
// onPressed: null,
143+
// child: Text("share"),
144+
// icon: Icon(Icons.share),
145+
// type: GFType.outline,
146+
// ),
147+
// ],
148+
// ),
149+
// ),
104150

105151
// GFButtonBar(
106152
// mainAxisSize: MainAxisSize.min,
@@ -124,70 +170,70 @@ class _MyHomePageState extends State<MyHomePage> {
124170
// ),
125171
// ),
126172

127-
GFImageOverlay(
128-
width: MediaQuery.of(context).size.width,
129-
margin: EdgeInsets.all(16.0),
130-
padding: EdgeInsets.all(16.0),
131-
child: Column(
132-
children: <Widget>[
133-
new Text(
134-
'Hello world',
135-
style: TextStyle(color: Colors.white),
136-
),
137-
new Text(
138-
'Hello world',
139-
style: TextStyle(color: Colors.white),
140-
),
141-
new Text(
142-
'Hello world',
143-
style: TextStyle(color: Colors.white),
144-
),
145-
new Text(
146-
'Hello world',
147-
style: TextStyle(color: Colors.white),
148-
),
149-
new Text(
150-
'Hello world',
151-
style: TextStyle(color: Colors.white),
152-
),
153-
new Text(
154-
'Hello world',
155-
style: TextStyle(color: Colors.white),
156-
),
157-
new Text(
158-
'Hello world',
159-
style: TextStyle(color: Colors.white),
160-
),
161-
new Text(
162-
'Hello world',
163-
style: TextStyle(color: Colors.white),
164-
),
165-
new Text(
166-
'Hello world',
167-
style: TextStyle(color: Colors.white),
168-
),
169-
new Text(
170-
'Hello world',
171-
style: TextStyle(color: Colors.white),
172-
),
173-
new Text(
174-
'Hello world',
175-
style: TextStyle(color: Colors.white),
176-
),
177-
new Text(
178-
'Hello world',
179-
style: TextStyle(color: Colors.white),
180-
),
181-
],
182-
),
183-
// color: Colors.orange,
184-
image: AssetImage("lib/assets/pizza.jpeg"),
185-
boxFit: BoxFit.cover,
186-
colorFilter: new ColorFilter.mode(
187-
Colors.black.withOpacity(0.6), BlendMode.darken),
188-
borderRadius: new BorderRadius.circular(5.0),
189-
// border: Border.all(color: Colors.pink, width: 2.0),
190-
),
173+
// GFImageOverlay(
174+
// width: MediaQuery.of(context).size.width,
175+
// margin: EdgeInsets.all(16.0),
176+
// padding: EdgeInsets.all(16.0),
177+
// child: Column(
178+
// children: <Widget>[
179+
// new Text(
180+
// 'Hello world',
181+
// style: TextStyle(color: Colors.white),
182+
// ),
183+
// new Text(
184+
// 'Hello world',
185+
// style: TextStyle(color: Colors.white),
186+
// ),
187+
// new Text(
188+
// 'Hello world',
189+
// style: TextStyle(color: Colors.white),
190+
// ),
191+
// new Text(
192+
// 'Hello world',
193+
// style: TextStyle(color: Colors.white),
194+
// ),
195+
// new Text(
196+
// 'Hello world',
197+
// style: TextStyle(color: Colors.white),
198+
// ),
199+
// new Text(
200+
// 'Hello world',
201+
// style: TextStyle(color: Colors.white),
202+
// ),
203+
// new Text(
204+
// 'Hello world',
205+
// style: TextStyle(color: Colors.white),
206+
// ),
207+
// new Text(
208+
// 'Hello world',
209+
// style: TextStyle(color: Colors.white),
210+
// ),
211+
// new Text(
212+
// 'Hello world',
213+
// style: TextStyle(color: Colors.white),
214+
// ),
215+
// new Text(
216+
// 'Hello world',
217+
// style: TextStyle(color: Colors.white),
218+
// ),
219+
// new Text(
220+
// 'Hello world',
221+
// style: TextStyle(color: Colors.white),
222+
// ),
223+
// new Text(
224+
// 'Hello world',
225+
// style: TextStyle(color: Colors.white),
226+
// ),
227+
// ],
228+
// ),
229+
//// color: Colors.orange,
230+
// image: AssetImage("lib/assets/food.jpeg"),
231+
// boxFit: BoxFit.cover,
232+
// colorFilter: new ColorFilter.mode(
233+
// Colors.black.withOpacity(0.6), BlendMode.darken),
234+
// borderRadius: new BorderRadius.circular(5.0),
235+
//// border: Border.all(color: Colors.pink, width: 2.0),
236+
// ),
191237

192238
//
193239
// GFAvatar(

example/pubspec.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ui_kit_example
1+
name: example
22
description: A new Flutter project.
33

44
version: 1.0.0+1
@@ -19,4 +19,6 @@ dev_dependencies:
1919
sdk: flutter
2020

2121
flutter:
22-
uses-material-design: true
22+
uses-material-design: true
23+
assets:
24+
- lib/assets/food.jpeg

0 commit comments

Comments
 (0)