Skip to content

Commit 8e99b7e

Browse files
committed
Create list popular on Netflix
1 parent dba04e5 commit 8e99b7e

6 files changed

+71
-5
lines changed
33.6 KB
Loading
68.4 KB
Loading
Loading
93.6 KB
Loading
64.8 KB
Loading

lib/src/ui/home/home_screen.dart

+71-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ class HomeScreen extends StatelessWidget {
1717
children: <Widget>[
1818
_buildWidgetAppBar(),
1919
SizedBox(height: 24.0),
20-
_buildWidgetBanner(mediaQuery),
21-
SizedBox(height: 24.0),
22-
_buildWidgetCategories(mediaQuery),
23-
SizedBox(height: 24.0),
24-
_buildWidgetMyList(mediaQuery, context),
20+
Expanded(
21+
child: ListView(
22+
children: [
23+
_buildWidgetBanner(mediaQuery),
24+
SizedBox(height: 24.0),
25+
_buildWidgetCategories(mediaQuery),
26+
SizedBox(height: 24.0),
27+
_buildWidgetMyList(mediaQuery, context),
28+
SizedBox(height: 24.0),
29+
_buildWidgetPopular(mediaQuery, context),
30+
],
31+
),
32+
),
2533
],
2634
),
2735
),
@@ -267,4 +275,62 @@ class HomeScreen extends StatelessWidget {
267275
),
268276
);
269277
}
278+
279+
Widget _buildWidgetPopular(MediaQueryData mediaQuery, BuildContext context) {
280+
var listPosterPopular = [
281+
'assets/images/movie_1_popular_backdrop_path.jpeg',
282+
'assets/images/movie_2_popular_backdrop_path.jpeg',
283+
'assets/images/movie_3_popular_backdrop_path.jpeg',
284+
'assets/images/movie_4_popular_backdrop_path.jpeg',
285+
'assets/images/movie_5_popular_backdrop_path.jpeg',
286+
];
287+
return Container(
288+
width: mediaQuery.size.width,
289+
child: Column(
290+
children: <Widget>[
291+
Padding(
292+
padding: const EdgeInsets.symmetric(horizontal: 16.0),
293+
child: Row(
294+
crossAxisAlignment: CrossAxisAlignment.center,
295+
children: <Widget>[
296+
Expanded(
297+
child: Text(
298+
'Popular on Netflix',
299+
style: Theme.of(context).textTheme.subhead.merge(
300+
TextStyle(
301+
color: Colors.black,
302+
),
303+
),
304+
),
305+
),
306+
Icon(Icons.chevron_right),
307+
],
308+
),
309+
),
310+
SizedBox(height: 8.0),
311+
Container(
312+
height: 200.0,
313+
child: ListView.builder(
314+
scrollDirection: Axis.horizontal,
315+
itemBuilder: (BuildContext context, int index) {
316+
return Padding(
317+
padding: EdgeInsets.only(
318+
left: 16.0,
319+
right: index == listPosterPopular.length - 1 ? 16.0 : 0.0,
320+
),
321+
child: ClipRRect(
322+
borderRadius: BorderRadius.circular(8.0),
323+
child: Image.asset(
324+
listPosterPopular[index],
325+
fit: BoxFit.cover,
326+
),
327+
),
328+
);
329+
},
330+
),
331+
),
332+
],
333+
),
334+
);
335+
}
270336
}

0 commit comments

Comments
 (0)