button update in preview

This commit is contained in:
2025-04-14 17:31:17 +02:00
parent f73932cc98
commit 42fb4709df
2 changed files with 54 additions and 47 deletions
+54 -46
View File
@@ -812,51 +812,6 @@ Widget build(BuildContext context) {
? const Center(child: CircularProgressIndicator())
: Stack(
children: [
if (_mappedBullets.isNotEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
child: SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: () 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(() {
_isEditMode = !_isEditMode;
_selectedBulletIndexInEdit = null;
});
},
icon: Icon(
_isEditMode ? Icons.check : Icons.edit,
color: Colors.white,
size: 20,
),
label: Text(
_isEditMode ? "Done Editing" : "Edit Bullets",
style: const TextStyle(color: Colors.white, fontSize: 16),
),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
),
),
Column(
children: [
Expanded(
@@ -1103,8 +1058,61 @@ Widget build(BuildContext context) {
],
),
_buildEditController(),
if (_mappedBullets.isNotEmpty)
Positioned(
top: 16,
right: 16,
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(() {
_isEditMode = !_isEditMode;
_selectedBulletIndexInEdit = null;
});
},
child: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: _isEditMode
? Colors.red
: (_mappedBullets.length < widget.bulletCount ? Colors.redAccent : _bulletColor),
shape: BoxShape.circle,
boxShadow: const [
BoxShadow(
color: Colors.black26,
offset: Offset(0, 3),
blurRadius: 6,
),
],
),
child: Icon(
_isEditMode
? Icons.check
: (_mappedBullets.length < widget.bulletCount
? Icons.warning_amber_rounded
: Icons.edit),
color: Colors.white,
size: 28,
),
),
),
),
],
),
),
bottomNavigationBar: BottomAppBar(
color: Colors.grey[900],
child: SizedBox(