/
animation_sample_02.dart
66 lines (61 loc) · 1.63 KB
/
animation_sample_02.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import 'package:flare_flutter/flare_actor.dart';
import 'package:flutter/material.dart';
class AnimationSample02Page extends StatefulWidget {
static PageRoute createPageRoute() {
return MaterialPageRoute(
builder: (context) => AnimationSample02Page(),
);
}
@override
_AnimationSample02PageState createState() => _AnimationSample02PageState();
}
class _AnimationSample02PageState extends State<AnimationSample02Page> {
final List<String> _animations = [
'4_to_5',
'5_to_6',
'6_to_7',
'7_to_8',
'8_to_3',
'3_to_4',
];
int _animationIndex;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Animation Sample 02'),
),
body: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(24.0),
child: Container(
width: 300.0,
height: 300.0,
child: FlareActor(
'images/path_morph.flr',
fit: BoxFit.contain,
animation: _animationIndex != null
? _animations[_animationIndex]
: null,
),
),
),
FloatingActionButton(
child: Icon(Icons.autorenew),
onPressed: () {
setState(() {
if (_animationIndex == null ||
_animationIndex == _animations.length - 1) {
_animationIndex = 0;
} else {
_animationIndex++;
}
});
},
)
],
),
);
}
}