fix: 未登录状态页面显示异常

This commit is contained in:
guozhigq
2023-07-16 20:43:21 +08:00
parent a0427c672b
commit facfa0d11e
5 changed files with 17 additions and 4 deletions

View File

@ -166,7 +166,7 @@ class _DynamicsPageState extends State<DynamicsPage>
bottom: 0,
child: Align(
alignment: Alignment.center,
child: user.get(UserBoxKey.userLogin)
child: user.get(UserBoxKey.userLogin) ?? false
? GestureDetector(
onTap: () => showModalBottomSheet(
context: context,

View File

@ -18,7 +18,7 @@ class MemberController extends GetxController {
void onInit() {
super.onInit();
mid = int.parse(Get.parameters['mid']!);
ownerMid = user.get(UserBoxKey.userMid);
ownerMid = user.get(UserBoxKey.userMid) ?? -1;
face = Get.arguments['face'] ?? '';
heroTag = Get.arguments['heroTag'] ?? '';
}

View File

@ -4,11 +4,13 @@ import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_meedu_media_kit/meedu_player.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/constants.dart';
import 'package:pilipala/http/video.dart';
import 'package:pilipala/models/video/play/url.dart';
import 'package:pilipala/models/video/reply/item.dart';
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
import 'package:pilipala/utils/storage.dart';
class VideoDetailController extends GetxController
with GetSingleTickerProviderStateMixin {
@ -50,6 +52,7 @@ class VideoDetailController extends GetxController
Timer? timer;
RxString bgCover = ''.obs;
Box user = GStrorage.user;
@override
void onInit() {
@ -140,6 +143,9 @@ class VideoDetailController extends GetxController
}
void markHeartBeat() async {
if (user.get(UserBoxKey.userMid) == null) {
return;
}
Duration progress = meeduPlayerController.position.value;
await VideoHttp.heartBeat(
bvid: bvid,

View File

@ -324,8 +324,11 @@ class VideoIntroController extends GetxController {
// 关注/取关up
Future actionRelationMod() async {
if (user.get(UserBoxKey.userMid) == null) {
SmartDialog.showToast('账号未登录');
return;
}
int currentStatus = followStatus['attribute'];
print(currentStatus);
int actionStatus = 0;
switch (currentStatus) {
case 0:

View File

@ -423,7 +423,11 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
? '关注'
: '已关注'),
)
: const SizedBox(),
: ElevatedButton(
onPressed: () => videoIntroController
.actionRelationMod(),
child: const Text('关注'),
),
),
),
),