button update shape
This commit is contained in:
@@ -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() {
|
void _manualScoreEntry() {
|
||||||
final missingCount = widget.bulletCount - _mappedBullets.length;
|
final missingCount = widget.bulletCount - _mappedBullets.length;
|
||||||
final controllers = List.generate(missingCount, (_) => TextEditingController());
|
final controllers = List.generate(missingCount, (_) => TextEditingController());
|
||||||
@@ -1065,17 +1003,8 @@ Widget build(BuildContext context) {
|
|||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (!_isEditMode && _mappedBullets.length < widget.bulletCount) {
|
if (!_isEditMode && _mappedBullets.length < widget.bulletCount) {
|
||||||
final result = await _showMismatchOptionsDialog(_mappedBullets.length);
|
|
||||||
|
|
||||||
if (result == 'retry') {
|
|
||||||
Navigator.pop(context);
|
|
||||||
return;
|
|
||||||
} else if (result == 'manual') {
|
|
||||||
_manualScoreEntry();
|
_manualScoreEntry();
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -1084,13 +1013,13 @@ Widget build(BuildContext context) {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 60,
|
width: 56,
|
||||||
height: 60,
|
height: 56,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _isEditMode
|
color: _isEditMode
|
||||||
? Colors.red
|
? Colors.red
|
||||||
: (_mappedBullets.length < widget.bulletCount ? Colors.redAccent : _bulletColor),
|
: (_mappedBullets.length < widget.bulletCount ? Colors.redAccent : _bulletColor),
|
||||||
shape: BoxShape.circle,
|
borderRadius: BorderRadius.circular(16), // 👈 Rounded square
|
||||||
boxShadow: const [
|
boxShadow: const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black26,
|
color: Colors.black26,
|
||||||
@@ -1111,6 +1040,7 @@ Widget build(BuildContext context) {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
bottomNavigationBar: BottomAppBar(
|
bottomNavigationBar: BottomAppBar(
|
||||||
|
|||||||
Reference in New Issue
Block a user