forked from md-siam/widget_of_the_day
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhero_animation.dart
57 lines (55 loc) · 1.8 KB
/
hero_animation.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
import 'package:flutter/material.dart';
import 'package:widget_of_the_day/53_hero_animation/details.dart';
import 'module.dart';
class MyHeroAnimation extends StatelessWidget {
const MyHeroAnimation({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.deepPurple[100],
appBar: AppBar(title: const Text('Hero Animation')),
body: ListView.builder(
padding: const EdgeInsets.all(10.0),
itemCount: items.length,
itemBuilder: (BuildContext context, int index) {
final item = items[index];
return GestureDetector(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => DetailsScreen(item: item)),
),
child: Card(
elevation: 3.0,
child: Row(
children: [
Hero(
tag: item,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(5),
bottomLeft: Radius.circular(5),
),
child: SizedBox(
height: 100,
width: 100,
child: Image.asset(
item.imageUrl,
fit: BoxFit.cover,
),
),
),
),
const SizedBox(width: 16),
Text(
'Title: ' + item.title,
style: const TextStyle(fontSize: 24),
),
],
),
),
);
},
),
);
}
}