四人交互绳花样页面调整

This commit is contained in:
马梓彭 2026-10-13 14:45:51 +08:00
parent 11aad4e245
commit 37d156efa0

View File

@ -729,7 +729,12 @@ class _DifficultyPanel extends StatelessWidget {
hero: _ScoreHero(label: controller.currentJudgeScoreLabel, score: score),
child: Column(
children: [
const _TableHeader(labels: ['级别', '数量', '小计得分', '计数操作']),
_TableHeader(
labels:
controller.profile.competition == CompetitionKind.doubleDutch
? const ['级别', '数量(- / 不变 / +)', '小计得分', '计数操作']
: const ['级别', '数量', '小计得分', '计数操作'],
),
if (controller.requiredElementCounts.isNotEmpty)
Container(
width: double.infinity,
@ -774,39 +779,81 @@ class _DifficultyPanel extends StatelessWidget {
Expanded(
child: ListView(
padding: EdgeInsets.zero,
children: controller.difficultyCounts.entries.map((entry) {
final subtotal = controller.difficultySubtotal(
entry.key,
entry.value,
);
return _TableRow(
cells: [
_LevelBadge(entry.key),
_NumberText(entry.value.toString()),
_NumberText(subtotal.toStringAsFixed(2)),
_ActionButton(
label: '数量',
onTap: controller.isReadOnly
? null
: () async {
final value = await showQuantityPicker(
current: entry.value,
includeZero: true,
);
if (value != null) {
controller.setDifficultyCount(entry.key, value);
}
},
),
],
);
}).toList(),
children: _difficultyLevelRows.map(_difficultyRow).toList(),
),
),
],
),
);
}
Iterable<List<String>> get _difficultyLevelRows {
if (controller.profile.competition != CompetitionKind.doubleDutch) {
return controller.difficultyCounts.keys.map((level) => [level]);
}
return [
if (controller.profile.roleCode == 'DJ') ['0'],
for (var level = 1; level <= 5; level++) ['$level-', '$level', '$level+'],
];
}
Widget _difficultyRow(List<String> levels) {
final subtotal = levels.fold<double>(
0,
(sum, level) =>
sum +
controller.difficultySubtotal(
level,
controller.difficultyCounts[level] ?? 0,
),
);
final grouped = levels.length == 3;
final baseLevel = grouped
? levels[1]
: levels.single == '0'
? '0(间歇)'
: levels.single.replaceAll(RegExp(r'[+-]$'), '');
return _TableRow(
cells: [
_LevelBadge(baseLevel),
grouped
? Row(
children: [
for (final level in levels)
Expanded(
child: Center(
child: _NumberText(
'${controller.difficultyCounts[level] ?? 0}',
),
),
),
],
)
: _NumberText('${controller.difficultyCounts[levels.single] ?? 0}'),
_NumberText(subtotal.toStringAsFixed(2)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
for (final level in levels)
_ActionButton(
label: grouped ? '$level数量' : '数量',
onTap: controller.isReadOnly
? null
: () async {
final value = await showQuantityPicker(
current: controller.difficultyCounts[level] ?? 0,
includeZero: true,
);
if (value != null) {
controller.setDifficultyCount(level, value);
}
},
),
],
),
],
);
}
}
class _ShowDifficultyPanel extends StatelessWidget {