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) {
if (res['status']) {
favStat.value = {
favStat.addAll({
'status': true,
'isFav': res['data']?['favorite'] ?? false,
'favNum': res['data']?['stats']?['favorite'] ?? 0,
};
});
}
});
} else {
@@ -85,11 +85,11 @@ class HtmlRenderController extends ReplyController<MainListReply> {
if (res != null) {
type = res['commentType'];
if (res['favorite'] != null) {
favStat.value = {
favStat.addAll({
'status': true,
'isFav': res['favorite']['status'] ?? false,
'favNum': res['favorite']['count'] ?? 0,
};
});
}
}
} else {

View File

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

View File

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

View File

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

View File

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

View File

@@ -63,40 +63,40 @@ class PlPlayerController {
final Rx<Duration> _buffered = Rx(Duration.zero);
final RxInt bufferedSeconds = 0.obs;
final Rx<int> _playerCount = Rx(0);
final RxInt _playerCount = 0.obs;
late double lastPlaybackSpeed = 1.0;
final Rx<double> _playbackSpeed = 1.0.obs;
final Rx<double> _longPressSpeed = 2.0.obs;
final Rx<double> _currentVolume = 1.0.obs;
final Rx<double> _currentBrightness = (-1.0).obs;
final RxDouble _playbackSpeed = 1.0.obs;
final RxDouble _longPressSpeed = 2.0.obs;
final RxDouble _currentVolume = 1.0.obs;
final RxDouble _currentBrightness = (-1.0).obs;
final Rx<bool> _mute = false.obs;
final Rx<bool> _showControls = false.obs;
final Rx<bool> _showVolumeStatus = false.obs;
final Rx<bool> _showBrightnessStatus = false.obs;
final Rx<bool> _longPressStatus = false.obs;
final Rx<bool> _controlsLock = false.obs;
final Rx<bool> _isFullScreen = false.obs;
final RxBool _mute = false.obs;
final RxBool _showControls = false.obs;
final RxBool _showVolumeStatus = false.obs;
final RxBool _showBrightnessStatus = false.obs;
final RxBool _longPressStatus = false.obs;
final RxBool _controlsLock = 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<String> _videoFitDesc = Rx(videoFitType[1]['desc']);
final RxString _videoFitDesc = videoFitType[1]['desc'].obs;
late StreamSubscription<DataStatus> _dataListenerForVideoFit;
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;
bool _autoPlay = false;
final bool _listenersInitialized = false;
@@ -165,7 +165,7 @@ class PlPlayerController {
Stream<Duration> get onBufferedChanged => _buffered.stream;
// 视频静音
Rx<bool> get mute => _mute;
RxBool get mute => _mute;
Stream<bool> get onMuteChanged => _mute.stream;
/// [videoPlayerController] instance of Player
@@ -174,7 +174,7 @@ class PlPlayerController {
/// [videoController] instance of Player
VideoController? get videoController => _videoController;
Rx<bool> get isSliderMoving => _isSliderMoving;
RxBool get isSliderMoving => _isSliderMoving;
/// 进度条位置及监听
Rx<Duration> get sliderPosition => _sliderPosition;
@@ -184,24 +184,24 @@ class PlPlayerController {
// Stream<Duration> get onSliderPositionChanged => _sliderPosition.stream;
/// 是否展示控制条及监听
Rx<bool> get showControls => _showControls;
RxBool get showControls => _showControls;
Stream<bool> get onShowControlsChanged => _showControls.stream;
/// 音量控制条展示/隐藏
Rx<bool> get showVolumeStatus => _showVolumeStatus;
RxBool get showVolumeStatus => _showVolumeStatus;
Stream<bool> get onShowVolumeStatusChanged => _showVolumeStatus.stream;
/// 亮度控制条展示/隐藏
Rx<bool> get showBrightnessStatus => _showBrightnessStatus;
RxBool get showBrightnessStatus => _showBrightnessStatus;
Stream<bool> get onShowBrightnessStatusChanged =>
_showBrightnessStatus.stream;
/// 音量控制条
Rx<double> get volume => _currentVolume;
RxDouble get volume => _currentVolume;
Stream<double> get onVolumeChanged => _currentVolume.stream;
/// 亮度控制条
Rx<double> get brightness => _currentBrightness;
RxDouble get brightness => _currentBrightness;
Stream<double> get onBrightnessChanged => _currentBrightness.stream;
/// 是否循环
@@ -212,40 +212,40 @@ class PlPlayerController {
/// 视频比例
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时关闭控制栏
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 enableShrinkVideoSize = GStorage.enableShrinkVideoSize;