button update shape

This commit is contained in:
2025-04-14 18:07:37 +02:00
parent 42fb4709df
commit ff0d6b7796
+4 -74
View File
@@ -226,68 +226,6 @@ Color _getColorFromName(String colorName) {
}
}
Future<String?> _showMismatchOptionsDialog(int detectedCount) async {
return showDialog<String>(
context: context,
builder: (context) {
final missing = widget.bulletCount - detectedCount;
return AlertDialog(
backgroundColor: Colors.grey[900],
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
title: const Text(
'Bullet Count Mismatch',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
content: Text(
'Detected $detectedCount bullet(s), expected ${widget.bulletCount}.\n'
'You can retry detection or manually add the ${missing.abs()} missing shot(s).',
style: const TextStyle(color: Colors.white70),
),
contentPadding: const EdgeInsets.fromLTRB(24, 20, 24, 12),
actionsPadding: const EdgeInsets.only(bottom: 16, left: 16, right: 16),
actions: [
Row(
children: [
Expanded(
child: ElevatedButton(
onPressed: () => Navigator.pop(context, 'retry'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.redAccent,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: const Icon(Icons.restart_alt, color: Colors.white),
),
),
const SizedBox(width: 16),
Expanded(
child: ElevatedButton(
onPressed: () => Navigator.pop(context, 'manual'),
style: ElevatedButton.styleFrom(
backgroundColor: _activeColor,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: const Icon(Icons.edit, color: Colors.white),
),
),
],
),
],
);
},
);
}
void _manualScoreEntry() {
final missingCount = widget.bulletCount - _mappedBullets.length;
final controllers = List.generate(missingCount, (_) => TextEditingController());
@@ -1065,17 +1003,8 @@ Widget build(BuildContext context) {
child: GestureDetector(
onTap: () async {
if (!_isEditMode && _mappedBullets.length < widget.bulletCount) {
final result = await _showMismatchOptionsDialog(_mappedBullets.length);
if (result == 'retry') {
Navigator.pop(context);
return;
} else if (result == 'manual') {
_manualScoreEntry();
return;
} else {
return;
}
}
setState(() {
@@ -1084,13 +1013,13 @@ Widget build(BuildContext context) {
});
},
child: Container(
width: 60,
height: 60,
width: 56,
height: 56,
decoration: BoxDecoration(
color: _isEditMode
? Colors.red
: (_mappedBullets.length < widget.bulletCount ? Colors.redAccent : _bulletColor),
shape: BoxShape.circle,
borderRadius: BorderRadius.circular(16), // 👈 Rounded square
boxShadow: const [
BoxShadow(
color: Colors.black26,
@@ -1111,6 +1040,7 @@ Widget build(BuildContext context) {
),
),
),
],
),
bottomNavigationBar: BottomAppBar(