diff --git a/lib/components/android/anime/home/coverCarousel.dart b/lib/components/android/anime/home/coverCarousel.dart index 3f366d8..1144dfd 100644 --- a/lib/components/android/anime/home/coverCarousel.dart +++ b/lib/components/android/anime/home/coverCarousel.dart @@ -59,6 +59,7 @@ class _CovercarouselState extends State { return Stack( children: [ Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ GestureDetector( onTap: () { diff --git a/lib/pages/Android/Rescue/Anime/details_page.dart b/lib/pages/Android/Rescue/Anime/details_page.dart index 7343705..7282aa8 100644 --- a/lib/pages/Android/Rescue/Anime/details_page.dart +++ b/lib/pages/Android/Rescue/Anime/details_page.dart @@ -2,8 +2,12 @@ import 'dart:convert'; import 'dart:developer'; +import 'dart:io'; import 'package:anymex/components/android/anime/details/episode_list.dart'; +import 'package:anymex/components/desktop/anime/episode_grid.dart'; +import 'package:anymex/components/platform_builder.dart'; import 'package:anymex/pages/Android/Anime/watch_page.dart'; +import 'package:anymex/pages/Desktop/watch_page.dart'; import 'package:anymex/utils/downloader/downloader.dart'; import 'package:anymex/utils/sources/anime/extensions/aniwatch/aniwatch.dart'; import 'package:anymex/utils/sources/anime/handler/sources_handler.dart'; @@ -433,26 +437,49 @@ class _RescueDetailsPageState extends State { if (episodeSrc != null) { Navigator.pop(context); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => WatchPage( - episodeSrc: episodeSrc ?? [], - episodeData: episodesData?['episodes'], - currentEpisode: currentEpisode, - episodeTitle: episodesData?['episodes'][currentEpisode - 1] - ['title'] ?? - '', - animeTitle: widget.title, - activeServer: activeServer, - isDub: isDub, - animeId: 0, - tracks: subtitleTracks, - provider: Theme.of(context), - sourceAnimeId: episodesData['id'] ?? 'rescue', - description: '', - posterImage: widget.posterUrl!, - ))); + if (!Platform.isAndroid && !Platform.isIOS) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => WatchPage( + episodeSrc: episodeSrc ?? [], + episodeData: episodesData?['episodes'], + currentEpisode: currentEpisode, + episodeTitle: episodesData?['episodes'] + [currentEpisode - 1]['title'] ?? + '', + animeTitle: widget.title, + activeServer: activeServer, + isDub: isDub, + animeId: 0, + tracks: subtitleTracks, + provider: Theme.of(context), + sourceAnimeId: episodesData['id'] ?? 'rescue', + description: '', + posterImage: widget.posterUrl!, + ))); + } else { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DesktopWatchPage( + episodeSrc: episodeSrc ?? [], + episodeData: episodesData?['episodes'], + currentEpisode: currentEpisode, + episodeTitle: episodesData?['episodes'] + [currentEpisode - 1]['title'] ?? + '', + animeTitle: widget.title, + activeServer: activeServer, + isDub: isDub, + animeId: 0, + tracks: subtitleTracks, + provider: Theme.of(context), + sourceAnimeId: episodesData['id'] ?? 'rescue', + description: '', + posterImage: widget.posterUrl!, + ))); + } } } @@ -541,7 +568,9 @@ class _RescueDetailsPageState extends State { width: MediaQuery.of(context).size.width, padding: EdgeInsets.all(20), decoration: BoxDecoration( - color: CustomScheme.surfaceContainer, + color: Platform.isAndroid + ? CustomScheme.surfaceContainer + : CustomScheme.surfaceContainerHighest, borderRadius: BorderRadius.only( topLeft: Radius.circular(40), topRight: Radius.circular(40), @@ -599,7 +628,6 @@ class _RescueDetailsPageState extends State { }, ), const SizedBox(height: 10), - Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -625,38 +653,71 @@ class _RescueDetailsPageState extends State { ], ), const SizedBox(height: 10), - - // Episode grid displaying filtered episodes - EpisodeGrid( - episodes: filteredEpisodes, - layoutIndex: layoutIndex, - currentEpisode: currentEpisode, - onEpisodeSelected: (int episode) { - setState(() { - currentEpisode = episode; - }); - selectServerDialog(context); - }, - progress: watchProgress, - coverImage: widget.posterUrl!, - onEpisodeDownload: (String episodeId, String episodeNumber) async { - showDownloadOptions( - isLoading: true, - server: '', - source: '', - sourcesData: [], - episodeNumber: '', - ); - final downloadMeta = await downloadHelper(episodeId); - Navigator.pop(context); - showDownloadOptions( - isLoading: false, - server: "MegaCloud", - source: "HiAnime (API)", - sourcesData: downloadMeta, - episodeNumber: "Episode-$episodeNumber", - ); - }, + PlatformBuilder( + androidBuilder: EpisodeGrid( + episodes: filteredEpisodes, + layoutIndex: layoutIndex, + currentEpisode: currentEpisode, + onEpisodeSelected: (int episode) { + setState(() { + currentEpisode = episode; + }); + selectServerDialog(context); + }, + progress: watchProgress, + coverImage: widget.posterUrl!, + onEpisodeDownload: + (String episodeId, String episodeNumber) async { + showDownloadOptions( + isLoading: true, + server: '', + source: '', + sourcesData: [], + episodeNumber: '', + ); + final downloadMeta = await downloadHelper(episodeId); + Navigator.pop(context); + showDownloadOptions( + isLoading: false, + server: "MegaCloud", + source: "HiAnime (API)", + sourcesData: downloadMeta, + episodeNumber: "Episode-$episodeNumber", + ); + }, + ), + desktopBuilder: DesktopEpisodeGrid( + episodes: filteredEpisodes, + layoutIndex: layoutIndex, + currentEpisode: currentEpisode, + onEpisodeSelected: (int episode) { + setState(() { + currentEpisode = episode; + }); + selectServerDialog(context); + }, + progress: watchProgress, + coverImage: widget.posterUrl!, + onEpisodeDownload: + (String episodeId, String episodeNumber) async { + showDownloadOptions( + isLoading: true, + server: '', + source: '', + sourcesData: [], + episodeNumber: '', + ); + final downloadMeta = await downloadHelper(episodeId); + Navigator.pop(context); + showDownloadOptions( + isLoading: false, + server: "MegaCloud", + source: "HiAnime (API)", + sourcesData: downloadMeta, + episodeNumber: "Episode-$episodeNumber", + ); + }, + ), ), const SizedBox(height: 100), ], @@ -678,29 +739,58 @@ class Poster extends StatelessWidget { return Center( child: Column( children: [ - Container( - margin: EdgeInsets.only(top: 30), - height: 400, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.10), - spreadRadius: 5, - blurRadius: 10, - offset: Offset(0, 7), + PlatformBuilder( + androidBuilder: Container( + margin: EdgeInsets.only(top: 30), + height: 400, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.10), + spreadRadius: 5, + blurRadius: 10, + offset: Offset(0, 7), + ), + ], + ), + width: MediaQuery.of(context).size.width - 100, + child: Hero( + tag: tag!, + child: ClipRRect( + borderRadius: BorderRadius.circular(20), + child: CachedNetworkImage( + imageUrl: poster!, + fit: BoxFit.cover, + alignment: Alignment.center, + ), ), - ], + ), ), - width: MediaQuery.of(context).size.width - 100, - child: Hero( - tag: tag!, - child: ClipRRect( + desktopBuilder: Container( + margin: EdgeInsets.only(top: 30), + height: 400, + decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - child: CachedNetworkImage( - imageUrl: poster!, - fit: BoxFit.cover, - alignment: Alignment.center, + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.10), + spreadRadius: 5, + blurRadius: 10, + offset: Offset(0, 7), + ), + ], + ), + width: 300, + child: Hero( + tag: tag!, + child: ClipRRect( + borderRadius: BorderRadius.circular(20), + child: CachedNetworkImage( + imageUrl: poster!, + fit: BoxFit.cover, + alignment: Alignment.center, + ), ), ), ), diff --git a/lib/pages/Android/Rescue/Anime/home_page.dart b/lib/pages/Android/Rescue/Anime/home_page.dart index 796edc6..bd368ce 100644 --- a/lib/pages/Android/Rescue/Anime/home_page.dart +++ b/lib/pages/Android/Rescue/Anime/home_page.dart @@ -46,33 +46,45 @@ class _RescueAnimeHomeState extends State { padding: const EdgeInsets.all(16.0), child: Column( children: [ - TextField( - controller: _controller, - onSubmitted: _performSearch, - decoration: InputDecoration( - labelText: 'Search Anime', - floatingLabelBehavior: FloatingLabelBehavior.auto, - filled: true, - fillColor: - Theme.of(context).colorScheme.surfaceContainerHigh, - suffixIcon: const Icon(Iconsax.search_normal), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide( - color: Theme.of(context).colorScheme.primary, - width: 1, - ), - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: const BorderSide( - color: Colors.transparent, - width: 1, + Row( + children: [ + IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: const Icon(Icons.arrow_back_ios_new)), + Expanded( + child: TextField( + controller: _controller, + onSubmitted: _performSearch, + decoration: InputDecoration( + labelText: 'Search Anime', + floatingLabelBehavior: FloatingLabelBehavior.auto, + filled: true, + fillColor: Theme.of(context) + .colorScheme + .surfaceContainerHigh, + suffixIcon: const Icon(Iconsax.search_normal), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + borderSide: BorderSide( + color: Theme.of(context).colorScheme.primary, + width: 1, + ), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + borderSide: const BorderSide( + color: Colors.transparent, + width: 1, + ), + ), + contentPadding: const EdgeInsets.symmetric( + vertical: 16, horizontal: 20), + ), ), ), - contentPadding: const EdgeInsets.symmetric( - vertical: 16, horizontal: 20), - ), + ], ), const SizedBox(height: 20), DropdownButtonFormField(