Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial animation with bounds -1.0 .. 1.0
- Loading branch information
1 parent
d1f9224
commit 5d9e340
Showing
4 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: fd6baba1373c1dde90511ca15d9cc89aa642fe3e | ||
channel: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
|
||
class UsingAnimationControllerPage extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return new Scaffold( | ||
appBar: new AppBar( | ||
title: new Text("Using animation controller"), | ||
), | ||
body: new UsingAnimationControllerBody(), | ||
); | ||
} | ||
} | ||
|
||
|
||
class UsingAnimationControllerBody extends StatefulWidget { | ||
@override | ||
_UsingAnimationControllerBodyState createState() => | ||
new _UsingAnimationControllerBodyState(); | ||
} | ||
|
||
class _UsingAnimationControllerBodyState | ||
extends State<UsingAnimationControllerBody> | ||
with SingleTickerProviderStateMixin { | ||
|
||
AnimationController _controller; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
|
||
_controller = new AnimationController( | ||
lowerBound: -1.0, | ||
upperBound: 1.0, | ||
duration: new Duration(seconds: 2), | ||
vsync: this | ||
) | ||
..addListener(() { | ||
this.setState(() {}); | ||
}); | ||
|
||
|
||
_controller.forward(from: -1.0); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
|
||
return new Stack( | ||
fit: StackFit.expand, | ||
children: <Widget>[ | ||
new FractionallySizedBox( | ||
heightFactor: 0.2, | ||
widthFactor: 0.2, | ||
alignment: new Alignment(_controller.value, 0.0), | ||
child: new Icon( | ||
Icons.flight, | ||
size: 80.0, | ||
) | ||
), | ||
], | ||
); | ||
} | ||
} |