Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-23 12:20:47 +08:00
parent f220db96ed
commit 07e34eb17b
6 changed files with 91 additions and 96 deletions

View File

@@ -52,11 +52,11 @@ class HtmlRenderController extends ReplyController<MainListReply> {
}); });
DynamicsHttp.articleInfo(cvId: id.substring(2)).then((res) { DynamicsHttp.articleInfo(cvId: id.substring(2)).then((res) {
if (res['status']) { if (res['status']) {
favStat.value = { favStat.addAll({
'status': true, 'status': true,
'isFav': res['data']?['favorite'] ?? false, 'isFav': res['data']?['favorite'] ?? false,
'favNum': res['data']?['stats']?['favorite'] ?? 0, 'favNum': res['data']?['stats']?['favorite'] ?? 0,
}; });
} }
}); });
} else { } else {
@@ -85,11 +85,11 @@ class HtmlRenderController extends ReplyController<MainListReply> {
if (res != null) { if (res != null) {
type = res['commentType']; type = res['commentType'];
if (res['favorite'] != null) { if (res['favorite'] != null) {
favStat.value = { favStat.addAll({
'status': true, 'status': true,
'isFav': res['favorite']['status'] ?? false, 'isFav': res['favorite']['status'] ?? false,
'favNum': res['favorite']['count'] ?? 0, 'favNum': res['favorite']['count'] ?? 0,
}; });
} }
} }
} else { } else {

View File

@@ -23,7 +23,7 @@ class LoginPageController extends GetxController
final TextEditingController smsCodeTextController = TextEditingController(); final TextEditingController smsCodeTextController = TextEditingController();
final TextEditingController cookieTextController = TextEditingController(); final TextEditingController cookieTextController = TextEditingController();
Rx<Map<String, dynamic>> codeInfo = Rx<Map<String, dynamic>>({}); RxMap<String, dynamic> codeInfo = RxMap<String, dynamic>({});
late TabController tabController; late TabController tabController;
@@ -31,7 +31,7 @@ class LoginPageController extends GetxController
CaptchaDataModel captchaData = CaptchaDataModel(); CaptchaDataModel captchaData = CaptchaDataModel();
RxInt qrCodeLeftTime = 180.obs; RxInt qrCodeLeftTime = 180.obs;
Rx<String> statusQRCode = ''.obs; RxString statusQRCode = ''.obs;
Map<String, dynamic> selectedCountryCodeId = Map<String, dynamic> selectedCountryCodeId =
Constants.internationalDialingPrefix.first; Constants.internationalDialingPrefix.first;
@@ -68,8 +68,7 @@ class LoginPageController extends GetxController
LoginHttp.getHDcode().then((res) { LoginHttp.getHDcode().then((res) {
if (res['status']) { if (res['status']) {
qrCodeTimer?.cancel(); qrCodeTimer?.cancel();
codeInfo.value = res; codeInfo.addAll(res);
codeInfo.refresh();
qrCodeTimer = Timer.periodic(const Duration(milliseconds: 1000), (t) { qrCodeTimer = Timer.periodic(const Duration(milliseconds: 1000), (t) {
qrCodeLeftTime.value = 180 - t.tick; qrCodeLeftTime.value = 180 - t.tick;
if (qrCodeLeftTime <= 0) { if (qrCodeLeftTime <= 0) {
@@ -79,8 +78,7 @@ class LoginPageController extends GetxController
return; return;
} }
LoginHttp.codePoll(codeInfo.value['data']['auth_code']) LoginHttp.codePoll(codeInfo['data']['auth_code']).then((value) async {
.then((value) async {
if (value['status']) { if (value['status']) {
t.cancel(); t.cancel();
statusQRCode.value = '扫码成功'; statusQRCode.value = '扫码成功';

View File

@@ -80,7 +80,7 @@ class _LoginPageState extends State<LoginPage> {
RepaintBoundary( RepaintBoundary(
key: globalKey, key: globalKey,
child: Obx(() { child: Obx(() {
if (_loginPageCtr.codeInfo.value['data']?['url'] == null) { if (_loginPageCtr.codeInfo['data']?['url'] == null) {
return Container( return Container(
height: 200, height: 200,
width: 200, width: 200,
@@ -96,7 +96,7 @@ class _LoginPageState extends State<LoginPage> {
color: Colors.white, color: Colors.white,
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: PrettyQrView.data( child: PrettyQrView.data(
data: _loginPageCtr.codeInfo.value['data']!['url']!, data: _loginPageCtr.codeInfo['data']!['url']!,
decoration: PrettyQrDecoration( decoration: PrettyQrDecoration(
shape: PrettyQrRoundedSymbol( shape: PrettyQrRoundedSymbol(
color: Colors.black87, color: Colors.black87,
@@ -116,14 +116,13 @@ class _LoginPageState extends State<LoginPage> {
Obx(() => GestureDetector( Obx(() => GestureDetector(
onTap: () { onTap: () {
// 复制到剪贴板 // 复制到剪贴板
Utils.copyText( Utils.copyText(_loginPageCtr.codeInfo['data']?['url'] ?? '',
_loginPageCtr.codeInfo.value['data']?['url'] ?? '',
toastText: '已复制到剪贴板可粘贴至已登录的app私信处发送然后点击已发送的链接打开'); toastText: '已复制到剪贴板可粘贴至已登录的app私信处发送然后点击已发送的链接打开');
}, },
child: Padding( child: Padding(
padding: padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 20), const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: Text(_loginPageCtr.codeInfo.value['data']?['url'] ?? "", child: Text(_loginPageCtr.codeInfo['data']?['url'] ?? "",
style: Theme.of(context).textTheme.labelSmall!.copyWith( style: Theme.of(context).textTheme.labelSmall!.copyWith(
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme

View File

@@ -50,8 +50,7 @@ class VideoIntroController extends GetxController {
Rx<VideoDetailData> videoDetail = VideoDetailData().obs; Rx<VideoDetailData> videoDetail = VideoDetailData().obs;
// up主粉丝数 // up主粉丝数
Rx<Map<String, dynamic>> userStat = RxMap<String, dynamic> userStat = RxMap<String, dynamic>({'follower': '-'});
Rx<Map<String, dynamic>>({'follower': '-'});
dynamic videoTags; dynamic videoTags;
@@ -82,8 +81,8 @@ class VideoIntroController extends GetxController {
Timer? timer; Timer? timer;
String heroTag = ''; String heroTag = '';
late ModelResult modelResult; late ModelResult modelResult;
Rx<Map<String, dynamic>> queryVideoIntroData = RxMap<String, dynamic> queryVideoIntroData =
Rx<Map<String, dynamic>>({"status": true}); RxMap<String, dynamic>({"status": true});
ExpandableController? expandableCtr; ExpandableController? expandableCtr;
@@ -181,7 +180,7 @@ class VideoIntroController extends GetxController {
SmartDialog.showToast( SmartDialog.showToast(
"${result['code']} ${result['msg']} ${result['data']}"); "${result['code']} ${result['msg']} ${result['data']}");
} }
queryVideoIntroData.value = result; queryVideoIntroData.addAll(result);
if (isLogin) { if (isLogin) {
queryAllStatus(); queryAllStatus();
queryFollowStatus(); queryFollowStatus();
@@ -207,10 +206,10 @@ class VideoIntroController extends GetxController {
}, },
).then((res) { ).then((res) {
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
staffRelations.value = { staffRelations.addAll({
'status': true, 'status': true,
if (res.data['data'] != null) ...res.data['data'], if (res.data['data'] != null) ...res.data['data'],
}; });
} }
}); });
} else { } else {
@@ -220,7 +219,7 @@ class VideoIntroController extends GetxController {
var result = var result =
await MemberHttp.memberCardInfo(mid: videoDetail.value.owner!.mid!); await MemberHttp.memberCardInfo(mid: videoDetail.value.owner!.mid!);
if (result['status']) { if (result['status']) {
userStat.value = result['data']; userStat.addAll(result['data']);
} }
} }
} }
@@ -349,7 +348,7 @@ class VideoIntroController extends GetxController {
} }
int copyright = int copyright =
(queryVideoIntroData.value['data'] as VideoDetailData?)?.copyright ?? 1; (queryVideoIntroData['data'] as VideoDetailData?)?.copyright ?? 1;
if ((copyright != 1 && _coinNum.value >= 1) || _coinNum.value >= 2) { if ((copyright != 1 && _coinNum.value >= 1) || _coinNum.value >= 2) {
SmartDialog.showToast('达到投币上限啦~'); SmartDialog.showToast('达到投币上限啦~');
return; return;

View File

@@ -298,18 +298,18 @@ class _VideoInfoState extends State<VideoInfo> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Obx(() => Avatar( Obx(() => Avatar(
avatar: videoIntroController.userStat avatar: videoIntroController
.value['card']?['face'] ?? .userStat['card']?['face'] ??
'', '',
size: 35, size: 35,
badgeSize: 14, badgeSize: 14,
isVip: (videoIntroController.userStat isVip: (videoIntroController
.value['card']?['vip'] .userStat['card']
?['status'] ?? ?['vip']?['status'] ??
-1) > -1) >
0, 0,
officialType: videoIntroController officialType: videoIntroController
.userStat.value['card'] .userStat['card']
?['official_verify']?['type'], ?['official_verify']?['type'],
// garbPendantImage: videoIntroController.userStat.value['card']?['pendant']?['image'], // garbPendantImage: videoIntroController.userStat.value['card']?['pendant']?['image'],
)), )),
@@ -320,23 +320,23 @@ class _VideoInfoState extends State<VideoInfo> {
children: [ children: [
Obx( Obx(
() => Text( () => Text(
videoIntroController.userStat videoIntroController
.value['card']?['name'] ?? .userStat['card']
?['name'] ??
"", "",
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: (videoIntroController.userStat color: (videoIntroController.userStat[
.value[ 'card']
'card']?['vip'] ?['vip']
?['status'] ?? ?['status'] ??
-1) > -1) >
0 && 0 &&
videoIntroController videoIntroController
.userStat .userStat[
.value['card'] 'card']?[
?[
'vip']?['type'] == 'vip']?['type'] ==
2 2
? context.vipColor ? context.vipColor
@@ -347,7 +347,7 @@ class _VideoInfoState extends State<VideoInfo> {
const SizedBox(height: 0), const SizedBox(height: 0),
Obx( Obx(
() => Text( () => Text(
'${Utils.numFormat(videoIntroController.userStat.value['follower'])}粉丝 ${videoIntroController.userStat.value['archive_count'] != null ? '${Utils.numFormat(videoIntroController.userStat.value['archive_count'])}视频' : ''}', '${Utils.numFormat(videoIntroController.userStat['follower'])}粉丝 ${videoIntroController.userStat['archive_count'] != null ? '${Utils.numFormat(videoIntroController.userStat['archive_count'])}视频' : ''}',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: color:
@@ -741,24 +741,23 @@ class _VideoInfoState extends State<VideoInfo> {
), ),
), ),
Obx( Obx(
() => () => videoIntroController.queryVideoIntroData["status"]
videoIntroController.queryVideoIntroData.value["status"] ? const SizedBox.shrink()
? const SizedBox.shrink() : Center(
: Center( child: TextButton.icon(
child: TextButton.icon( icon: const Icon(Icons.refresh),
icon: const Icon(Icons.refresh), onPressed: () {
onPressed: () { videoIntroController
videoIntroController.queryVideoIntroData .queryVideoIntroData["status"] = true;
.value["status"] = true; videoIntroController.queryVideoIntro();
videoIntroController.queryVideoIntro(); if (videoDetailCtr.videoUrl.isNullOrEmpty &&
if (videoDetailCtr.videoUrl.isNullOrEmpty && videoDetailCtr.isQuerying.not) {
videoDetailCtr.isQuerying.not) { videoDetailCtr.queryVideoUrl();
videoDetailCtr.queryVideoUrl(); }
} },
}, label: const Text("点此重新加载"),
label: const Text("点此重新加载"), ),
), ),
),
), ),
// 点赞收藏转发 布局样式2 // 点赞收藏转发 布局样式2
if (!isHorizontal) ...[ if (!isHorizontal) ...[

View File

@@ -63,40 +63,40 @@ class PlPlayerController {
final Rx<Duration> _buffered = Rx(Duration.zero); final Rx<Duration> _buffered = Rx(Duration.zero);
final RxInt bufferedSeconds = 0.obs; final RxInt bufferedSeconds = 0.obs;
final Rx<int> _playerCount = Rx(0); final RxInt _playerCount = 0.obs;
late double lastPlaybackSpeed = 1.0; late double lastPlaybackSpeed = 1.0;
final Rx<double> _playbackSpeed = 1.0.obs; final RxDouble _playbackSpeed = 1.0.obs;
final Rx<double> _longPressSpeed = 2.0.obs; final RxDouble _longPressSpeed = 2.0.obs;
final Rx<double> _currentVolume = 1.0.obs; final RxDouble _currentVolume = 1.0.obs;
final Rx<double> _currentBrightness = (-1.0).obs; final RxDouble _currentBrightness = (-1.0).obs;
final Rx<bool> _mute = false.obs; final RxBool _mute = false.obs;
final Rx<bool> _showControls = false.obs; final RxBool _showControls = false.obs;
final Rx<bool> _showVolumeStatus = false.obs; final RxBool _showVolumeStatus = false.obs;
final Rx<bool> _showBrightnessStatus = false.obs; final RxBool _showBrightnessStatus = false.obs;
final Rx<bool> _longPressStatus = false.obs; final RxBool _longPressStatus = false.obs;
final Rx<bool> _controlsLock = false.obs; final RxBool _controlsLock = false.obs;
final Rx<bool> _isFullScreen = false.obs; final RxBool _isFullScreen = false.obs;
// 默认投稿视频格式 // 默认投稿视频格式
static Rx<String> _videoType = 'archive'.obs; static RxString _videoType = 'archive'.obs;
final Rx<String> _direction = 'horizontal'.obs; final RxString _direction = 'horizontal'.obs;
final Rx<BoxFit> _videoFit = Rx(videoFitType[1]['attr']); final Rx<BoxFit> _videoFit = Rx(videoFitType[1]['attr']);
final Rx<String> _videoFitDesc = Rx(videoFitType[1]['desc']); final RxString _videoFitDesc = videoFitType[1]['desc'].obs;
late StreamSubscription<DataStatus> _dataListenerForVideoFit; late StreamSubscription<DataStatus> _dataListenerForVideoFit;
late StreamSubscription<DataStatus> _dataListenerForEnterFullscreen; late StreamSubscription<DataStatus> _dataListenerForEnterFullscreen;
/// 后台播放 /// 后台播放
late final Rx<bool> _continuePlayInBackground = false.obs; late final RxBool _continuePlayInBackground = false.obs;
late final Rx<bool> _flipX = false.obs; late final RxBool _flipX = false.obs;
late final Rx<bool> _flipY = false.obs; late final RxBool _flipY = false.obs;
/// ///
final Rx<bool> _isSliderMoving = false.obs; final RxBool _isSliderMoving = false.obs;
PlaylistMode _looping = PlaylistMode.none; PlaylistMode _looping = PlaylistMode.none;
bool _autoPlay = false; bool _autoPlay = false;
final bool _listenersInitialized = false; final bool _listenersInitialized = false;
@@ -165,7 +165,7 @@ class PlPlayerController {
Stream<Duration> get onBufferedChanged => _buffered.stream; Stream<Duration> get onBufferedChanged => _buffered.stream;
// 视频静音 // 视频静音
Rx<bool> get mute => _mute; RxBool get mute => _mute;
Stream<bool> get onMuteChanged => _mute.stream; Stream<bool> get onMuteChanged => _mute.stream;
/// [videoPlayerController] instance of Player /// [videoPlayerController] instance of Player
@@ -174,7 +174,7 @@ class PlPlayerController {
/// [videoController] instance of Player /// [videoController] instance of Player
VideoController? get videoController => _videoController; VideoController? get videoController => _videoController;
Rx<bool> get isSliderMoving => _isSliderMoving; RxBool get isSliderMoving => _isSliderMoving;
/// 进度条位置及监听 /// 进度条位置及监听
Rx<Duration> get sliderPosition => _sliderPosition; Rx<Duration> get sliderPosition => _sliderPosition;
@@ -184,24 +184,24 @@ class PlPlayerController {
// Stream<Duration> get onSliderPositionChanged => _sliderPosition.stream; // Stream<Duration> get onSliderPositionChanged => _sliderPosition.stream;
/// 是否展示控制条及监听 /// 是否展示控制条及监听
Rx<bool> get showControls => _showControls; RxBool get showControls => _showControls;
Stream<bool> get onShowControlsChanged => _showControls.stream; Stream<bool> get onShowControlsChanged => _showControls.stream;
/// 音量控制条展示/隐藏 /// 音量控制条展示/隐藏
Rx<bool> get showVolumeStatus => _showVolumeStatus; RxBool get showVolumeStatus => _showVolumeStatus;
Stream<bool> get onShowVolumeStatusChanged => _showVolumeStatus.stream; Stream<bool> get onShowVolumeStatusChanged => _showVolumeStatus.stream;
/// 亮度控制条展示/隐藏 /// 亮度控制条展示/隐藏
Rx<bool> get showBrightnessStatus => _showBrightnessStatus; RxBool get showBrightnessStatus => _showBrightnessStatus;
Stream<bool> get onShowBrightnessStatusChanged => Stream<bool> get onShowBrightnessStatusChanged =>
_showBrightnessStatus.stream; _showBrightnessStatus.stream;
/// 音量控制条 /// 音量控制条
Rx<double> get volume => _currentVolume; RxDouble get volume => _currentVolume;
Stream<double> get onVolumeChanged => _currentVolume.stream; Stream<double> get onVolumeChanged => _currentVolume.stream;
/// 亮度控制条 /// 亮度控制条
Rx<double> get brightness => _currentBrightness; RxDouble get brightness => _currentBrightness;
Stream<double> get onBrightnessChanged => _currentBrightness.stream; Stream<double> get onBrightnessChanged => _currentBrightness.stream;
/// 是否循环 /// 是否循环
@@ -212,40 +212,40 @@ class PlPlayerController {
/// 视频比例 /// 视频比例
Rx<BoxFit> get videoFit => _videoFit; Rx<BoxFit> get videoFit => _videoFit;
Rx<String> get videoFitDEsc => _videoFitDesc; RxString get videoFitDEsc => _videoFitDesc;
/// 后台播放 /// 后台播放
Rx<bool> get continuePlayInBackground => _continuePlayInBackground; RxBool get continuePlayInBackground => _continuePlayInBackground;
/// 听视频 /// 听视频
late final Rx<bool> onlyPlayAudio = false.obs; late final RxBool onlyPlayAudio = false.obs;
/// 镜像 /// 镜像
Rx<bool> get flipX => _flipX; RxBool get flipX => _flipX;
Rx<bool> get flipY => _flipY; RxBool get flipY => _flipY;
/// 是否长按倍速 /// 是否长按倍速
Rx<bool> get longPressStatus => _longPressStatus; RxBool get longPressStatus => _longPressStatus;
Rx<bool> isBuffering = true.obs; RxBool isBuffering = true.obs;
/// 屏幕锁 为true时关闭控制栏 /// 屏幕锁 为true时关闭控制栏
Rx<bool> get controlsLock => _controlsLock; RxBool get controlsLock => _controlsLock;
/// 全屏状态 /// 全屏状态
Rx<bool> get isFullScreen => _isFullScreen; RxBool get isFullScreen => _isFullScreen;
/// 全屏方向 /// 全屏方向
Rx<String> get direction => _direction; RxString get direction => _direction;
Rx<int> get playerCount => _playerCount; RxInt get playerCount => _playerCount;
/// ///
Rx<String> get videoType => _videoType; RxString get videoType => _videoType;
/// 弹幕开关 /// 弹幕开关
Rx<bool> isOpenDanmu = false.obs; RxBool isOpenDanmu = false.obs;
late final showFSActionItem = GStorage.showFSActionItem; late final showFSActionItem = GStorage.showFSActionItem;
late final enableShrinkVideoSize = GStorage.enableShrinkVideoSize; late final enableShrinkVideoSize = GStorage.enableShrinkVideoSize;