feat(flutter): 重构四 Tab 与浏览页
This commit is contained in:
1 parent
99c72e2c32
commit
959edc0a32
41 files changed
+2148
-1179
No files matched your search
@@ -69,7 +69,11 @@ class HomeLogic extends ChangeNotifier {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> playDrama(BuildContext context, Drama drama) async {
|
||||
Future<void> playDrama(
|
||||
BuildContext context,
|
||||
Drama drama, {
|
||||
String? episodeId,
|
||||
}) async {
|
||||
// 列表卡片只有一集预览,进入播放前补齐完整剧集,否则选集列表是空的。
|
||||
var playable = drama;
|
||||
try {
|
||||
@@ -78,11 +82,14 @@ class HomeLogic extends ChangeNotifier {
|
||||
// 取详情失败就用卡片自带的那一集起播。
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).push(
|
||||
final index = episodeId == null
|
||||
? 0
|
||||
: playable.episodes.indexWhere((episode) => episode.id == episodeId);
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => PlayerPage(
|
||||
drama: playable,
|
||||
initialIndex: 0,
|
||||
initialIndex: index < 0 ? 0 : index,
|
||||
wallet: context.read<WalletController>(),
|
||||
downloads: context.read<DownloadController>(),
|
||||
),
|
||||
@@ -90,14 +97,16 @@ class HomeLogic extends ChangeNotifier {
|
||||
);
|
||||
}
|
||||
|
||||
void openProfile() => select(2);
|
||||
void openProfile() => select(3);
|
||||
|
||||
void discoverAction(DiscoverPageAction action) {
|
||||
switch (action) {
|
||||
case DiscoverPageAction.home:
|
||||
select(0);
|
||||
case DiscoverPageAction.my:
|
||||
case DiscoverPageAction.create:
|
||||
select(2);
|
||||
case DiscoverPageAction.my:
|
||||
select(3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +128,8 @@ class HomeLogic extends ChangeNotifier {
|
||||
select(0);
|
||||
case MyPageAction.discover:
|
||||
select(1, search: true);
|
||||
case MyPageAction.create:
|
||||
select(2);
|
||||
case MyPageAction.resume:
|
||||
select(0, resume: true);
|
||||
}
|
||||
@@ -128,8 +139,8 @@ class HomeLogic extends ChangeNotifier {
|
||||
if (videoImmersive) {
|
||||
backRequest++;
|
||||
notify();
|
||||
} else if (tab != 1) {
|
||||
select(1);
|
||||
} else if (tab != 0) {
|
||||
select(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user