foldAbleLayout method

dynamic foldAbleLayout(
  1. BuildContext context
)

折叠到展开 0-1 1, 围绕底部旋转 0-90 折叠状态 0 2,围绕顶部 90-0(-0>-90),,围绕底部 0-90(要显示holder) 折叠状态 -90 3,围绕顶部 90-0 折叠状态 90 ---> 0 折叠到展开

Implementation

foldAbleLayout(BuildContext context) {
  return Container(
    key: ValueKey(0),
    decoration: widget.decoration,
    child: Column(
      key: ValueKey(0),
      mainAxisSize: MainAxisSize.min,
      children: List.generate(childSize, (index) {
        Widget child = widget.childs![index];
        if (index == 0) {
          return Carousel(
            key: ValueKey(index),
            spinProgress: _unfoldAnimations[index].value,

            /// 第一个item高度永远不变
            // heightProgress: _heightAnimations[index].value,
            child: child,
            back: widget.foldChild!,
          );
        }
        if (index == childSize - 1) {
          return Carousel(
            key: ValueKey(index),
            spinProgress: _unfoldAnimations[index].value,
            heightProgress: _heightAnimations == null ? null : _heightAnimations![index - 1].value,
            child: child,
          );
        }
        var background = widget.background ??
            Container(
              color: widget.backgroundColor,
            );
        return Carousel(
          key: ValueKey(index),
          spinProgress: _unfoldAnimations[index].value,
          heightProgress: _heightAnimations == null ? null : _heightAnimations![index - 1].value,
          child: child,
          back: background,
        );
      }),
    ),
  );
}