Skip to content

Instantly share code, notes, and snippets.

@MarcinusX MarcinusX/line.dart Secret
Created Jan 13, 2019

What would you like to do?
class Line extends AnimatedWidget { //<--- Use AnimatedWidget
final int lineNumber;
final List<Note> currentNotes;
const Line(
{Key key,
Animation<double> animation}) //<-- Add animation to constructor
: super(key: key, listenable: animation); //<-- And pass it to super constructor
Widget build(BuildContext context) {
Animation<double> animation = super.listenable; //<--get the animation
//map notes to widgets
List<Widget> tiles = {
//specify note distance from top
int index = currentNotes.indexOf(note);
double offset = (3 - index + animation.value) * tileHeight; //<-- add animation.value to offset
return SizedBox.expand(
child: Stack(
children: tiles,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.