From 979cafec0dcac01c6b7091d312fd2a0ad6a01693 Mon Sep 17 00:00:00 2001 From: Andrea Diaz Correia Date: Wed, 28 May 2025 22:08:01 -0300 Subject: [PATCH 1/4] adding sats y card --- .../home/widgets/order_list_item.dart | 105 +++++++++++------- 1 file changed, 64 insertions(+), 41 deletions(-) diff --git a/lib/features/home/widgets/order_list_item.dart b/lib/features/home/widgets/order_list_item.dart index 054d30a2..eb48900b 100644 --- a/lib/features/home/widgets/order_list_item.dart +++ b/lib/features/home/widgets/order_list_item.dart @@ -17,6 +17,9 @@ class OrderListItem extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { ref.watch(timeProvider); + // Determine if this is a fixed order (has specific sats amount) + final bool isFixedOrder = order.amount != null && order.amount!.isNotEmpty; + // Determine if the premium is positive or negative for the color final premiumValue = order.premium != null ? double.tryParse(order.premium!) ?? 0.0 : 0.0; @@ -105,54 +108,74 @@ 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), - ), - const SizedBox(width: 4), + // 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), - // Percentage with more vibrant color - Text( - premiumText, - style: TextStyle( - fontSize: 16, - color: premiumColor, - fontWeight: FontWeight.w600, - ), + // Percentage with more vibrant color (only for non-fixed orders) + if (!isFixedOrder) + Text( + premiumText, + style: TextStyle( + fontSize: 16, + color: premiumColor, + fontWeight: FontWeight.w600, + ), + ), + ], ), + + // Display sats amount for fixed orders + if (isFixedOrder) + Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + '${order.orderType == OrderType.buy ? "Buying" : "Selling"} ${order.fiatAmount} ${order.currency ?? ""} for ${order.amount} sats', + style: TextStyle( + fontSize: 14, + color: Colors.white70, + fontWeight: FontWeight.w500, + ), + ), + ), ], ), ), From df839b69423bbe32224b735d9ce091612cef30d6 Mon Sep 17 00:00:00 2001 From: Andrea Diaz Correia Date: Wed, 28 May 2025 23:07:33 -0300 Subject: [PATCH 2/4] fix: sats in order card and market price --- .../home/widgets/order_list_item.dart | 64 +++++++++++-------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/lib/features/home/widgets/order_list_item.dart b/lib/features/home/widgets/order_list_item.dart index eb48900b..6d96f395 100644 --- a/lib/features/home/widgets/order_list_item.dart +++ b/lib/features/home/widgets/order_list_item.dart @@ -17,10 +17,11 @@ class OrderListItem extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { ref.watch(timeProvider); - // Determine if this is a fixed order (has specific sats amount) - final bool isFixedOrder = order.amount != null && order.amount!.isNotEmpty; + // 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; - // Determine if the premium is positive or negative for the color + // Calcular el valor del premium para órdenes de tipo market final premiumValue = order.premium != null ? double.tryParse(order.premium!) ?? 0.0 : 0.0; final isPremiumPositive = premiumValue >= 0; @@ -149,33 +150,42 @@ class OrderListItem extends ConsumerWidget { style: const TextStyle(fontSize: 18), ), const SizedBox(width: 4), + ], + ), - // Percentage with more vibrant color (only for non-fixed orders) - if (!isFixedOrder) - 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, + ), + ), + ], ), - ), - ], ), - - // Display sats amount for fixed orders - if (isFixedOrder) - Padding( - padding: const EdgeInsets.only(top: 4), - child: Text( - '${order.orderType == OrderType.buy ? "Buying" : "Selling"} ${order.fiatAmount} ${order.currency ?? ""} for ${order.amount} sats', - style: TextStyle( - fontSize: 14, - color: Colors.white70, - fontWeight: FontWeight.w500, - ), - ), - ), ], ), ), From c1af96a69a1587d6b69c0769a3f14eae02fbdf50 Mon Sep 17 00:00:00 2001 From: Andrea Diaz Correia Date: Sun, 1 Jun 2025 21:37:42 -0300 Subject: [PATCH 3/4] fix: visual issues in home screen --- lib/features/home/screens/home_screen.dart | 2 +- lib/shared/widgets/add_order_button.dart | 84 ++++++++++++++-------- lib/shared/widgets/bottom_nav_bar.dart | 31 ++++---- 3 files changed, 71 insertions(+), 46 deletions(-) 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/shared/widgets/add_order_button.dart b/lib/shared/widgets/add_order_button.dart index daacacfe..9d3737cb 100644 --- a/lib/shared/widgets/add_order_button.dart +++ b/lib/shared/widgets/add_order_button.dart @@ -34,7 +34,7 @@ class _AddOrderButtonState extends State if (_animationController.isAnimating) { return; } - + setState(() { _isMenuOpen = !_isMenuOpen; if (_isMenuOpen) { @@ -75,40 +75,62 @@ class _AddOrderButtonState extends State 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), + ), + ], ), ], ), 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, ), - ], + ], + ), ), ); } From 1036a7702ebea8abe5735db8396838b8fde7e8e0 Mon Sep 17 00:00:00 2001 From: Andrea Diaz Correia Date: Sun, 1 Jun 2025 21:51:41 -0300 Subject: [PATCH 4/4] remove comments in spanish --- lib/features/home/widgets/order_list_item.dart | 1 - lib/shared/widgets/add_order_button.dart | 16 +++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/features/home/widgets/order_list_item.dart b/lib/features/home/widgets/order_list_item.dart index 6d96f395..4967dd70 100644 --- a/lib/features/home/widgets/order_list_item.dart +++ b/lib/features/home/widgets/order_list_item.dart @@ -21,7 +21,6 @@ class OrderListItem extends ConsumerWidget { final bool isFixedOrder = order.amount != null && order.amount != "0" && order.amount!.isNotEmpty; - // Calcular el valor del premium para órdenes de tipo market final premiumValue = order.premium != null ? double.tryParse(order.premium!) ?? 0.0 : 0.0; final isPremiumPositive = premiumValue >= 0; diff --git a/lib/shared/widgets/add_order_button.dart b/lib/shared/widgets/add_order_button.dart index 9d3737cb..440fd11f 100644 --- a/lib/shared/widgets/add_order_button.dart +++ b/lib/shared/widgets/add_order_button.dart @@ -30,7 +30,6 @@ class _AddOrderButtonState extends State } void _toggleMenu() { - // Guard: return early if animation is in progress to prevent glitches if (_animationController.isAnimating) { return; } @@ -57,18 +56,15 @@ 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, @@ -136,8 +132,6 @@ class _AddOrderButtonState extends State ), ), ), - - // Botón principal siempre visible FloatingActionButton( onPressed: _toggleMenu, backgroundColor: