fixed controller and coloring
This commit is contained in:
@@ -442,45 +442,57 @@ void _manualScoreEntry() {
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.black.withOpacity(0.75),
|
color: Colors.black.withOpacity(0.75),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(16),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
// Up
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.arrow_drop_up, size: 32, color: Colors.white),
|
icon: const Icon(Icons.keyboard_arrow_up, size: 36, color: Colors.white),
|
||||||
onPressed: () => _moveBullet(const Offset(0, -3)),
|
onPressed: () => _moveBullet(const Offset(0, -3)),
|
||||||
splashRadius: 20,
|
splashRadius: 24,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Left - Check - Right
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.arrow_left, size: 32, color: Colors.white),
|
icon: const Icon(Icons.keyboard_arrow_left, size: 36, color: Colors.white),
|
||||||
onPressed: () => _moveBullet(const Offset(-3, 0)),
|
onPressed: () => _moveBullet(const Offset(-3, 0)),
|
||||||
splashRadius: 20,
|
splashRadius: 24,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 8),
|
||||||
IconButton(
|
Container(
|
||||||
icon: const Icon(Icons.check, size: 28, color: Colors.greenAccent),
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.greenAccent.withOpacity(0.2),
|
||||||
|
border: Border.all(color: Colors.greenAccent, width: 2),
|
||||||
|
),
|
||||||
|
child: IconButton(
|
||||||
|
icon: const Icon(Icons.check, color: Colors.greenAccent, size: 28),
|
||||||
onPressed: () => setState(() => _selectedBulletIndexInEdit = null),
|
onPressed: () => setState(() => _selectedBulletIndexInEdit = null),
|
||||||
splashRadius: 20,
|
splashRadius: 22,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.arrow_right, size: 32, color: Colors.white),
|
icon: const Icon(Icons.keyboard_arrow_right, size: 36, color: Colors.white),
|
||||||
onPressed: () => _moveBullet(const Offset(3, 0)),
|
onPressed: () => _moveBullet(const Offset(3, 0)),
|
||||||
splashRadius: 20,
|
splashRadius: 24,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Down
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.arrow_drop_down, size: 32, color: Colors.white),
|
icon: const Icon(Icons.keyboard_arrow_down, size: 36, color: Colors.white),
|
||||||
onPressed: () => _moveBullet(const Offset(0, 3)),
|
onPressed: () => _moveBullet(const Offset(0, 3)),
|
||||||
splashRadius: 20,
|
splashRadius: 24,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -490,6 +502,7 @@ void _manualScoreEntry() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _moveBullet(Offset offsetDelta) {
|
void _moveBullet(Offset offsetDelta) {
|
||||||
setState(() {
|
setState(() {
|
||||||
final index = _selectedBulletIndexInEdit!;
|
final index = _selectedBulletIndexInEdit!;
|
||||||
@@ -864,7 +877,7 @@ Widget build(BuildContext context) {
|
|||||||
style: const TextStyle(color: Colors.white, fontSize: 16),
|
style: const TextStyle(color: Colors.white, fontSize: 16),
|
||||||
),
|
),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: _activeColor,
|
backgroundColor: Colors.red,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
@@ -1009,6 +1022,8 @@ Widget build(BuildContext context) {
|
|||||||
// Score buttons
|
// Score buttons
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
|
child: AbsorbPointer(
|
||||||
|
absorbing: _isEditMode && _selectedBulletIndexInEdit != null,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: List.generate(
|
children: List.generate(
|
||||||
_mappedBullets.length,
|
_mappedBullets.length,
|
||||||
@@ -1110,9 +1125,9 @@ Widget build(BuildContext context) {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_loadBulletColor(); // 👈 this will load bullet color
|
_loadBulletColor();
|
||||||
_loadJsonAndImage();
|
_loadJsonAndImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
|||||||
final bullet = entry.value;
|
final bullet = entry.value;
|
||||||
final dx = bullet.dx * scaleX + offsetX;
|
final dx = bullet.dx * scaleX + offsetX;
|
||||||
final dy = bullet.dy * scaleY + offsetY;
|
final dy = bullet.dy * scaleY + offsetY;
|
||||||
final score = _scoreForBullet(bullet, _targetCenter!);
|
final score = _scoreForBullet(bullet, _targetCenter ?? Offset.zero);
|
||||||
final isHighlighted = widget.isCombinedView
|
final isHighlighted = widget.isCombinedView
|
||||||
? (_pressedScoreGroup == score)
|
? (_pressedScoreGroup == score)
|
||||||
: (i == _highlightedBulletIndex);
|
: (i == _highlightedBulletIndex);
|
||||||
@@ -310,7 +310,8 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList(),
|
})
|
||||||
|
.toList(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -355,7 +356,11 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
|||||||
scoreGroups[score] = (scoreGroups[score] ?? 0) + 1;
|
scoreGroups[score] = (scoreGroups[score] ?? 0) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return scoreGroups.entries.map((entry) {
|
// Sort scores descending (10 → 0)
|
||||||
|
final sortedEntries = scoreGroups.entries.toList()
|
||||||
|
..sort((a, b) => b.key.compareTo(a.key));
|
||||||
|
|
||||||
|
return sortedEntries.map((entry) {
|
||||||
final score = entry.key;
|
final score = entry.key;
|
||||||
final count = entry.value;
|
final count = entry.value;
|
||||||
|
|
||||||
@@ -370,10 +375,10 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
|||||||
height: 100,
|
height: 100,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
boxShadow: [
|
boxShadow: const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black26,
|
color: Colors.black26,
|
||||||
offset: const Offset(0, 2),
|
offset: Offset(0, 2),
|
||||||
blurRadius: 6,
|
blurRadius: 6,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -437,10 +442,21 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<Widget> _buildIndividualScoreButtons() {
|
List<Widget> _buildIndividualScoreButtons() {
|
||||||
return List.generate(_bullets.length, (index) {
|
final scoredBullets = _bullets.asMap().entries.map((entry) {
|
||||||
final bullet = _bullets[index];
|
final index = entry.key;
|
||||||
final score = _scoreForBullet(bullet, _targetCenter!);
|
final bullet = entry.value;
|
||||||
|
final score = _scoreForBullet(bullet, _targetCenter ?? Offset.zero);
|
||||||
|
return {'index': index, 'score': score, 'bullet': bullet};
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
// Sort descending by score
|
||||||
|
scoredBullets.sort((a, b) => (b['score'] as int).compareTo(a['score'] as int));
|
||||||
|
|
||||||
|
return scoredBullets.map((entry) {
|
||||||
|
final int index = entry['index'] as int;
|
||||||
|
final int score = entry['score'] as int;
|
||||||
|
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -453,10 +469,10 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
|||||||
height: 100,
|
height: 100,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
boxShadow: [
|
boxShadow: const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black26,
|
color: Colors.black26,
|
||||||
offset: const Offset(0, 2),
|
offset: Offset(0, 2),
|
||||||
blurRadius: 6,
|
blurRadius: 6,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -510,6 +526,7 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user