A Hero Animation in one sentence is simply an element of one screen “flying” to the next when the app goes to the next page.

Use the Hero
widget to animate a widget from one screen to the next. This recipe uses the following steps:
- Create two screens showing the same image.
- Add a
Hero
widget to the first screen. - Add a
Hero
widget to the second screen.
And here comes my logic implementation :
Hero(tag:'photo1',child:_circleImage(context,'photo1',"https://auto.ndtvimg.com/car-images/large/ferrari/488-gtb/ferrari-488-gtb.jpg?v=6"),),
Navigator.push(context, MaterialPageRoute(builder: (context)=> Detail(imageUrl,tag))),
main.dart
import 'package:flutter/material.dart';
import './ui/home.dart';
void main() => runApp(
MaterialApp(
home: Home(),
)
);
home.dart
import 'package:flutter/material.dart';
import 'detail.dart';
class Home extends StatelessWidget {
double rating=0.0;
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text('home'),
centerTitle: true,
),
body: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Hero(
tag: 'photo1',
child: _circleImage(context,'photo1',"https://auto.ndtvimg.com/car-images/large/ferrari/488-gtb/ferrari-488-gtb.jpg?v=6"),
),
Hero(
tag: 'photo2',
child: _circleImage(context,'photo2',"https://spectatecars.com/wp-content/uploads/2017/10/2019-Ferrari-488-Spider-featured-815x527.jpg"),
),
Hero(
tag: 'photo3',
child: _circleImage(context,'photo3',"https://www.thetruthaboutcars.com/wp-content/uploads/2019/01/2019-mercedes-benz-a-class-sedan-e1547745740100-610x408.jpg"),
)
],
)
],
)),
);
}
Widget _circleImage( BuildContext context, String tag,String imageUrl){
return GestureDetector(
onTap: ()=> Navigator.push(context, MaterialPageRoute(builder: (context)=> Detail(imageUrl,tag))),
child: Container(
width: 120,
height: 120,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(image: NetworkImage(imageUrl),fit: BoxFit.fill)
),
),
);
}
}
detail.dart
import 'package:flutter/material.dart';
class Detail extends StatelessWidget{
String imageUrl;
String tag;
Detail(this.imageUrl,this.tag);
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text('detail'),
centerTitle: true,
),
body: Center(
child: Hero(tag: tag,
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height/2,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(image: NetworkImage(imageUrl),fit: BoxFit.fill)
),
),
)
),
);
}
}


You can Download Source Code via Github.
I was recommended this web site by my cousin. I
am not sure whether this post is written by him as no one else know such detailed about my problem.
You are amazing! Thanks!
We are a group of volunteers and opening a new scheme in our community.
Your site offered us with valuable info to work on. You’ve done an impressive
job and our entire community will be grateful to you.
I really like looking through a post that will make men and
women think. Also, thank you for permitting me to comment!
Your way of explaining all in this article is genuinely pleasant, every one be able to effortlessly understand it, Thanks a lot.
Hi there, yes this paragraph is genuinely pleasant and I have learned lot of things from it about blogging.
thanks.
This is really interesting, You are a very skilled
blogger. I have joined your feed and look forward to seeking more of
your fantastic post. Also, I’ve shared your site in my social networks!
you are in point of fact a good webmaster. The web site loading pace is amazing.
It sort of feels that you’re doing any distinctive trick.
Furthermore, The contents are masterpiece. you’ve done a excellent job on this subject!
Wonderful beat ! I would like to apprentice while you amend your web site, how
can i subscribe for a weblog site? The account aided me a acceptable deal.
I were a little bit familiar of this your broadcast offered shiny clear idea
I read this paragraph completely on the topic of the comparison of
newest and previous technologies, it’s remarkable article.
It’s hard to find educated people about this topic, however,
you sound like you know what you’re talking about! Thanks
What’s up, after reading this remarkable piece of writing
i am as well delighted to share my familiarity here with colleagues.
That is a very good tip particularly to those new to the blogosphere.
Simple but very accurate information… Many thanks for
sharing this one. A must read post!
Thank you a bunch for sharing this with all people you really recognize what you’re talking approximately!
Bookmarked. Please also consult with my website
=). We will have a link alternate agreement among us
Hello, i think that i saw you visited my blog so i
came to “return the favor”.I’m attempting to find things to improve my site!I
suppose its ok to use a few of your ideas!!
Hey there, You have done a great job. I will certainly digg it and personally suggest to my friends.
I’m sure they will be benefited from this web site.
It’s great that you are getting ideas from this article as well as from our argument made at this time.
I am in fact delighted to read this webpage posts which includes
lots of valuable data, thanks for providing these kinds of statistics.
Greate article. Keep writing such kind of info
on your blog. Im really impressed by it.
Hello there, You have performed an incredible job.
I will certainly digg it and in my opinion suggest to my friends.
I’m confident they’ll be benefited from this web site.
I all the time used to study post in news papers but now as I am a user of net
thus from now I am using net for posts, thanks to web.
It’s remarkable in favor of me to have a web site,
which is good designed for my experience. thanks admin
Hi there, I enjoy reading through your article. I wanted to write a little comment to support you.
I read this post completely on the topic of the comparison of latest and preceding
technologies, it’s awesome article.
very good publish, i certainly love this web site, keep on it
Your home is valueble for me. Thanks!?
It’s best to take part in a contest for the most effective blogs on the web. I will advocate this website!
You should take part in a contest for among the best blogs on the web. I’ll recommend this site!
I really like and appreciate your article post.Really thank you! Keep writing.
There’s noticeably a bundle to find out about this. I assume you made sure good factors in options also.
I’m typically to blogging and i actually recognize your content. The article has actually peaks my interest. I am going to bookmark your site and hold checking for brand spanking new information.
I抎 should verify with you here. Which isn’t one thing I often do! I take pleasure in studying a put up that can make individuals think. Also, thanks for permitting me to remark!
That is the right blog for anyone who desires to seek out out about this topic. You realize so much its almost onerous to argue with you (not that I actually would need匟aHa). You undoubtedly put a new spin on a subject thats been written about for years. Nice stuff, simply great!
Howdy! I simply would like to give a huge thumbs up for the good data you might have here on this post. I can be coming back to your blog for extra soon.
This actually answered my downside, thanks!
Way cool! Some very valid points! I appreciate you writing this article plus the rest of the website is also very good.