水平翻转动画ImageWidget Flutter
Horizontal Flip animation ImageWidget Flutter
我想为 CircularAvatar widget 做水平翻转动画..就像下面的动画
像这样我想翻转 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();
但是它不像下面的动画那样工作,我想要像水平方向抛硬币这样的动画..请给出任何解决方案
您可以使用库 flip_card。
将此添加到 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'),
),
);
我想为 CircularAvatar widget 做水平翻转动画..就像下面的动画
我试过了
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();
但是它不像下面的动画那样工作,我想要像水平方向抛硬币这样的动画..请给出任何解决方案
您可以使用库 flip_card。
将此添加到 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'),
),
);