Skip to content

Commit 23bb093

Browse files
authored
Merge pull request #29 from ionicfirebaseapp/master
master pull
2 parents c2d9682 + b476234 commit 23bb093

File tree

14 files changed

+242
-246
lines changed

14 files changed

+242
-246
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ before_script:
2121
- cd ../
2222
- git clone https://github.com/flutter/flutter.git -b $FLUTTER_VERSION
2323
- ./flutter/bin/flutter doctor
24-
- cd getflutter/
24+
- cd getwidget/
2525

2626
script:
2727
- ./../flutter/bin/flutter analyze .

example/lib/main_temp.dart

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ class _MyHomePageState extends State<MyHomePage>
289289
mainAxisAlignment: MainAxisAlignment.center,
290290
crossAxisAlignment: CrossAxisAlignment.center,
291291
children: <Widget>[
292-
293292
// GFAccordion(
294293
// titleChild: Text('fgk'),
295294
// contentChild: Text('hhjk'),
@@ -651,11 +650,11 @@ class _MyHomePageState extends State<MyHomePage>
651650
// child: Text("dszndc"),
652651
// icon: Icon(Icons.WARNING),
653652
// ),
654-
GFButtonBadge(
655-
onPressed: null,
656-
text: "djvhcfdscc",
657-
icon: Icon(Icons.label),
658-
),
653+
GFButtonBadge(
654+
onPressed: null,
655+
text: "djvhcfdscc",
656+
icon: Icon(Icons.label),
657+
),
659658
// GFButton(
660659
// onPressed: null,
661660
// child: Text("gcnjd"),
@@ -1166,7 +1165,6 @@ class _MyHomePageState extends State<MyHomePage>
11661165
// ),
11671166
// ),
11681167

1169-
11701168
GFCheckbox(
11711169
size: GFSize.SMALL,
11721170
activebgColor: GFColors.DANGER,
@@ -1177,25 +1175,23 @@ class _MyHomePageState extends State<MyHomePage>
11771175
inactiveIcon: null,
11781176
),
11791177

1180-
1181-
11821178
GFRadioButton(
11831179
size: GFSize.SMALL,
11841180
value: true,
1185-
type: GFRadioButtonType.basic,
1186-
radioColor: GFColors.SUCCESS,
1181+
type: GFRadioButtonType.basic,
1182+
radioColor: GFColors.SUCCESS,
11871183
// activebgColor: GFColors.ALT,
11881184
// inactivebgColor: GFColors.PRIMARY,
11891185
// activeBorderColor: GFColors.DANGER,
11901186
// inactiveBorderColor: GFColors.DARK,
1191-
onChanged: (val) {
1192-
print('on change val $val');
1193-
},
1194-
activeIcon: const Icon(
1195-
Icons.check,
1196-
size: 20,
1197-
color: GFColors.DARK,
1198-
),
1187+
onChanged: (val) {
1188+
print('on change val $val');
1189+
},
1190+
activeIcon: const Icon(
1191+
Icons.check,
1192+
size: 20,
1193+
color: GFColors.DARK,
1194+
),
11991195
// inactiveIcon: const Icon(Icons.close, size: 20, color: GFColors.DARK,),
12001196
// custombgColor: GFColors.SUCCESS,
12011197
// groupValue:
@@ -1384,7 +1380,9 @@ class _MyHomePageState extends State<MyHomePage>
13841380
subTitle: Text('subtitle'),
13851381
// titleText: 'sdfg',
13861382
// subtitleText: 'sdfg',
1387-
avatar: GFAvatar(backgroundColor: GFColors.SUCCESS,),
1383+
avatar: GFAvatar(
1384+
backgroundColor: GFColors.SUCCESS,
1385+
),
13881386
description: Text('description'),
13891387
padding: const EdgeInsets.all(16),
13901388
margin: const EdgeInsets.all(16),
@@ -1405,38 +1403,42 @@ class _MyHomePageState extends State<MyHomePage>
14051403
print('on change val $val');
14061404
},
14071405
value: true,
1408-
inactiveIcon: Icon(Icons.close, color: GFColors.DARK, size: 16,),
1406+
inactiveIcon: Icon(
1407+
Icons.close,
1408+
color: GFColors.DARK,
1409+
size: 16,
1410+
),
14091411
),
14101412

