当孩子离开 ListTile 填充时使用 ListTile 动画小部件

问题描述 投票:0回答:0

当我使用 TweenAnimationBuilder 为 listTile 入口设置动画时,List tile 以我不理解的方式留下其填充。

我正在使用 TweenAnimationBuilder 使动画在渲染过程开始时启动

TweenAnimationBuilder代码:

return TweenAnimationBuilder<double>(
  tween: Tween<double>(begin: 100, end: 0),
  duration: ANIMATION_DURATION,
  curve: Curves.easeInOut,
  builder: (BuildContext context, double margin, Widget? child) {
    return Container(
      margin: EdgeInsets.only(
        top: !widget.side ? margin : 0.0,
        left: widget.side ? margin : 0.0,
      ),
      child: widget.child,
    );
  },
);

ListTile代码:

ListTile(
  leading: Container(
    margin: const EdgeInsets.symmetric(vertical: 4),
    decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(4),
      color: Theme.of(context).disabledColor,
    ),
    height: 40,
    width: 40,
    child: Icon(
      isWithdrawal ? Icons.arrow_drop_up_outlined : Icons.arrow_drop_down,
      size: 40,
      color: getColor(done),
    ),
  ),
  title: Text('Deposit'),
  subtitle: Text('Waiting'),
  trailing: Column(
    mainAxisAlignment: MainAxisAlignment.center,
    crossAxisAlignment: CrossAxisAlignment.end,
    children: <Widget>[
      BodyText(
        text: '${getSign(isWithdrawal)} ${getCurrencyFormat(amount)}',
        color: getColor(done, Theme.of(context).brightness),
        fontWeight: FontWeight.w800,
      ),

      //
      const SizedBox(
        height: 4,
      ),

      //
      BodyText(
        text: getDate(created),
        color: Theme.of(context).disabledColor,
      ),
    ],
  ),
)

我得到什么:

flutter flutter-animation
© www.soinside.com 2019 - 2024. All rights reserved.