Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2026-01-02 12:05:31 +08:00
parent 80e007bac6
commit 041af37bb0
67 changed files with 775 additions and 838 deletions

View File

@@ -77,15 +77,14 @@ class DynamicsController extends GetxController
final res = await DynamicsHttp.dynUpList(upState.value.data.offset);
if (res.isSuccess) {
final data = res.data;
if (data.hasMore == false || data.offset.isNullOrEmpty) {
if (res case Success(:final response)) {
if (response.hasMore == false || response.offset.isNullOrEmpty) {
_upEnd = true;
}
final upData = upState.value.data
..hasMore = data.hasMore
..offset = data.offset;
final list = data.upList;
..hasMore = response.hasMore
..offset = response.offset;
final list = response.upList;
if (list != null && list.isNotEmpty) {
upData.upList.addAll(list);
upState.refresh();
@@ -106,9 +105,9 @@ class DynamicsController extends GetxController
ps: 50,
);
if (res.isSuccess) {
if (res case Success(:final response)) {
_upPage++;
final list = res.data.list;
final list = response.list;
if (list.isEmpty) {
_upEnd = true;
}
@@ -149,11 +148,11 @@ class DynamicsController extends GetxController
]);
final first = res.first;
if (first.isSuccess) {
FollowUpModel data = first.data as FollowUpModel;
if (first case final Success<FollowUpModel> i) {
final data = i.response;
final second = res.getOrNull(1);
if (second != null && second.isSuccess) {
FollowData data1 = second.data as FollowData;
if (second case final Success<FollowData> j) {
final data1 = j.response;
final list1 = data1.list;
_upPage++;

View File

@@ -3,6 +3,7 @@ import 'dart:io' show Platform;
import 'package:PiliPlus/common/widgets/image/custom_grid_view.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/http/dynamics.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/search.dart';
import 'package:PiliPlus/models/common/image_preview_type.dart'
show SourceModel;
@@ -288,15 +289,14 @@ TextSpan? richNode(
}
DynamicsHttp.dynPic(i.rid).then((res) {
if (res.isSuccess) {
final list = res.data;
if (res case Success(:final response)) {
if (Platform.isAndroid) {
i.pics = list;
i.pics = response;
} else {
i.dynPic = list;
i.dynPic = response;
}
if (list != null && list.isNotEmpty) {
onView(list);
if (response != null && response.isNotEmpty) {
onView(response);
}
} else {
res.toast();

View File

@@ -53,8 +53,9 @@ class _VotePanelState extends State<VotePanel> {
_voteInfo = widget.voteInfo;
if (isLogin) {
DynamicsHttp.followeeVotes(voteId: _voteInfo.voteId).then((res) {
if (mounted && res.isSuccess) {
followeeVote.value = res.data;
if (!mounted) return;
if (res case Success(:final response)) {
followeeVote.value = response;
}
});
}
@@ -118,15 +119,13 @@ class _VotePanelState extends State<VotePanel> {
groupValue.toSet(),
anonymous,
);
if (res.isSuccess) {
if (mounted) {
setState(() {
_enabled = false;
_showPercentage = true;
_voteInfo = res.data;
_percentage = _cnt2Percentage(_voteInfo.options);
});
}
if (!mounted) return;
if (res case Success(:final response)) {
_enabled = false;
_showPercentage = true;
_voteInfo = response;
_percentage = _cnt2Percentage(_voteInfo.options);
setState(() {});
} else {
res.toast();
}