Skip to content

Commit

Permalink
anime search bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sunder-kirei committed Feb 23, 2023
1 parent 5027030 commit 13caf71
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/helpers/http_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ class HttpHelper {
static Future<Map<String, dynamic>> 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<String, dynamic>;
}
Expand Down
8 changes: 8 additions & 0 deletions lib/screens/details_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ class _DetailsScreenState extends State<DetailsScreen>
CustomRoute(
builder: (context) {
return VideoPlayerScreen(
season: fetchedData!["season"]
?.toString()
.trim()
.toLowerCase(),
releasedYear: fetchedData!["releaseDate"],
title: fetchedData!["title"],
gogoDetails: fetchedData!["episodes"],
Expand Down Expand Up @@ -262,6 +266,10 @@ class _DetailsScreenState extends State<DetailsScreen>
onTap: () => Navigator.of(context).push(
CustomRoute(
builder: (context) => VideoPlayerScreen(
season: fetchedData!["season"]
?.toString()
.trim()
.toLowerCase(),
releasedYear: fetchedData!["releaseDate"],
title: fetchedData!["title"],
gogoDetails: fetchedData!["episodes"],
Expand Down
3 changes: 3 additions & 0 deletions lib/screens/video_player_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class VideoPlayerScreen extends StatefulWidget {
final int position;
final Map<String, dynamic> title;
final int releasedYear;
final String? season;
const VideoPlayerScreen({
super.key,
required this.id,
Expand All @@ -29,6 +30,7 @@ class VideoPlayerScreen extends StatefulWidget {
this.position = 0,
required this.title,
required this.releasedYear,
this.season,
});
static const routeName = "/watch";

Expand All @@ -48,6 +50,7 @@ class _VideoPlayerScreenState extends State<VideoPlayerScreen> {
final result = await HttpHelper.getEpisodeList(
title: widget.title["romaji"] ?? "",
releasedYear: widget.releasedYear,
season: widget.season,
);
if (result["error"] != null) {
setState(() {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 13caf71

Please sign in to comment.