stage2
This commit is contained in:
@@ -26,7 +26,7 @@ class TargetViewScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _TargetViewScreenState extends State<TargetViewScreen> {
|
||||
int _currentIndex = 0;
|
||||
final int _currentIndex = 0;
|
||||
List<Offset> _bullets = [];
|
||||
List<Offset> _scaledBullets = []; // Bullets scaled to display target size
|
||||
int _totalScore = 0;
|
||||
@@ -144,7 +144,7 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
||||
img.Image? defaultTargetDecoded = img.decodeImage(defaultBytes);
|
||||
|
||||
if (defaultTargetDecoded == null) {
|
||||
print("Failed to decode default target image.");
|
||||
debugPrint("Failed to decode default target image.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
||||
_targetImageDecoded = img.decodeImage(displayBytes);
|
||||
|
||||
if (_targetImageDecoded == null) {
|
||||
print("Failed to decode display target image.");
|
||||
debugPrint("Failed to decode display target image.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
||||
|
||||
setState(() {});
|
||||
} catch (e) {
|
||||
print("Error loading JSON or image: $e");
|
||||
debugPrint("Error loading JSON or image: $e");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,13 +293,15 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
||||
try {
|
||||
final file = File(_targetFilePath);
|
||||
await file.delete();
|
||||
widget.refreshFolders();
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Target deleted')),
|
||||
);
|
||||
widget.refreshFolders();
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
print("Error deleting target: $e");
|
||||
debugPrint("Error deleting target: $e");
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Failed to delete target')),
|
||||
);
|
||||
@@ -311,18 +313,38 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
||||
return Scaffold(
|
||||
backgroundColor: _backgroundColor,
|
||||
appBar: AppBar(
|
||||
title: Row(
|
||||
// Score on top, where it is read first; the date sits in the bottom bar
|
||||
// Same look as the SKUPAJ total on the preview screen
|
||||
title: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.calendar_today, size: 20, color: Colors.white),
|
||||
const SizedBox(width: 8),
|
||||
Text(_date, style: const TextStyle(color: Colors.white)),
|
||||
Text(
|
||||
_t('Total score').replaceAll(':', '').toUpperCase(),
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
letterSpacing: 1.5,
|
||||
color: Colors.white54,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"$_totalScore",
|
||||
style: const TextStyle(
|
||||
fontSize: 26,
|
||||
height: 1.1,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
backgroundColor: Colors.grey[900],
|
||||
centerTitle: true,
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
actions: [
|
||||
// The combined view shows a whole session; deleting would remove an
|
||||
// arbitrary one of its targets. Sessions are deleted from the Book list.
|
||||
if (!widget.isCombinedView)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete),
|
||||
color: Colors.red,
|
||||
@@ -487,7 +509,7 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
}),
|
||||
],
|
||||
);
|
||||
},
|
||||
@@ -517,33 +539,20 @@ class _TargetViewScreenState extends State<TargetViewScreen> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Total score
|
||||
// Date
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.track_changes,
|
||||
const Icon(Icons.calendar_today,
|
||||
size: 20, color: Colors.white),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
_t('Total score'),
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.white54,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"$_totalScore",
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
Text(
|
||||
// Saved targets store dd/MM/yyyy; show it the Slovenian way
|
||||
_date.replaceAll('/', '.'),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user