Skip to content

Commit bd2f7ee

Browse files
committed
Add FavoritesPage and integrate navigation from HomePage
1 parent 549c676 commit bd2f7ee

File tree

2 files changed

+102
-1
lines changed

2 files changed

+102
-1
lines changed

lib/app/view/favorites_page.dart

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import 'package:flutter/material.dart';
2+
3+
class FavoritesPage extends StatelessWidget {
4+
const FavoritesPage({super.key});
5+
6+
@override
7+
Widget build(BuildContext context) {
8+
return Scaffold(
9+
backgroundColor: const Color(0xFFF9F3FF),
10+
appBar: AppBar(
11+
backgroundColor: Colors.transparent,
12+
elevation: 0,
13+
title: const Padding(
14+
padding: EdgeInsets.only(left: 8.0),
15+
child: Text(
16+
'Favorites',
17+
style: TextStyle(
18+
color: Colors.black,
19+
fontSize: 36,
20+
fontWeight: FontWeight.bold,
21+
),
22+
),
23+
),
24+
toolbarHeight: 80,
25+
),
26+
body: Padding(
27+
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
28+
child: Align(
29+
alignment: Alignment.topLeft,
30+
child: SizedBox(
31+
width: 220,
32+
child: Stack(
33+
children: [
34+
ClipRRect(
35+
borderRadius: BorderRadius.circular(24),
36+
child: Image.network(
37+
'https://image.tmdb.org/t/p/w500/ochi.jpg',
38+
height: 320,
39+
width: 220,
40+
fit: BoxFit.cover,
41+
),
42+
),
43+
Positioned(
44+
top: 16,
45+
right: 16,
46+
child: Container(
47+
decoration: BoxDecoration(
48+
color: Colors.white.withOpacity(0.7),
49+
shape: BoxShape.circle,
50+
),
51+
child: const Padding(
52+
padding: EdgeInsets.all(8.0),
53+
child: Icon(
54+
Icons.favorite,
55+
color: Colors.black,
56+
size: 28,
57+
),
58+
),
59+
),
60+
),
61+
Positioned(
62+
left: 0,
63+
right: 0,
64+
bottom: 16,
65+
child: Container(
66+
padding: const EdgeInsets.symmetric(vertical: 12),
67+
decoration: BoxDecoration(
68+
color: Colors.black.withOpacity(0.5),
69+
borderRadius: const BorderRadius.only(
70+
bottomLeft: Radius.circular(24),
71+
bottomRight: Radius.circular(24),
72+
),
73+
),
74+
child: const Center(
75+
child: Text(
76+
'FINAL DESTINATION\nBLOODLINES',
77+
textAlign: TextAlign.center,
78+
style: TextStyle(
79+
color: Colors.white,
80+
fontWeight: FontWeight.bold,
81+
fontSize: 18,
82+
),
83+
),
84+
),
85+
),
86+
),
87+
],
88+
),
89+
),
90+
),
91+
),
92+
);
93+
}
94+
}

lib/app/view/home_page.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:tmdb_flutter/app/view/details_page.dart';
3+
import 'package:tmdb_flutter/app/view/favorites_page.dart';
34

45
class HomePage extends StatelessWidget {
56
const HomePage({super.key});
@@ -183,7 +184,13 @@ class HomePage extends StatelessWidget {
183184
),
184185
],
185186
currentIndex: 0,
186-
onTap: (index) {},
187+
onTap: (index) {
188+
if (index == 1) {
189+
Navigator.of(context).push(
190+
MaterialPageRoute(builder: (context) => const FavoritesPage()),
191+
);
192+
}
193+
},
187194
),
188195
),
189196
);

0 commit comments

Comments
 (0)