featured_tiles.dart
4.44 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import 'package:like/widgets/responsive.dart';
import 'package:flutter/material.dart';
class FeaturedTiles extends StatelessWidget {
FeaturedTiles({
Key? key,
required this.screenSize,
}) : super(key: key);
final Size screenSize;
final List<String> assets = [
'assets/images/trekking.jpg',
'assets/images/animals.jpg',
'assets/images/photography.jpeg',
];
final List<String> title = ['Trekking', 'Animals', 'Photography'];
@override
Widget build(BuildContext context) {
return ResponsiveWidget.isSmallScreen(context)
? Padding(
padding: EdgeInsets.only(top: screenSize.height / 50),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(width: screenSize.width / 15),
...Iterable<int>.generate(assets.length).map(
(int pageIndex) => Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: screenSize.width / 2.5,
width: screenSize.width / 1.5,
child: ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Image.asset(
assets[pageIndex],
fit: BoxFit.cover,
),
),
),
Padding(
padding: EdgeInsets.only(
top: screenSize.height / 70,
),
child: Text(
title[pageIndex],
style: TextStyle(
fontSize: 16,
fontFamily: 'Montserrat',
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme
.subtitle1!
.color,
),
),
),
],
),
SizedBox(width: screenSize.width / 15),
],
),
),
],
),
),
)
: Padding(
padding: EdgeInsets.only(
top: screenSize.height * 0.06,
left: screenSize.width / 15,
right: screenSize.width / 15,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
...Iterable<int>.generate(assets.length).map(
(int pageIndex) => Column(
children: [
SizedBox(
height: screenSize.width / 6,
width: screenSize.width / 3.8,
child: ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Image.asset(
assets[pageIndex],
fit: BoxFit.cover,
),
),
),
Padding(
padding: EdgeInsets.only(
top: screenSize.height / 70,
),
child: Text(
title[pageIndex],
style: TextStyle(
fontSize: 16,
fontFamily: 'Montserrat',
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme
.subtitle1!
.color,
),
),
),
],
),
),
],
),
);
}
}