Skip to content

Instantly share code, notes, and snippets.

@md-weber
Created May 3, 2020 18:59
Show Gist options
  • Save md-weber/993e9916a99ec6f46c08ad30fe2ba7fd to your computer and use it in GitHub Desktop.
Save md-weber/993e9916a99ec6f46c08ad30fe2ba7fd to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: GestureDetector(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => PageTwo()));
},
child: Container(
width: 300,
height: 300,
child: Hero(
tag: "first_element",
child: Image(
fit: BoxFit.fill,
image: NetworkImage(
"https://codepen-chriscoyier-bucket.imgix.net/10.svg",
),
),
),
),
),
);
}
}
class PageTwo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
height: 300,
width: 300,
child: Align(
alignment: Alignment.bottomCenter,
child: Hero(
tag: "first_element",
child: Image(
fit: BoxFit.fill,
image: NetworkImage(
"https://codepen-chriscoyier-bucket.imgix.net/10.svg"),
),
),
),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment