I want to have a Hero widget displayed on top of pages in a PageView, so that when I scroll through the pages, the Hero doesn't move at all.
This is the builder for my pages:
Widget _buildPage({color: Color, icon: Icon, text: String}) {
return Container(
padding: const EdgeInsets.only(top: 5.0),
color: color,
child: Column(
children: [
Expanded(
flex: 3,
child: Icon(icon)
),
Expanded(
flex: 2,
child: Text(text),
),
Expanded(
flex: 1,
child: Hero(
tag: 'examplehero',
child: Column(
children: [
Text(...),
FlatButton(
child: Text(...),
),
...
This is my PageView:
return PageView(
children: [
_buildPage(...),
_buildPage(...),
_buildPage(...),
_buildPage(...),
],
);
Currently, when I scroll through the pages, the hero widget acts like a regular widget, and is scrolled away with the page. How can I keep it always displayed?
Thanks in advance