diff --git a/lib/features/home/screens/home_screen.dart b/lib/features/home/screens/home_screen.dart index 44016426..cfa5254c 100644 --- a/lib/features/home/screens/home_screen.dart +++ b/lib/features/home/screens/home_screen.dart @@ -79,7 +79,7 @@ class HomeScreen extends ConsumerWidget { ), ), Positioned( - bottom: 100, + bottom: 80 + MediaQuery.of(context).viewPadding.bottom + 16, right: 16, child: const AddOrderButton(), ), diff --git a/lib/features/home/widgets/order_list_item.dart b/lib/features/home/widgets/order_list_item.dart index 054d30a2..4967dd70 100644 --- a/lib/features/home/widgets/order_list_item.dart +++ b/lib/features/home/widgets/order_list_item.dart @@ -17,7 +17,10 @@ class OrderListItem extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { ref.watch(timeProvider); - // Determine if the premium is positive or negative for the color + // Determine if this is a fixed order (has specific sats amount and is not zero) + final bool isFixedOrder = + order.amount != null && order.amount != "0" && order.amount!.isNotEmpty; + final premiumValue = order.premium != null ? double.tryParse(order.premium!) ?? 0.0 : 0.0; final isPremiumPositive = premiumValue >= 0; @@ -105,53 +108,82 @@ class OrderListItem extends ConsumerWidget { ), ), - // Second row: Amount and currency with flag and percentage + // Second row: Amount and currency with flag and percentage (if not fixed) Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), - child: Row( - crossAxisAlignment: CrossAxisAlignment.baseline, - textBaseline: TextBaseline.alphabetic, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - // Large amount with more contrast - Text( - order.fiatAmount.toString(), - style: const TextStyle( - fontSize: 28, - fontWeight: FontWeight.bold, - color: Colors.white, - height: 1.1, - ), - ), - const SizedBox(width: 8), + Row( + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + children: [ + // Large amount with more contrast + Text( + order.fiatAmount.toString(), + style: const TextStyle( + fontSize: 28, + fontWeight: FontWeight.bold, + color: Colors.white, + height: 1.1, + ), + ), + const SizedBox(width: 8), - // Currency code and flag - Text( - '${order.currency ?? "CUP"} ', - style: const TextStyle( - fontSize: 18, - color: Colors.white, - ), - ), - Text( - () { - final String currencyCode = order.currency ?? 'CUP'; - return CurrencyUtils.getFlagFromCurrency( - currencyCode) ?? - ''; - }(), - style: const TextStyle(fontSize: 18), + // Currency code and flag + Text( + '${order.currency ?? "CUP"} ', + style: const TextStyle( + fontSize: 18, + color: Colors.white, + ), + ), + Text( + () { + final String currencyCode = order.currency ?? 'CUP'; + return CurrencyUtils.getFlagFromCurrency( + currencyCode) ?? + ''; + }(), + style: const TextStyle(fontSize: 18), + ), + const SizedBox(width: 4), + ], ), - const SizedBox(width: 4), - // Percentage with more vibrant color - Text( - premiumText, - style: TextStyle( - fontSize: 16, - color: premiumColor, - fontWeight: FontWeight.w600, - ), + // Display sats amount for all orders (simplified) + Padding( + padding: const EdgeInsets.only(top: 4), + child: isFixedOrder + ? Text( + 'For ${order.amount!} sats', + style: TextStyle( + fontSize: 14, + color: Colors.white70, + fontWeight: FontWeight.w500, + ), + ) + : Row( + children: [ + Text( + 'Market Price ', + style: TextStyle( + fontSize: 14, + color: Colors.white70, + fontWeight: FontWeight.w500, + ), + ), + Text( + premiumText, + style: TextStyle( + fontSize: 14, + color: premiumColor, + fontWeight: FontWeight.w500, + ), + ), + ], + ), ), ], ), diff --git a/lib/shared/widgets/add_order_button.dart b/lib/shared/widgets/add_order_button.dart index daacacfe..440fd11f 100644 --- a/lib/shared/widgets/add_order_button.dart +++ b/lib/shared/widgets/add_order_button.dart @@ -30,11 +30,10 @@ class _AddOrderButtonState extends State } void _toggleMenu() { - // Guard: return early if animation is in progress to prevent glitches if (_animationController.isAnimating) { return; } - + setState(() { _isMenuOpen = !_isMenuOpen; if (_isMenuOpen) { @@ -57,65 +56,82 @@ class _AddOrderButtonState extends State @override Widget build(BuildContext context) { return SizedBox( - height: 130, // Altura suficiente para mostrar ambos elementos - width: 200, // Ancho suficiente para los botones + height: 130, + width: 200, child: Column( - mainAxisAlignment: - MainAxisAlignment.end, // Alinea los elementos al final - crossAxisAlignment: CrossAxisAlignment.end, // Alinea a la derecha + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, children: [ - // Opciones de menú que aparecen sobre el botón principal AnimatedContainer( duration: const Duration(milliseconds: 200), - height: - _isMenuOpen ? 45 : 0, // Se expande al abrir, colapsa al cerrar + height: _isMenuOpen ? 45 : 0, margin: const EdgeInsets.only(bottom: 10), child: Opacity( opacity: _isMenuOpen ? 1.0 : 0.0, child: Row( mainAxisSize: MainAxisSize.min, children: [ - ElevatedButton.icon( - onPressed: _isMenuOpen - ? () => _navigateToCreateOrder(context, 'buy') - : null, - style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.buyColor, - foregroundColor: Colors.black, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(50), + Stack( + alignment: Alignment.centerLeft, + children: [ + ElevatedButton.icon( + onPressed: _isMenuOpen + ? () => _navigateToCreateOrder(context, 'buy') + : null, + style: ElevatedButton.styleFrom( + backgroundColor: AppTheme.buyColor, + foregroundColor: Colors.black, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50), + ), + padding: const EdgeInsets.symmetric( + horizontal: 16, vertical: 10), + ), + icon: const SizedBox(width: 16, height: 16), + label: const Text('BUY', + style: TextStyle(fontWeight: FontWeight.bold)), ), - padding: const EdgeInsets.symmetric( - horizontal: 16, vertical: 10), - ), - icon: const Icon(Icons.arrow_downward, size: 16), - label: const Text('BUY', - style: TextStyle(fontWeight: FontWeight.bold)), + if (_isMenuOpen) + const Positioned( + left: 16, + child: Icon(Icons.arrow_downward, + size: 16, color: Colors.black), + ), + ], ), const SizedBox(width: 8), - ElevatedButton.icon( - onPressed: _isMenuOpen - ? () => _navigateToCreateOrder(context, 'sell') - : null, - style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.sellColor, - foregroundColor: Colors.black, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(50), + Stack( + alignment: Alignment.centerLeft, + children: [ + ElevatedButton.icon( + onPressed: _isMenuOpen + ? () => _navigateToCreateOrder(context, 'sell') + : null, + style: ElevatedButton.styleFrom( + backgroundColor: AppTheme.sellColor, + foregroundColor: Colors.black, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50), + ), + padding: const EdgeInsets.symmetric( + horizontal: 16, vertical: 10), + ), + icon: const SizedBox(width: 16, height: 16), + label: const Text('SELL', + style: TextStyle(fontWeight: FontWeight.bold)), ), - padding: const EdgeInsets.symmetric( - horizontal: 16, vertical: 10), - ), - icon: const Icon(Icons.arrow_upward, size: 16), - label: const Text('SELL', - style: TextStyle(fontWeight: FontWeight.bold)), + if (_isMenuOpen) + const Positioned( + left: 16, + child: Icon(Icons.arrow_upward, + size: 16, color: Colors.black), + ), + ], ), ], ), ), ), - - // Botón principal siempre visible FloatingActionButton( onPressed: _toggleMenu, backgroundColor: diff --git a/lib/shared/widgets/bottom_nav_bar.dart b/lib/shared/widgets/bottom_nav_bar.dart index b072ac5c..64825d5a 100644 --- a/lib/shared/widgets/bottom_nav_bar.dart +++ b/lib/shared/widgets/bottom_nav_bar.dart @@ -18,21 +18,23 @@ class BottomNavBar extends ConsumerWidget { final int orderNotificationCount = ref.watch(orderBookNotificationCountProvider); - return Container( - width: double.infinity, - height: 80, - decoration: BoxDecoration( - color: AppTheme.backgroundNavBar, - border: Border( - top: BorderSide( - color: Colors.white.withOpacity(0.1), - width: 1, + return SafeArea( + top: false, + child: Container( + width: double.infinity, + height: 80, + decoration: BoxDecoration( + color: AppTheme.backgroundNavBar, + border: Border( + top: BorderSide( + color: Colors.white.withOpacity(0.1), + width: 1, + ), ), ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ _buildNavItem( context, LucideIcons.book, @@ -53,7 +55,8 @@ class BottomNavBar extends ConsumerWidget { 2, notificationCount: chatCount, ), - ], + ], + ), ), ); }