@@ -8,7 +8,9 @@ import 'package:moviedex/pages/watch_page.dart';
88class EpisodesList extends StatefulWidget {
99 final Episode episode;
1010 final Contentclass data;
11- const EpisodesList ({super .key,required this .episode,required this .data});
11+ final String ? airDate;
12+ const EpisodesList (
13+ {super .key, required this .episode, required this .data, this .airDate});
1214
1315 @override
1416 State <EpisodesList > createState () => _EpisodesListState ();
@@ -24,19 +26,27 @@ class _EpisodesListState extends State<EpisodesList> {
2426 super .initState ();
2527 Hive .openBox (widget.data.title).then ((value) => storage = value);
2628 }
29+
2730 @override
2831 Widget build (BuildContext context) {
2932 final width = MediaQuery .of (context).size.width;
30- final isMobile = width< 600 ;
33+ final isMobile = width < 600 ;
3134 final episode = widget.episode;
3235 return GestureDetector (
3336 onTapDown: (_) => setState (() => isPressed = true ),
3437 onTapUp: (_) => setState (() => isPressed = false ),
3538 onTapCancel: () => setState (() => isPressed = false ),
36- onTap: (){
37- hivePut (storage: storage,key: "episode" ,value: 'E${episode .episode }' );
38- hivePut (storage: storage,key: "season" ,value: 'S${episode .season }' );
39- Navigator .of (context).push (MaterialPageRoute (builder: (context) => WatchPage (data: widget.data,episodeNumber: episode.episode,seasonNumber: episode.season,title: episode.name,)));
39+ onTap: () {
40+ hivePut (storage: storage, key: "episode" , value: 'E${episode .episode }' );
41+ hivePut (storage: storage, key: "season" , value: 'S${episode .season }' );
42+ Navigator .of (context).push (MaterialPageRoute (
43+ builder: (context) => WatchPage (
44+ data: widget.data,
45+ episodeNumber: episode.episode,
46+ seasonNumber: episode.season,
47+ airDate: widget.airDate,
48+ title: episode.name,
49+ )));
4050 },
4151 child: MouseRegion (
4252 cursor: SystemMouseCursors .click,
@@ -52,49 +62,70 @@ class _EpisodesListState extends State<EpisodesList> {
5262 spacing: 8 ,
5363 children: [
5464 Card (
55- clipBehavior: Clip .antiAlias,
56- shape: RoundedRectangleBorder (
57- borderRadius: BorderRadius .circular (8 ),
58- ),
59- child: Stack (
60- alignment: Alignment .center,
61- children: [
62- Image .network (episode.image,fit: BoxFit .cover,width: isMobile? width/ 2.5 : 200 ,height: 100 ,),
63- Container (
64- width: isMobile? width/ 2.5 : 200 ,
65- height: 100 ,
66- color: Colors .black.withValues (alpha: 0.3 ),
67- child: const Center (
68- child: Icon (
69- Icons .play_circle_outline_rounded,
70- size: 42 ,
71- color: Colors .white,
65+ clipBehavior: Clip .antiAlias,
66+ shape: RoundedRectangleBorder (
67+ borderRadius: BorderRadius .circular (8 ),
68+ ),
69+ child: Stack (
70+ alignment: Alignment .center,
71+ children: [
72+ Image .network (
73+ episode.image,
74+ fit: BoxFit .cover,
75+ width: isMobile ? width / 2.5 : 200 ,
76+ height: 100 ,
77+ ),
78+ Container (
79+ width: isMobile ? width / 2.5 : 200 ,
80+ height: 100 ,
81+ color: Colors .black.withValues (alpha: 0.3 ),
82+ child: const Center (
83+ child: Icon (
84+ Icons .play_circle_outline_rounded,
85+ size: 42 ,
86+ color: Colors .white,
87+ ),
7288 ),
7389 ),
74- ),
75- ],
76- )
77- ),
90+ ],
91+ )),
7892 SizedBox (
79- width: width/ 2 ,
93+ width: width / 2 ,
8094 child: Column (
8195 crossAxisAlignment: CrossAxisAlignment .start,
8296 children: [
83- Text ('${episode .episode }. ${episode .name }' ,maxLines: 2 ,style: TextStyle (fontSize: 20 ,fontWeight: FontWeight .bold,overflow: TextOverflow .ellipsis),),
84- Text ("Season ${episode .season } Episode ${episode .episode }" ,style: TextStyle (fontSize: 16 ,color: Colors .grey)),
85- Text (episode.airDate,style: TextStyle (fontSize: 14 ,color: Colors .grey),),
97+ Text (
98+ '${episode .episode }. ${episode .name }' ,
99+ maxLines: 2 ,
100+ style: TextStyle (
101+ fontSize: 20 ,
102+ fontWeight: FontWeight .bold,
103+ overflow: TextOverflow .ellipsis),
104+ ),
105+ Text (
106+ "Season ${episode .season } Episode ${episode .episode }" ,
107+ style: TextStyle (fontSize: 16 , color: Colors .grey)),
108+ Text (
109+ episode.airDate,
110+ style: TextStyle (fontSize: 14 , color: Colors .grey),
111+ ),
86112 ],
87113 ),
88114 ),
89115 ],
90116 ),
91117 Padding (
92118 padding: const EdgeInsets .all (8.0 ),
93- child: Text (episode.description,maxLines: 3 , style: TextStyle (fontSize: 14 ,color: Colors .grey,overflow: TextOverflow .ellipsis)),
119+ child: Text (episode.description,
120+ maxLines: 3 ,
121+ style: TextStyle (
122+ fontSize: 14 ,
123+ color: Colors .grey,
124+ overflow: TextOverflow .ellipsis)),
94125 ),
95126 ],
96127 ),
97128 ),
98129 );
99130 }
100- }
131+ }
0 commit comments