1411-
////
1412-
// GFCarousel(
1413-
// pagerSize: 12,
1414-
// activeIndicator: Colors.pink,
1415-
// passiveIndicator: Colors.pink.withOpacity(0.4),
1416-
// viewportFraction: 1.0,
1417-
//// aspectRatio: 1,
1418-
// autoPlay: true,
1419-
// enlargeMainPage: true,
1420-
// pagination: true,
1421-
// items: imageList
1422-
// .map((url) => Container(
1423-
// padding: const EdgeInsets.only(bottom: 16),
1424-
// margin: const EdgeInsets.all(12),
1425-
// child: ClipRRect(
1426-
// borderRadius:
1427-
// const BorderRadius.all(Radius.circular(5)),
1428-
// child: Image.network(url,
1429-
// fit: BoxFit.cover, width: 1000),
1430-
// ),
1431-
// ))
1432-
// .toList(),
1433-
//// onPageChanged: (index) {
1434-
//// setState(() {
1435-
////// index;
1436-
//// });
1437-
//// },
1438-
// ),
1439-
1413+
//
1414+
GFCarousel(
1415+
// initialPage: 1,
1416+
pagerSize: 12,
1417+
activeIndicator: Colors.pink,
1418+
passiveIndicator: Colors.pink.withOpacity(0.4),
1419+
viewportFraction: 1.0,
1420+
// aspectRatio: 1,
1421+
autoPlay: true,
1422+
enlargeMainPage: true,
1423+
pagination: true,
1424+
items: imageList
1425+
.map((url) => Container(
1426+
padding: const EdgeInsets.only(bottom: 16),
1427+
margin: const EdgeInsets.all(12),
1428+
child: ClipRRect(
1429+
borderRadius:
1430+
const BorderRadius.all(Radius.circular(5)),
1431+
child: Image.network(url,
1432+
fit: BoxFit.cover, width: 1000),
1433+
),
1434+
))
1435+
.toList(),
1436+
// onPageChanged: (int index) {
1437+
// setState(() {
1438+
// index;
1439+
// });
1440+
// },
1441+
),
14401442

14411443
//
14421444
// GFCarousel(
@@ -1657,7 +1659,6 @@ class _MyHomePageState extends State<MyHomePage>
16571659
//// border: Border.all(color: Colors.pink, width: 2.0),
16581660
// ),
16591661

1660-
16611662
// GFAvatar(
16621663
// radius: 20.0,
16631664
// maxRadius: 50,

