11import 'package:flutter/material.dart' ;
2- import '.. /api/models/movie_responses.dart' ;
2+ import 'package:tmdb_flutter/app /api/models/movie_responses.dart' ;
33
44class DetailsPage extends StatelessWidget {
5- final Movie movie;
5+ const DetailsPage ({ required this . movie, super .key}) ;
66
7- const DetailsPage ({ super .key, required this . movie}) ;
7+ final Movie movie;
88
99 @override
1010 Widget build (BuildContext context) {
@@ -26,7 +26,9 @@ class DetailsPage extends StatelessWidget {
2626 bottomRight: Radius .circular (32 ),
2727 ),
2828 image: DecorationImage (
29- image: NetworkImage ('https://image.tmdb.org/t/p/w500${movie .backdropPath ?? movie .posterPath }' ),
29+ image: NetworkImage (
30+ 'https://image.tmdb.org/t/p/w500${movie .backdropPath ?? movie .posterPath }' ,
31+ ),
3032 fit: BoxFit .cover,
3133 ),
3234 ),
@@ -52,13 +54,13 @@ class DetailsPage extends StatelessWidget {
5254 bottom: 0 ,
5355 child: _RatingIndicator (percent: movie.voteAverage / 10 ),
5456 ),
55- Positioned (
57+ const Positioned (
5658 left: 100 ,
5759 bottom: 32 ,
5860 right: 16 ,
5961 child: Column (
6062 crossAxisAlignment: CrossAxisAlignment .start,
61- children: const [
63+ children: [
6264 Text (
6365 'The Legend of Ochi' ,
6466 style: TextStyle (
@@ -82,7 +84,7 @@ class DetailsPage extends StatelessWidget {
8284 ),
8385 const SizedBox (height: 24 ),
8486 const Padding (
85- padding: EdgeInsets .symmetric (horizontal: 16.0 ),
87+ padding: EdgeInsets .symmetric (horizontal: 16 ),
8688 child: Text (
8789 'In a remote village on the island of Carpathia, a shy farm girl named Yuri is raised to fear an elusive animal species known as ochi. But when Yuri discovers a wounded baby ochi has been left behind, she escapes on a quest to bring him home.' ,
8890 style: TextStyle (
@@ -93,7 +95,7 @@ class DetailsPage extends StatelessWidget {
9395 ),
9496 const SizedBox (height: 24 ),
9597 const Padding (
96- padding: EdgeInsets .symmetric (horizontal: 16.0 ),
98+ padding: EdgeInsets .symmetric (horizontal: 16 ),
9799 child: Text (
98100 'Cast' ,
99101 style: TextStyle (
@@ -108,14 +110,29 @@ class DetailsPage extends StatelessWidget {
108110 height: 90 ,
109111 child: ListView (
110112 scrollDirection: Axis .horizontal,
111- padding: const EdgeInsets .symmetric (horizontal: 16.0 ),
113+ padding: const EdgeInsets .symmetric (horizontal: 16 ),
112114 children: const [
113- _CastCard (name: 'Helena Zengel' , image: 'https://randomuser.me/api/portraits/women/1.jpg' ),
114- _CastCard (name: 'Finn Wolfhard' , image: 'https://randomuser.me/api/portraits/men/2.jpg' ),
115- _CastCard (name: 'Emily Watson' , image: 'https://randomuser.me/api/portraits/women/3.jpg' ),
116- _CastCard (name: 'Willem Dafoe' , image: 'https://randomuser.me/api/portraits/men/4.jpg' ),
117- _CastCard (name: 'Razvan Stoica' , image: 'https://randomuser.me/api/portraits/men/5.jpg' ),
118- _CastCard (name: 'Carol B.' , image: 'https://randomuser.me/api/portraits/women/6.jpg' ),
115+ _CastCard (
116+ name: 'Helena Zengel' ,
117+ image:
118+ 'https://randomuser.me/api/portraits/women/1.jpg' ),
119+ _CastCard (
120+ name: 'Finn Wolfhard' ,
121+ image: 'https://randomuser.me/api/portraits/men/2.jpg' ),
122+ _CastCard (
123+ name: 'Emily Watson' ,
124+ image:
125+ 'https://randomuser.me/api/portraits/women/3.jpg' ),
126+ _CastCard (
127+ name: 'Willem Dafoe' ,
128+ image: 'https://randomuser.me/api/portraits/men/4.jpg' ),
129+ _CastCard (
130+ name: 'Razvan Stoica' ,
131+ image: 'https://randomuser.me/api/portraits/men/5.jpg' ),
132+ _CastCard (
133+ name: 'Carol B.' ,
134+ image:
135+ 'https://randomuser.me/api/portraits/women/6.jpg' ),
119136 ],
120137 ),
121138 ),
@@ -132,11 +149,11 @@ class DetailsPage extends StatelessWidget {
132149 ),
133150 ),
134151 const SizedBox (height: 12 ),
135- Padding (
136- padding: const EdgeInsets .symmetric (horizontal: 16.0 ),
152+ const Padding (
153+ padding: EdgeInsets .symmetric (horizontal: 16.0 ),
137154 child: Wrap (
138155 spacing: 8 ,
139- children: const [
156+ children: [
140157 _CategoryChip (label: 'Fantasy' ),
141158 _CategoryChip (label: 'Adventure' ),
142159 _CategoryChip (label: 'Family' ),
@@ -162,9 +179,12 @@ class DetailsPage extends StatelessWidget {
162179 scrollDirection: Axis .horizontal,
163180 padding: const EdgeInsets .symmetric (horizontal: 16.0 ),
164181 children: const [
165- _RecommendationCard (image: 'https://image.tmdb.org/t/p/w500/rec1.jpg' ),
166- _RecommendationCard (image: 'https://image.tmdb.org/t/p/w500/rec2.jpg' ),
167- _RecommendationCard (image: 'https://image.tmdb.org/t/p/w500/rec3.jpg' ),
182+ _RecommendationCard (
183+ image: 'https://image.tmdb.org/t/p/w500/rec1.jpg' ),
184+ _RecommendationCard (
185+ image: 'https://image.tmdb.org/t/p/w500/rec2.jpg' ),
186+ _RecommendationCard (
187+ image: 'https://image.tmdb.org/t/p/w500/rec3.jpg' ),
168188 ],
169189 ),
170190 ),
@@ -178,14 +198,14 @@ class DetailsPage extends StatelessWidget {
178198}
179199
180200class _CircleButton extends StatelessWidget {
181- final IconData icon;
182- final VoidCallback onTap;
183-
184201 const _CircleButton ({
185202 required this .icon,
186203 required this .onTap,
187204 });
188205
206+ final IconData icon;
207+ final VoidCallback onTap;
208+
189209 @override
190210 Widget build (BuildContext context) {
191211 return Container (
@@ -202,19 +222,19 @@ class _CircleButton extends StatelessWidget {
202222}
203223
204224class _RatingIndicator extends StatelessWidget {
205- final double percent;
206-
207225 const _RatingIndicator ({required this .percent});
208226
227+ final double percent;
228+
209229 @override
210230 Widget build (BuildContext context) {
211231 return Container (
212232 width: 60 ,
213233 height: 60 ,
214- decoration: BoxDecoration (
234+ decoration: const BoxDecoration (
215235 color: Colors .white,
216236 shape: BoxShape .circle,
217- boxShadow: const [
237+ boxShadow: [
218238 BoxShadow (
219239 color: Colors .black12,
220240 blurRadius: 8 ,
@@ -248,9 +268,10 @@ class _RatingIndicator extends StatelessWidget {
248268}
249269
250270class _CastCard extends StatelessWidget {
271+ const _CastCard ({required this .name, required this .image});
272+
251273 final String name;
252274 final String image;
253- const _CastCard ({required this .name, required this .image});
254275
255276 @override
256277 Widget build (BuildContext context) {
@@ -282,9 +303,10 @@ class _CastCard extends StatelessWidget {
282303}
283304
284305class _CategoryChip extends StatelessWidget {
285- final String label;
286306 const _CategoryChip ({required this .label});
287307
308+ final String label;
309+
288310 @override
289311 Widget build (BuildContext context) {
290312 return Chip (
@@ -303,9 +325,10 @@ class _CategoryChip extends StatelessWidget {
303325}
304326
305327class _RecommendationCard extends StatelessWidget {
306- final String image;
307328 const _RecommendationCard ({required this .image});
308329
330+ final String image;
331+
309332 @override
310333 Widget build (BuildContext context) {
311334 return Container (
@@ -327,4 +350,4 @@ class _RecommendationCard extends StatelessWidget {
327350 ),
328351 );
329352 }
330- }
353+ }
0 commit comments