feat: 添加logo,修复部分ui
This commit is contained in:
1 parent
a3426831ed
commit
a3f489abe2
18 files changed
+263
-124
No files matched your search
@@ -3,6 +3,7 @@ import 'package:novyronst/common/api/user_request.dart';
|
||||
import 'package:novyronst/common/help/app_nav.dart';
|
||||
import 'package:novyronst/common/help/help_image.dart';
|
||||
import 'package:novyronst/common/help/help_token.dart';
|
||||
import 'package:novyronst/root/lib_export.dart';
|
||||
import 'package:novyronst/root/root_page.dart';
|
||||
|
||||
class LauncherPage extends StatefulWidget {
|
||||
@@ -27,7 +28,7 @@ class _LauncherPageState extends State<LauncherPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: HelpImage.asset(ConstImage.launcher, fit: BoxFit.cover),
|
||||
body: HelpImage.asset(ConstImage.launcher, height: AppScreen.screenHeight, fit: BoxFit.cover),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:novyronst/common/api/user_request.dart';
|
||||
import 'package:novyronst/common/const/const_color.dart';
|
||||
import 'package:novyronst/common/model/ny_drama_model.dart';
|
||||
import 'package:novyronst/tools/widgets/novy_com_widget.dart';
|
||||
@@ -35,6 +36,7 @@ class _PlayerViewState extends State<PlayerView> {
|
||||
late final PageController _pageController;
|
||||
final Map<int, VideoPlayerController> _controllers = {};
|
||||
final Map<int, Future<VideoPlayerController?>> _initializingControllers = {};
|
||||
final Set<String> _reportedHistoryKeys = {};
|
||||
int _currentIndex = 0;
|
||||
|
||||
@override
|
||||
@@ -142,6 +144,7 @@ class _PlayerViewState extends State<PlayerView> {
|
||||
isPageActive: widget.isActive,
|
||||
)) {
|
||||
await controller.play();
|
||||
_reportHistory(index);
|
||||
}
|
||||
} catch (_) {
|
||||
if (_controllers[index] == controller) {
|
||||
@@ -181,6 +184,7 @@ class _PlayerViewState extends State<PlayerView> {
|
||||
isPageActive: widget.isActive,
|
||||
)) {
|
||||
await controller.play();
|
||||
_reportHistory(_currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +228,25 @@ class _PlayerViewState extends State<PlayerView> {
|
||||
!controller.value.isInitialized) {
|
||||
return;
|
||||
}
|
||||
controller.value.isPlaying ? controller.pause() : controller.play();
|
||||
if (controller.value.isPlaying) {
|
||||
controller.pause();
|
||||
} else {
|
||||
controller.play();
|
||||
_reportHistory(_currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void _reportHistory(int index) {
|
||||
if (index < 0 || index >= widget.videos.length) return;
|
||||
|
||||
final ids = resolvePlayerHistoryIds(widget.videos[index]);
|
||||
if (ids == null || _reportedHistoryKeys.contains(ids.key)) return;
|
||||
|
||||
_reportedHistoryKeys.add(ids.key);
|
||||
UserRequest.eventCreateHistory(
|
||||
shortPlayId: ids.shortPlayId,
|
||||
videoId: ids.videoId,
|
||||
).catchError((_) {});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -523,3 +545,23 @@ double resolvePlayerMetaBottom({
|
||||
}) {
|
||||
return safeAreaBottom + bottomSpacing;
|
||||
}
|
||||
|
||||
class PlayerHistoryIds {
|
||||
const PlayerHistoryIds({required this.shortPlayId, required this.videoId});
|
||||
|
||||
final String shortPlayId;
|
||||
final String videoId;
|
||||
|
||||
String get key => '$shortPlayId:$videoId';
|
||||
}
|
||||
|
||||
PlayerHistoryIds? resolvePlayerHistoryIds(NyDramaModel drama) {
|
||||
final shortPlayId = drama.shortPlayId ?? drama.shortId;
|
||||
final videoId = drama.shortPlayVideoId ?? drama.id;
|
||||
if (videoId == null) return null;
|
||||
|
||||
return PlayerHistoryIds(
|
||||
shortPlayId: shortPlayId.toString(),
|
||||
videoId: videoId.toString(),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user