From cf2ffe116d414c3ca99267fcdd9b9358572f74a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=8B=9C=ED=9B=84?= Date: Sat, 23 Jul 2022 13:52:35 +0900 Subject: [PATCH 1/2] Patch `RangeError (index): Invalid value: Valid value range is empty: 0` --- lib/src/show_up_list.dart | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/src/show_up_list.dart b/lib/src/show_up_list.dart index bb33713..1bd2995 100644 --- a/lib/src/show_up_list.dart +++ b/lib/src/show_up_list.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; + import '../show_up_animation.dart'; import 'show_up_builder.dart'; -import 'enums.dart'; /// Wrapper class to simplify the use of multiple [ShowUpAnimation] for a list of widgets. /// Supply all the children that you wish to animate to the widget as a list of widgets. @@ -52,7 +52,7 @@ class ShowUpList extends StatefulWidget { } class _ShowUpListState extends State { - late List _animatedChildren; + List _animatedChildren = []; @override void initState() { @@ -60,16 +60,16 @@ class _ShowUpListState extends State { if (widget.enableLazyLoading) { return; } else { - int _length = widget.children.length; - _animatedChildren = []; - for (int i = 0; i < _length; i++) { - _animatedChildren[i] = ShowUpAnimation( - child: widget.children[i], - animationDuration: widget.animationDuration, - curve: widget.curve, - offset: widget.offset, - direction: widget.direction, - delayStart: widget.delayBetween * (i + 1), + for (int i = 0; i < widget.children.length; i++) { + _animatedChildren.add( + ShowUpAnimation( + child: widget.children[i], + animationDuration: widget.animationDuration, + curve: widget.curve, + offset: widget.offset, + direction: widget.direction, + delayStart: widget.delayBetween * (i + 1), + ), ); } } From 763e121bea0ca4ff8223eccca3e714e3349b5c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=8B=9C=ED=9B=84?= Date: Sat, 23 Jul 2022 13:57:57 +0900 Subject: [PATCH 2/2] Patch `Expected a value of type 'List', but got one of type 'List'` --- lib/src/show_up_list.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/src/show_up_list.dart b/lib/src/show_up_list.dart index 1bd2995..ee0a6c8 100644 --- a/lib/src/show_up_list.dart +++ b/lib/src/show_up_list.dart @@ -52,7 +52,7 @@ class ShowUpList extends StatefulWidget { } class _ShowUpListState extends State { - List _animatedChildren = []; + late List _animatedChildren; @override void initState() { @@ -60,7 +60,9 @@ class _ShowUpListState extends State { if (widget.enableLazyLoading) { return; } else { - for (int i = 0; i < widget.children.length; i++) { + int _length = widget.children.length; + _animatedChildren = []; + for (int i = 0; i < _length; i++) { _animatedChildren.add( ShowUpAnimation( child: widget.children[i], @@ -94,7 +96,7 @@ class _ShowUpListState extends State { return Column( mainAxisSize: MainAxisSize.min, // crossAxisAlignment: CrossAxisAlignment.stretch, - children: _animatedChildren as List, + children: _animatedChildren, ); } }