Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-19 20:40:09 +08:00
parent 38b1af2696
commit e4654d63c3
6 changed files with 22 additions and 10 deletions

View File

@@ -261,10 +261,10 @@ class DynamicsHttp {
} }
static Future<LoadingState<VoteInfo>> doVote({ static Future<LoadingState<VoteInfo>> doVote({
required voteId, required int voteId,
required List<int> votes, required List<int> votes,
bool anonymity = false, bool anonymity = false,
dynamicId, int? dynamicId,
}) async { }) async {
final csrf = Accounts.main.csrf; final csrf = Accounts.main.csrf;
final data = { final data = {

View File

@@ -246,7 +246,7 @@ class OpusContent extends StatelessWidget {
showVoteDialog( showVoteDialog(
context, context,
element.linkCard!.card!.vote?.voteId ?? element.linkCard!.card!.vote?.voteId ??
element.linkCard!.card!.oid, int.parse(element.linkCard!.card!.oid!),
); );
return; return;
} }

View File

@@ -50,7 +50,7 @@ class ReadOpus extends StatelessWidget {
} }
case 'vote-card card': case 'vote-card card':
if (card.id != null) { if (card.id != null) {
showVoteDialog(context, card.id); showVoteDialog(context, int.parse(card.id!));
} }
} }
}, },

View File

@@ -309,8 +309,12 @@ Widget addWidget(
onTap: () { onTap: () {
showVoteDialog( showVoteDialog(
context, context,
vote.voteId, vote.voteId!,
item.idStr, item.idStr is int
? item.idStr
: item.idStr is String
? int.parse(item.idStr)
: null,
); );
}, },
child: Padding( child: Padding(
@@ -358,8 +362,12 @@ Widget addWidget(
onPressed: () { onPressed: () {
showVoteDialog( showVoteDialog(
context, context,
vote.voteId, vote.voteId!,
item.idStr, item.idStr is int
? item.idStr
: item.idStr is String
? int.parse(item.idStr)
: null,
); );
}, },
style: FilledButton.styleFrom( style: FilledButton.styleFrom(

View File

@@ -123,7 +123,10 @@ TextSpan? richNode(
), ),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
showVoteDialog(context, i.rid, item.basic?.commentIdStr); final dynIdStr = item.basic?.commentIdStr;
final dynId =
dynIdStr != null ? int.tryParse(dynIdStr) : null;
showVoteDialog(context, int.parse(i.rid!), dynId);
}, },
), ),
); );

View File

@@ -256,7 +256,8 @@ class PercentageChip extends StatelessWidget {
} }
} }
Future showVoteDialog(BuildContext context, voteId, [dynamicId]) async { Future showVoteDialog(BuildContext context, int voteId,
[int? dynamicId]) async {
final voteInfo = await DynamicsHttp.voteInfo(voteId); final voteInfo = await DynamicsHttp.voteInfo(voteId);
if (context.mounted) { if (context.mounted) {
if (voteInfo.isSuccess) { if (voteInfo.isSuccess) {