scrutinDetailListViewElement method
Column
scrutinDetailListViewElement({
- required GroupVotesFromJson group,
- required List<
DeputesFromCsv> allDeputes,
Implementation
Column scrutinDetailListViewElement(
{required GroupVotesFromJson group,
required List<DeputesFromCsv> allDeputes}) {
List<DeputesFromCsv> theyVotedFor = [];
List<DeputesFromCsv> theyVotedAgainst = [];
List<DeputesFromCsv> theyDidNotVote = [];
List<DeputesFromCsv> theyVotedAbstention = [];
print("----");
print("- " + (group.deputesRefToHilite ?? []).length.toString());
print("-- " + allDeputes.length.toString());
List<DeputesFromCsv> voterDeputes =
getListOfHighlightedDeputes(allDeputes, group);
print("- " + voterDeputes.length.toString());
print("----");
for (DeputesFromCsv deputesHighlighted in voterDeputes) {
if (deputesHighlighted.votedFor ?? false) {
theyVotedFor.add(deputesHighlighted);
} else if (deputesHighlighted.votedAgainst ?? false) {
theyVotedAgainst.add(deputesHighlighted);
} else if (deputesHighlighted.didNotVote ?? false) {
theyDidNotVote.add(deputesHighlighted);
} else if (deputesHighlighted.votedAbstention ?? false) {
theyVotedAbstention.add(deputesHighlighted);
}
}
if ((theyVotedFor.length > 0) ||
(theyVotedAgainst.length > 0) ||
(theyDidNotVote.length > 0) ||
(theyVotedAbstention.length > 0)) {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
group.groupName,
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 11,
decoration: TextDecoration.underline),
),
if (group.intergroupName != "-")
Text(
" — " + group.intergroupName,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 11,
decoration: TextDecoration.underline),
),
],
),
if (group.positionMajoritaire != "")
Text(
"position majoritaire : " + group.positionMajoritaire!.allInCaps,
style: TextStyle(fontWeight: FontWeight.w900, fontSize: 9),
),
Padding(padding: EdgeInsets.all(8)),
if (theyVotedFor.length > 0)
Text("POUR",
style: TextStyle(
color: hemicyleVoteFor,
fontWeight: FontWeight.w600,
fontSize: 11)),
for (var i = 0; i < (theyVotedFor.length / 2).ceil(); i++)
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
theyVotedFor[i * 2].prenom.firstInCaps +
" " +
theyVotedFor[i * 2].nom.allInCaps,
style:
TextStyle(fontWeight: FontWeight.w400, fontSize: 10)),
if (i * 2 + 1 < theyVotedFor.length)
Text(
theyVotedFor[i * 2 + 1].prenom.firstInCaps +
" " +
theyVotedFor[i * 2 + 1].nom.allInCaps,
style:
TextStyle(fontWeight: FontWeight.w400, fontSize: 10)),
],
),
if (theyVotedFor.length > 0) Padding(padding: EdgeInsets.all(8)),
if (theyVotedAgainst.length > 0)
Text("CONTRE",
style: TextStyle(
color: hemicyleVoteAgainst,
fontWeight: FontWeight.w600,
fontSize: 11)),
for (var i = 0; i < (theyVotedAgainst.length / 2).ceil(); i++)
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
theyVotedAgainst[i * 2].prenom.firstInCaps +
" " +
theyVotedAgainst[i * 2].nom.allInCaps,
style:
TextStyle(fontWeight: FontWeight.w400, fontSize: 10)),
if (i * 2 + 1 < theyVotedAgainst.length)
Text(
theyVotedAgainst[i * 2 + 1].prenom.firstInCaps +
" " +
theyVotedAgainst[i * 2 + 1].nom.allInCaps,
style:
TextStyle(fontWeight: FontWeight.w400, fontSize: 10)),
],
),
if (theyVotedAgainst.length > 0) Padding(padding: EdgeInsets.all(8)),
if (theyVotedAbstention.length > 0)
Text("ABSTENTION",
style: TextStyle(
color: hemicyleVoteAbstention,
fontWeight: FontWeight.w600,
fontSize: 11)),
for (var i = 0; i < (theyVotedAbstention.length / 2).ceil(); i++)
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
theyVotedAbstention[i * 2].prenom.firstInCaps +
" " +
theyVotedAbstention[i * 2].nom.allInCaps,
style:
TextStyle(fontWeight: FontWeight.w400, fontSize: 10)),
if (i * 2 + 1 < theyVotedAbstention.length)
Text(
theyVotedAbstention[i * 2 + 1].prenom.firstInCaps +
" " +
theyVotedAbstention[i * 2 + 1].nom.allInCaps,
style:
TextStyle(fontWeight: FontWeight.w400, fontSize: 10)),
],
),
if (theyVotedAbstention.length > 0)
Padding(padding: EdgeInsets.all(8)),
],
);
} else {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
group.groupName,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 9),
),
Text(
" n'a pas de vote dissident",
style: TextStyle(fontWeight: FontWeight.w300, fontSize: 9),
),
],
),
Padding(padding: EdgeInsets.all(8)),
],
);
}
}