mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 00:26:18 +08:00
@@ -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 = {
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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!));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user