mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-24 20:35:50 +08:00
@@ -103,7 +103,7 @@ abstract class CommonIntroController extends GetxController
|
||||
if (!isShowOnlineTotal) {
|
||||
return;
|
||||
}
|
||||
var result = await VideoHttp.onlineTotal(
|
||||
final result = await VideoHttp.onlineTotal(
|
||||
aid: IdUtils.bv2av(bvid),
|
||||
bvid: bvid,
|
||||
cid: cid.value,
|
||||
@@ -124,7 +124,7 @@ abstract class CommonIntroController extends GetxController
|
||||
if (stat == null) {
|
||||
return;
|
||||
}
|
||||
var res = await VideoHttp.coinVideo(
|
||||
final res = await VideoHttp.coinVideo(
|
||||
bvid: bvid,
|
||||
multiply: coin,
|
||||
selectLike: selectLike ? 1 : 0,
|
||||
@@ -149,7 +149,7 @@ abstract class CommonIntroController extends GetxController
|
||||
}
|
||||
|
||||
Future<void> viewLater() async {
|
||||
var res = await (hasLater.value
|
||||
final res = await (hasLater.value
|
||||
? UserHttp.toViewDel(aids: IdUtils.bv2av(bvid).toString())
|
||||
: UserHttp.toViewLater(bvid: bvid));
|
||||
if (res['status']) hasLater.value = !hasLater.value;
|
||||
@@ -230,7 +230,7 @@ mixin FavMixin on TripleMixin {
|
||||
queryVideoInFolder().then((res) async {
|
||||
if (res.isSuccess) {
|
||||
final hasFav = this.hasFav.value;
|
||||
var result = hasFav
|
||||
final result = hasFav
|
||||
? await FavHttp.unfavAll(rid: rid, type: type)
|
||||
: await FavHttp.favVideo(
|
||||
resources: '$rid:$type',
|
||||
@@ -254,7 +254,7 @@ mixin FavMixin on TripleMixin {
|
||||
List<int?> addMediaIdsNew = [];
|
||||
List<int?> delMediaIdsNew = [];
|
||||
try {
|
||||
for (var i in favFolderData.value.list!) {
|
||||
for (final i in favFolderData.value.list!) {
|
||||
bool isFaved = favIds?.contains(i.id) == true;
|
||||
if (i.favState == 1) {
|
||||
if (!isFaved) {
|
||||
@@ -270,7 +270,7 @@ mixin FavMixin on TripleMixin {
|
||||
if (kDebugMode) debugPrint(e.toString());
|
||||
}
|
||||
SmartDialog.showLoading(msg: '请求中');
|
||||
var result = await FavHttp.favVideo(
|
||||
final result = await FavHttp.favVideo(
|
||||
resources: '$rid:$type',
|
||||
addIds: addMediaIdsNew.join(','),
|
||||
delIds: delMediaIdsNew.join(','),
|
||||
|
||||
@@ -13,7 +13,7 @@ abstract class CommonWhisperController<R>
|
||||
SessionPageType get sessionPageType;
|
||||
|
||||
Future<void> onRemove(int index, int talkerId) async {
|
||||
var res = await MsgHttp.removeMsg(talkerId);
|
||||
final res = await MsgHttp.removeMsg(talkerId);
|
||||
if (res.isSuccess) {
|
||||
loadingState
|
||||
..value.data!.removeAt(index)
|
||||
@@ -30,7 +30,7 @@ abstract class CommonWhisperController<R>
|
||||
bool isTop,
|
||||
SessionId sessionId,
|
||||
) async {
|
||||
var res = isTop
|
||||
final res = isTop
|
||||
? await ImGrpc.unpinSession(sessionId: sessionId)
|
||||
: await ImGrpc.pinSession(sessionId: sessionId);
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract class CommonWhisperController<R>
|
||||
}
|
||||
|
||||
Future<void> onSetMute(Session item, bool isMuted, Int64 talkerUid) async {
|
||||
var res = await MsgHttp.setMsgDnd(
|
||||
final res = await MsgHttp.setMsgDnd(
|
||||
uid: Accounts.main.mid,
|
||||
setting: isMuted ? 0 : 1,
|
||||
dndUid: talkerUid,
|
||||
@@ -68,7 +68,7 @@ abstract class CommonWhisperController<R>
|
||||
if (loadingState.value.isSuccess) {
|
||||
List<Session>? list = loadingState.value.data;
|
||||
if (list != null && list.isNotEmpty) {
|
||||
for (var item in list) {
|
||||
for (final item in list) {
|
||||
if (item.hasUnread()) {
|
||||
item.clearUnread();
|
||||
}
|
||||
@@ -83,7 +83,7 @@ abstract class CommonWhisperController<R>
|
||||
}
|
||||
|
||||
Future<void> onDeleteList() async {
|
||||
var res = await ImGrpc.deleteSessionList(pageType: sessionPageType);
|
||||
final res = await ImGrpc.deleteSessionList(pageType: sessionPageType);
|
||||
if (res.isSuccess) {
|
||||
loadingState.value = const Success(null);
|
||||
} else {
|
||||
|
||||
@@ -157,7 +157,7 @@ abstract class CommonDynPageState<T extends StatefulWidget> extends State<T>
|
||||
itemCount: 12,
|
||||
itemBuilder: (context, index) => const VideoReplySkeleton(),
|
||||
),
|
||||
Success(:var response) =>
|
||||
Success(:final response) =>
|
||||
response != null && response.isNotEmpty
|
||||
? SliverList.builder(
|
||||
itemCount: response.length + 1,
|
||||
@@ -206,7 +206,7 @@ abstract class CommonDynPageState<T extends StatefulWidget> extends State<T>
|
||||
errMsg: '还没有评论',
|
||||
onReload: controller.onReload,
|
||||
),
|
||||
Error(:var errMsg) => HttpError(
|
||||
Error(:final errMsg) => HttpError(
|
||||
errMsg: errMsg,
|
||||
onReload: controller.onReload,
|
||||
),
|
||||
|
||||
@@ -32,7 +32,7 @@ mixin BaseMultiSelectMixin<T extends MultiSelectData>
|
||||
|
||||
@override
|
||||
void handleSelect({bool checked = false, bool disableSelect = true}) {
|
||||
for (var item in list) {
|
||||
for (final item in list) {
|
||||
item.checked = checked;
|
||||
}
|
||||
state.refresh();
|
||||
@@ -94,7 +94,7 @@ mixin CommonMultiSelectMixin<T extends MultiSelectData>
|
||||
if (loadingState.value.isSuccess) {
|
||||
final list = loadingState.value.data;
|
||||
if (list != null && list.isNotEmpty) {
|
||||
for (var item in list) {
|
||||
for (final item in list) {
|
||||
item.checked = checked;
|
||||
}
|
||||
loadingState.refresh();
|
||||
|
||||
@@ -63,7 +63,7 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
@override
|
||||
void dispose() {
|
||||
if (PlatformUtils.isMobile) {
|
||||
for (var i in pathList) {
|
||||
for (final i in pathList) {
|
||||
File(i).tryDel();
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
List<Map<String, dynamic>>? getRichContent() {
|
||||
if (editController.items.isEmpty) return null;
|
||||
final list = <Map<String, dynamic>>[];
|
||||
for (var e in editController.items) {
|
||||
for (final e in editController.items) {
|
||||
switch (e.type) {
|
||||
case RichTextType.text || RichTextType.composing || RichTextType.common:
|
||||
list.add({
|
||||
@@ -279,7 +279,7 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
if (res is MentionItem) {
|
||||
_onInsertUser(res, fromClick);
|
||||
} else if (res is Set<MentionItem>) {
|
||||
for (var e in res) {
|
||||
for (final e in res) {
|
||||
e.checked = false;
|
||||
_onInsertUser(e, fromClick);
|
||||
}
|
||||
@@ -313,7 +313,7 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
|
||||
enablePublish.value = true;
|
||||
|
||||
var oldValue = editController.value;
|
||||
final oldValue = editController.value;
|
||||
final selection = oldValue.selection;
|
||||
|
||||
if (selection.isValid) {
|
||||
|
||||
@@ -17,7 +17,7 @@ abstract class CommonSearchPageState<S extends StatefulWidget, R, T>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (controller case MultiSelectBase multiCtr) {
|
||||
if (controller case final MultiSelectBase multiCtr) {
|
||||
return Obx(() {
|
||||
final enableMultiSelect = multiCtr.enableMultiSelect.value;
|
||||
return PopScope(
|
||||
@@ -95,11 +95,11 @@ abstract class CommonSearchPageState<S extends StatefulWidget, R, T>
|
||||
Widget _buildBody(LoadingState<List<T>?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => const HttpError(),
|
||||
Success(:var response) =>
|
||||
Success(:final response) =>
|
||||
response != null && response.isNotEmpty
|
||||
? buildList(response)
|
||||
: HttpError(onReload: controller.onReload),
|
||||
Error(:var errMsg) => HttpError(
|
||||
Error(:final errMsg) => HttpError(
|
||||
errMsg: errMsg,
|
||||
onReload: controller.onReload,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user