水平翻转动画 ImageWidget Flutter [英] Horizontal Flip animation ImageWidget Flutter
本文介绍了水平翻转动画 ImageWidget Flutter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I want to do Horizontal flip animation for CircularAvatar widget.. like below animation Like this i want to flip circularAvartar
I have tried
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
解决方案
You could use library flip_card.
Add this to pubspec.yaml :
dependencies:
flip_card: ^0.4.4
Then run
flutter packages get
To use :
import 'package:flip_card/flip_card.dart';
FlipCard(
direction: FlipDirection.HORIZONTAL, // default
front: Container(
child: Text('Front'),
),
back: Container(
child: Text('Back'),
),
);
这篇关于水平翻转动画 ImageWidget Flutter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文