From 42fb4709dff78facae77aa2d1a2b141b3723735a Mon Sep 17 00:00:00 2001 From: Bl3kiiie Date: Mon, 14 Apr 2025 17:31:17 +0200 Subject: [PATCH] button update in preview --- lib/screens/preview_screen.dart | 100 +++++++++++++++++-------------- lib/screens/settings_screen.dart | 1 - 2 files changed, 54 insertions(+), 47 deletions(-) diff --git a/lib/screens/preview_screen.dart b/lib/screens/preview_screen.dart index eae4750..34359f1 100644 --- a/lib/screens/preview_screen.dart +++ b/lib/screens/preview_screen.dart @@ -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( diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index ce23757..2e26a31 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -451,5 +451,4 @@ void _showBulletColorPopup() { ); } - }