From 13caf71aec59ab34019a8ead4e0bd214cba4c382 Mon Sep 17 00:00:00 2001 From: Sunder Kumar Date: Thu, 23 Feb 2023 15:01:45 +0530 Subject: [PATCH] anime search bug --- lib/helpers/http_helper.dart | 3 ++- lib/screens/details_screen.dart | 8 ++++++++ lib/screens/video_player_screen.dart | 3 +++ pubspec.yaml | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/helpers/http_helper.dart b/lib/helpers/http_helper.dart index c36c71b..d856552 100644 --- a/lib/helpers/http_helper.dart +++ b/lib/helpers/http_helper.dart @@ -41,8 +41,9 @@ class HttpHelper { static Future> getEpisodeList({ required String title, required int releasedYear, + String? season = "unknown", }) async { - final url = Uri.https(baseUrl, "$title/$releasedYear"); + final url = Uri.https(baseUrl, "$title/$releasedYear/$season"); final response = await http.get(url); return json.decode(response.body) as Map; } diff --git a/lib/screens/details_screen.dart b/lib/screens/details_screen.dart index 780b249..f40cfc5 100644 --- a/lib/screens/details_screen.dart +++ b/lib/screens/details_screen.dart @@ -173,6 +173,10 @@ class _DetailsScreenState extends State CustomRoute( builder: (context) { return VideoPlayerScreen( + season: fetchedData!["season"] + ?.toString() + .trim() + .toLowerCase(), releasedYear: fetchedData!["releaseDate"], title: fetchedData!["title"], gogoDetails: fetchedData!["episodes"], @@ -262,6 +266,10 @@ class _DetailsScreenState extends State onTap: () => Navigator.of(context).push( CustomRoute( builder: (context) => VideoPlayerScreen( + season: fetchedData!["season"] + ?.toString() + .trim() + .toLowerCase(), releasedYear: fetchedData!["releaseDate"], title: fetchedData!["title"], gogoDetails: fetchedData!["episodes"], diff --git a/lib/screens/video_player_screen.dart b/lib/screens/video_player_screen.dart index f86dfbb..fb29595 100644 --- a/lib/screens/video_player_screen.dart +++ b/lib/screens/video_player_screen.dart @@ -20,6 +20,7 @@ class VideoPlayerScreen extends StatefulWidget { final int position; final Map title; final int releasedYear; + final String? season; const VideoPlayerScreen({ super.key, required this.id, @@ -29,6 +30,7 @@ class VideoPlayerScreen extends StatefulWidget { this.position = 0, required this.title, required this.releasedYear, + this.season, }); static const routeName = "/watch"; @@ -48,6 +50,7 @@ class _VideoPlayerScreenState extends State { final result = await HttpHelper.getEpisodeList( title: widget.title["romaji"] ?? "", releasedYear: widget.releasedYear, + season: widget.season, ); if (result["error"] != null) { setState(() { diff --git a/pubspec.yaml b/pubspec.yaml index bb41b84..40679d6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 3.1.1+1 +version: 3.1.2+1 environment: sdk: ">=2.18.6 <3.0.0"