Skip to content

Commit bdf47ca

Browse files
committed
changes in gfcarousel and gfprogress bar
1 parent 1fca4ce commit bdf47ca

File tree

3 files changed

+214
-214
lines changed

3 files changed

+214
-214
lines changed

lib/components/carousel/gf_carousel.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ class GFCarousel extends StatefulWidget {
9797
/// Defaults to matching platform conventions.
9898
final ScrollPhysics? scrollPhysics;
9999

100-
List<T?> map<T>(List list, Function handler) {
101-
List<T?> result;
100+
List<T> map<T>(List list, Function handler) {
101+
List<T> result;
102102
result = [];
103103
for (var i = 0; i < list.length; i++) {
104104
result.add(handler(i, list[i]));
@@ -303,7 +303,7 @@ class _GFCarouselState extends State<GFCarousel> with TickerProviderStateMixin {
303303
),
304304
),
305305
// ignore: avoid_as
306-
) as List<Widget>,
306+
),
307307
),
308308
),
309309
)

lib/components/progress_bar/gf_progress_bar.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,12 @@ class _GFProgressBarState extends State<GFProgressBar>
220220
@override
221221
Widget build(BuildContext context) {
222222
super.build(context);
223-
final item = <Widget?>[];
223+
224+
final item = List<Widget>.empty(growable: true);
224225
if (widget.leading != null) {
225-
item.add(widget.leading);
226+
item.add(widget.leading!);
226227
}
228+
227229
final hasSetWidth = widget.width != null;
228230
final containerWidget = Container(
229231
margin: const EdgeInsets.only(left: 10, right: 10),
@@ -271,7 +273,7 @@ class _GFProgressBarState extends State<GFProgressBar>
271273
));
272274
}
273275
if (widget.trailing != null) {
274-
item.add(widget.trailing);
276+
item.add(widget.trailing!);
275277
}
276278
return widget.type == GFProgressType.linear
277279
? Material(
@@ -281,8 +283,7 @@ class _GFProgressBarState extends State<GFProgressBar>
281283
child: Row(
282284
mainAxisAlignment: widget.alignment,
283285
crossAxisAlignment: CrossAxisAlignment.center,
284-
// ignore: avoid_as
285-
children: item as List<Widget>,
286+
children: item,
286287
)),
287288
)
288289
: Material(
@@ -292,8 +293,7 @@ class _GFProgressBarState extends State<GFProgressBar>
292293
child: Column(
293294
crossAxisAlignment: CrossAxisAlignment.center,
294295
mainAxisAlignment: MainAxisAlignment.spaceBetween,
295-
// ignore: avoid_as
296-
children: item as List<Widget>,
296+
children: item,
297297
)),
298298
);
299299
}

0 commit comments

Comments
 (0)