-
Notifications
You must be signed in to change notification settings - Fork 4
/
hero_page.dart
73 lines (68 loc) · 1.72 KB
/
hero_page.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import 'package:animations_app/widget/widget.dart';
import 'package:flutter/material.dart';
const _heroTagImage = 'image';
const _heroTagText = 'text';
final _image = Image.asset('assets/love.png');
const _text = 'I am a dog 🐶';
class HeroPage extends StatelessWidget {
const HeroPage({super.key});
static const routeName = 'Hero';
@override
Widget build(BuildContext context) {
return AppScaffold(
title: 'Hero',
child: InkWell(
onTap: () => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (context) => const DetailScreen()),
),
child: SizedBox(
height: 60,
child: Row(
children: [
Hero(
tag: _heroTagImage,
child: _image,
),
const SizedBox(width: 16),
const Hero(
tag: _heroTagText,
child: Material(
color: Colors.transparent,
child: Text(_text),
),
),
],
),
),
),
);
}
}
class DetailScreen extends StatelessWidget {
const DetailScreen({super.key});
@override
Widget build(BuildContext context) {
return AppScaffold(
title: 'Detail',
child: Column(
children: [
Hero(
tag: _heroTagImage,
child: _image,
),
const SizedBox(height: 16),
const Hero(
tag: _heroTagText,
child: Material(
color: Colors.transparent,
child: Text(
_text,
style: TextStyle(fontSize: 32),
),
),
),
],
),
);
}
}