水平翻转动画ImageWidget颤动 [英] Horizontal Flip animation ImageWidget Flutter

查看:141
本文介绍了水平翻转动画ImageWidget颤动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为CircularAvatar小部件做水平翻转动画.像下面的动画像这样,我想翻转circularAvartar

I want to do Horizontal flip animation for CircularAvatar widget.. like below animation Like this i want to flip circularAvartar

我尝试过

AnimationController _controller;

    AnimatedBuilder(
          animation: _controller,
          builder: (context, child){
            return Transform(
              transform: Matrix4.rotationY((1 - _controller.value ) * pi / 2),
            child: CircleAvatar(
            radius: PROFILE_PIC_RADIUS,
            backgroundImage: AssetImage(url),
           // backgroundColor: Colors.transparent,
            ),
            );
          }
        ),

_controller.forward();
_controller.reverse();

但是它不能像下面的动画那样工作,我想要像在水平方向上翻转硬币的动画.请提供任何解决方案

But it is not working like below animation, i want animation like flipping coin in horizontal direction.. Please give any solution

推荐答案

您可以使用库 flip_card .

将此添加到pubspec.yaml:

Add this to pubspec.yaml :

dependencies:
  flip_card: ^0.4.4

然后运行

flutter packages get

要使用:

import 'package:flip_card/flip_card.dart';

FlipCard(
  direction: FlipDirection.HORIZONTAL, // default
  front: Container(
        child: Text('Front'),
    ),
    back: Container(
        child: Text('Back'),
    ),
);

这篇关于水平翻转动画ImageWidget颤动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