lib/components/accordian/gf_accordian.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,8 @@ class _GFAccordionState extends State<GFAccordion>
120120
child: Column(
121121
crossAxisAlignment: CrossAxisAlignment.start,
122122
children: <Widget>[
123-
GestureDetector(
124-
onTap: () {
125-
_toggleCollapsed();
126-
},
123+
InkWell(
124+
onTap: _toggleCollapsed,
127125
child: Container(
128126
decoration: BoxDecoration(
129127
border: widget.titleborder,

lib/components/card/gf_card.dart

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class GFCard extends StatelessWidget {
106106
/// defines the gradient background
107107
final LinearGradient gradient;
108108

109-
110109
static const double _defaultElevation = 1;
111110
static const Clip _defaultClipBehavior = Clip.none;
112111

@@ -115,29 +114,29 @@ class GFCard extends StatelessWidget {
115114
final CardTheme cardTheme = CardTheme.of(context);
116115

117116
final Widget cardChild = Padding(
118-
padding: padding,
119-
child: Column(
120-
children: <Widget>[
121-
titlePosition == GFPosition.start
122-
? title ?? Container()
123-
: image != null
124-
? ClipRRect(
125-
borderRadius: borderRadius ??
126-
const BorderRadius.vertical(top: Radius.circular(4)),
127-
child: image,
128-
)
129-
: Container(),
130-
titlePosition == GFPosition.start
131-
? image ?? Container()
132-
: title ?? Container(),
133-
Padding(
134-
padding: padding,
135-
child: content ?? Container(),
136-
),
137-
buttonBar ?? Container(),
138-
],
139-
),
140-
);
117+
padding: padding,
118+
child: Column(
119+
children: <Widget>[
120+
titlePosition == GFPosition.start
121+
? title ?? Container()
122+
: image != null
123+
? ClipRRect(
124+
borderRadius: borderRadius ??
125+
const BorderRadius.vertical(top: Radius.circular(4)),
126+
child: image,
127+
)
128+
: Container(),
129+
titlePosition == GFPosition.start
130+
? image ?? Container()
131+
: title ?? Container(),
132+
Padding(
133+
padding: padding,
134+
child: content ?? Container(),
135+
),
136+
buttonBar ?? Container(),
137+
],
138+
),
139+
);
141140

142141
final Widget overlayImage = GFImageOverlay(
143142
width: MediaQuery.of(context).size.width,
@@ -156,7 +155,8 @@ class GFCard extends StatelessWidget {
156155
decoration: gradient != null
157156
? BoxDecoration(
158157
gradient: gradient,
159-
borderRadius: borderRadius ?? const BorderRadius.all(Radius.circular(4)),
158+
borderRadius:
159+
borderRadius ?? const BorderRadius.all(Radius.circular(4)),
160160
)
161161
: null,
162162
child: gradient == null

lib/components/carousel/gf_carousel.dart

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:async';
22
import 'package:flutter/material.dart';
33

4+
// ignore: must_be_immutable
45
class GFCarousel extends StatefulWidget {
56
/// Creates slide show of Images and [Widget] with animation for sliding.
67
GFCarousel({
@@ -23,7 +24,7 @@ class GFCarousel extends StatefulWidget {
2324
this.pauseAutoPlayOnTouch,
2425
this.enlargeMainPage = false,
2526
this.onPageChanged,
26-
this.onPageIndex,
27+
// this.onPageIndex,
2728
this.scrollPhysics,
2829
this.scrollDirection = Axis.horizontal,
2930
}) : realPage = enableInfiniteScroll ? realPage + initialPage : initialPage,
@@ -95,7 +96,7 @@ class GFCarousel extends StatefulWidget {
9596
/// Called whenever the page in the center of the viewport changes.
9697
final Function(int index) onPageChanged;
9798

98-
int onPageIndex;
99+
// int onPageIndex;
99100

100101
/// How the carousel should respond to user input.
101102
///
@@ -166,7 +167,7 @@ class GFCarousel extends StatefulWidget {
166167

167168
class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
168169
Timer timer;
169-
int _current = 0;
170+
// int _current = 0;
170171

171172
/// Size of cell
172173
double size = 0;
@@ -215,16 +216,16 @@ class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
215216

216217
@override
217218
void dispose() {
218-
super.dispose();
219219
timer?.cancel();
220+
super.dispose();
220221
}
221222

222-
onPageChanged(index) {
223-
setState(() {
224-
index;
225-
});
223+
void onPageSlide(int index) {
224+
setState(() => index);
226225
}
227226

227+
int currentSlide;
228+
228229
@override
229230
Widget build(BuildContext context) => Stack(
230231
children: <Widget>[
@@ -233,24 +234,29 @@ class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
233234
scrollDirection: widget.scrollDirection,
234235
controller: widget.pageController,
235236
reverse: widget.reverse,
236-
itemCount: widget.items.length == 1 ? widget.items.length : widget.enableInfiniteScroll ? null : widget.items.length,
237+
itemCount: widget.items.length == 1
238+
? widget.items.length
239+
: widget.enableInfiniteScroll ? null : widget.items.length,
237240
onPageChanged: (int index) {
238241
int currentPage;
239242
currentPage = _getRealIndex(index + widget.initialPage,
240243
widget.realPage, widget.items.length);
241-
if (widget.pagination == true) {
242-
onPageChanged(currentPage);
243-
_current = currentPage;
244+
if (widget.onPageChanged != null) {
245+
widget.onPageChanged(currentPage);
246+
}
247+
if (widget.pagination == true && widget.onPageChanged == null) {
248+
onPageSlide(currentPage);
249+
// _current = currentPage;
244250
}
245-
_current = currentPage;
251+
// _current = currentPage;
246252
},
247253
itemBuilder: (BuildContext context, int i) {
248254
final int index = _getRealIndex(
249255
i + widget.initialPage,
250256
widget.realPage,
251257
widget.items.length,
252258
);
253-
259+
currentSlide = index;
254260
return AnimatedBuilder(
255261
animation: widget.pageController,
256262
child: widget.items[index],
@@ -303,7 +309,7 @@ class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
303309
mainAxisAlignment: MainAxisAlignment.center,
304310
children: widget.map<Widget>(
305311
widget.items,
306-
(indexx, url) => Container(
312+
(pagerIndex, url) => Container(
307313
width:
308314
widget.pagerSize == null ? 8.0 : widget.pagerSize,
309315
height:
@@ -312,7 +318,7 @@ class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
312318
vertical: 10, horizontal: 2),
313319
decoration: BoxDecoration(
314320
shape: BoxShape.circle,
315-
color: _current == indexx
321+
color: currentSlide == pagerIndex
316322
? widget.activeIndicator == null
317323
? const Color.fromRGBO(0, 0, 0, 0.9)
318324
: widget.activeIndicator

lib/components/checkbox/gf_checkbox.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@ class GFCheckbox extends StatefulWidget {
6363
}
6464

6565
class _GFCheckboxState extends State<GFCheckbox> {
66-
//
67-
6866
bool isSelected = false;
6967

7068
@override
71-
void initState(){
72-
isSelected = widget.value??false;
69+
void initState() {
70+
super.initState();
71+
isSelected = widget.value ?? false;
7372
}
7473

7574
void onStatusChange() {
@@ -80,6 +79,7 @@ class _GFCheckboxState extends State<GFCheckbox> {
8079
widget.onChanged(isSelected);
8180
}
8281
}
82+
8383
@override
8484
Widget build(BuildContext context) => InkWell(
8585
onTap: onStatusChange,
@@ -111,7 +111,7 @@ class _GFCheckboxState extends State<GFCheckbox> {
111111
alignment: Alignment.center,
112112
),
113113
Container(
114-
margin: const EdgeInsets.all(5),
114+
margin: const EdgeInsets.all(5),
115115
alignment: Alignment.center,
116116
width: widget.size * 0.8,
117117
height: widget.size * 0.8,

0 commit comments

Comments
 (0)