JournalList: Implement Hero transition

This was especially challenging because of this bug -
https://github.com/flutter/flutter/issues/36220

It's why we need the extra flightShuttleBuilder
This commit is contained in:
Vishesh Handa
2019-12-06 12:32:51 +01:00
parent 0b161a9df4
commit 4c2285a2cc
2 changed files with 11 additions and 2 deletions

View File

@ -150,7 +150,7 @@ class NoteViewer extends StatelessWidget {
padding: const EdgeInsets.all(16.0),
);
return view;
return Hero(tag: note.filePath, child: view);
}
/*

View File

@ -51,7 +51,16 @@ class JournalList extends StatelessWidget {
var note = notes[i];
return IconDismissable(
key: ValueKey("JournalList_" + note.filePath),
child: Hero(
tag: note.filePath,
child: _buildRow(context, note, i),
flightShuttleBuilder: (BuildContext flightContext,
Animation<double> animation,
HeroFlightDirection flightDirection,
BuildContext fromHeroContext,
BuildContext toHeroContext) =>
Material(child: toHeroContext.widget),
),
backgroundColor: Colors.red[800],
iconData: Icons.delete,
onDismissed: (direction) {