mod: 代码整理

This commit is contained in:
orz12
2024-02-27 13:44:28 +08:00
parent 71828bef14
commit e0fe2e29f2
14 changed files with 18 additions and 17 deletions

View File

@@ -184,8 +184,9 @@ class VideoDetailData {
: List<dynamic>.from(descV2!.map((e) => e.toJson())), : List<dynamic>.from(descV2!.map((e) => e.toJson())),
"state": state, "state": state,
"duration": duration, "duration": duration,
"rights": "rights": rights == null
Map.from(rights!).map((k, v) => MapEntry<String, dynamic>(k, v)), ? {}
: Map.from(rights!).map((k, v) => MapEntry<String, dynamic>(k, v)),
"owner": owner?.toJson(), "owner": owner?.toJson(),
"stat": stat?.toJson(), "stat": stat?.toJson(),
"dynamic": videoDynamic, "dynamic": videoDynamic,

View File

@@ -7,8 +7,8 @@ import 'package:PiliPalaX/utils/storage.dart';
class BangumiController extends GetxController { class BangumiController extends GetxController {
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
RxList<BangumiListItemModel> bangumiList = [BangumiListItemModel()].obs; RxList<BangumiListItemModel> bangumiList = <BangumiListItemModel>[].obs;
RxList<BangumiListItemModel> bangumiFollowList = [BangumiListItemModel()].obs; RxList<BangumiListItemModel> bangumiFollowList = <BangumiListItemModel>[].obs;
int _currentPage = 1; int _currentPage = 1;
bool isLoadingMore = true; bool isLoadingMore = true;
Box userInfoCache = GStrorage.userInfo; Box userInfoCache = GStrorage.userInfo;

View File

@@ -139,7 +139,7 @@ class BlackListController extends GetxController {
int currentPage = 1; int currentPage = 1;
int pageSize = 50; int pageSize = 50;
RxInt total = 0.obs; RxInt total = 0.obs;
RxList<BlackListItem> blackList = [BlackListItem()].obs; RxList<BlackListItem> blackList = <BlackListItem>[].obs;
Future queryBlacklist({type = 'init'}) async { Future queryBlacklist({type = 'init'}) async {
if (type == 'init') { if (type == 'init') {

View File

@@ -20,7 +20,7 @@ import 'package:PiliPalaX/utils/utils.dart';
class DynamicsController extends GetxController { class DynamicsController extends GetxController {
int page = 1; int page = 1;
String? offset = ''; String? offset = '';
RxList<DynamicItemModel> dynamicsList = [DynamicItemModel()].obs; RxList<DynamicItemModel> dynamicsList = <DynamicItemModel>[].obs;
Rx<DynamicsType> dynamicsType = DynamicsType.values[0].obs; Rx<DynamicsType> dynamicsType = DynamicsType.values[0].obs;
RxString dynamicsTypeLabel = '全部'.obs; RxString dynamicsTypeLabel = '全部'.obs;
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();

View File

@@ -17,7 +17,7 @@ class DynamicDetailController extends GetxController {
int currentPage = 0; int currentPage = 0;
bool isLoadingMore = false; bool isLoadingMore = false;
RxString noMore = ''.obs; RxString noMore = ''.obs;
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs; RxList<ReplyItemModel> replyList = <ReplyItemModel>[].obs;
RxInt acount = 0.obs; RxInt acount = 0.obs;
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();

View File

@@ -10,7 +10,7 @@ class FansController extends GetxController {
int pn = 1; int pn = 1;
int ps = 20; int ps = 20;
int total = 0; int total = 0;
RxList<FansItemModel> fansList = [FansItemModel()].obs; RxList<FansItemModel> fansList = <FansItemModel>[].obs;
late int mid; late int mid;
late String name; late String name;
var userInfo; var userInfo;

View File

@@ -7,7 +7,7 @@ class HotController extends GetxController {
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
final int _count = 20; final int _count = 20;
int _currentPage = 1; int _currentPage = 1;
RxList<HotVideoItemModel> videoList = [HotVideoItemModel()].obs; RxList<HotVideoItemModel> videoList = <HotVideoItemModel>[].obs;
bool isLoadingMore = false; bool isLoadingMore = false;
bool flag = false; bool flag = false;
OverlayEntry? popupDialog; OverlayEntry? popupDialog;

View File

@@ -43,8 +43,8 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
@override @override
void dispose() { void dispose() {
plPlayerController!.dispose();
floating?.dispose(); floating?.dispose();
plPlayerController!.dispose();
super.dispose(); super.dispose();
} }

View File

@@ -20,7 +20,7 @@ class MemberController extends GetxController {
Box userInfoCache = GStrorage.userInfo; Box userInfoCache = GStrorage.userInfo;
late int ownerMid; late int ownerMid;
// 投稿列表 // 投稿列表
RxList<VListItemModel>? archiveList = [VListItemModel()].obs; RxList<VListItemModel>? archiveList = <VListItemModel>[].obs;
dynamic userInfo; dynamic userInfo;
RxInt attribute = (-1).obs; RxInt attribute = (-1).obs;
RxString attributeText = '关注'.obs; RxString attributeText = '关注'.obs;

View File

@@ -15,7 +15,7 @@ class SSearchController extends GetxController {
Box histiryWord = GStrorage.historyword; Box histiryWord = GStrorage.historyword;
List historyCacheList = []; List historyCacheList = [];
RxList historyList = [].obs; RxList historyList = [].obs;
RxList<SearchSuggestItem> searchSuggestList = [SearchSuggestItem()].obs; RxList<SearchSuggestItem> searchSuggestList = <SearchSuggestItem>[].obs;
final _debouncer = final _debouncer =
Debouncer(delay: const Duration(milliseconds: 200)); // 设置延迟时间 Debouncer(delay: const Duration(milliseconds: 200)); // 设置延迟时间
String hintText = '搜索'; String hintText = '搜索';

View File

@@ -22,7 +22,7 @@ class VideoReplyController extends GetxController {
String? replyLevel; String? replyLevel;
// rpid 请求楼中楼回复 // rpid 请求楼中楼回复
String? rpid; String? rpid;
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs; RxList<ReplyItemModel> replyList = <ReplyItemModel>[].obs;
// 当前页 // 当前页
int currentPage = 0; int currentPage = 0;
bool isLoadingMore = false; bool isLoadingMore = false;

View File

@@ -268,7 +268,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
(value) => { (value) => {
// 完成评论,数据添加 // 完成评论,数据添加
if (value != null && value['data'] != null) if (value != null && value['data'] != null)
{_videoReplyController.replyList.add(value['data'])} {_videoReplyController.replyList.insert(0, value['data'])}
}, },
); );
}, },

View File

@@ -12,7 +12,7 @@ class VideoReplyReplyController extends GetxController {
// rpid 请求楼中楼回复 // rpid 请求楼中楼回复
String? rpid; String? rpid;
ReplyType replyType = ReplyType.video; ReplyType replyType = ReplyType.video;
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs; RxList<ReplyItemModel> replyList = <ReplyItemModel>[].obs;
// 当前页 // 当前页
int currentPage = 0; int currentPage = 0;
bool isLoadingMore = false; bool isLoadingMore = false;

View File

@@ -209,6 +209,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
@override @override
void dispose() { void dispose() {
videoDetailController.floating?.dispose();
floating.dispose();
if (!horizontalScreen) { if (!horizontalScreen) {
AutoOrientation.portraitUpMode(); AutoOrientation.portraitUpMode();
} }
@@ -218,9 +220,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
fullScreenStatusListener.cancel(); fullScreenStatusListener.cancel();
plPlayerController!.dispose(); plPlayerController!.dispose();
} }
videoDetailController.floating?.dispose();
videoPlayerServiceHandler.onVideoDetailDispose(); videoPlayerServiceHandler.onVideoDetailDispose();
floating.dispose();
_lifecycleListener.dispose(); _lifecycleListener.dispose();
showStatusBar(); showStatusBar();
super.dispose(); super.dispose();