Skip to content

Commit

Permalink
use different page when app size changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryQuan committed Jan 5, 2022
1 parent 09bb96e commit 45629ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion project/lib/ui/page/EpisodePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:animego/ui/page/AnimeDetailPage.dart';
import 'package:animego/ui/page/CategoryPage.dart';
import 'package:animego/ui/page/VideoPlayerPage.dart';
import 'package:animego/ui/page/WatchAnimePage.dart';
import 'package:animego/ui/page/tablet/TabletAnimePage.dart';
import 'package:animego/ui/widget/LoadingSwitcher.dart';
import 'package:animego/ui/widget/SearchAnimeButton.dart';
import 'package:android_intent/android_intent.dart';
Expand Down Expand Up @@ -179,7 +180,11 @@ class _EpisodePageState extends State<EpisodePage>
context,
Util.platformPageRoute(
// this is only visible on mobile so no need to go to tablet page
builder: (context) => AnimeDetailPage(info: info),
builder: (context) {
if (Util(context).isTablet())
return TabletAnimePage(info: info);
return AnimeDetailPage(info: info);
},
),
);
},
Expand Down Expand Up @@ -350,6 +355,7 @@ class _EpisodePageState extends State<EpisodePage>
return VideoPlayerPage(
videoLink: e.link,
refererLink: e.referrer,
title: info?.episodeName,
);
}),
);
Expand Down
8 changes: 5 additions & 3 deletions project/lib/ui/page/VideoPlayerPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import 'package:video_player/video_player.dart';
class VideoPlayerPage extends StatefulWidget {
const VideoPlayerPage({
Key? key,
this.refererLink,
required this.videoLink,
this.refererLink,
this.title,
}) : super(key: key);

final String? refererLink;
final String? videoLink;
final String? title;

@override
_VideoPlayerPageState createState() => _VideoPlayerPageState();
Expand Down Expand Up @@ -60,10 +62,10 @@ class _VideoPlayerPageState extends State<VideoPlayerPage>
return Scaffold(
appBar: Util.isIOS()
? AppBar(
title: Text('Video Player'),
title: Text(widget.title ?? 'Video Player'),
)
: null,
body: Container(
body: SafeArea(
child: FlickVideoPlayer(
flickManager: flickManager,
// force landscape
Expand Down

0 comments on commit 45629ce

Please sign in to comment.