Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/features/home/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class HomeScreen extends ConsumerWidget {
),
),
Positioned(
bottom: 100,
bottom: 80 + MediaQuery.of(context).viewPadding.bottom + 16,
right: 16,
child: const AddOrderButton(),
),
Expand Down
114 changes: 73 additions & 41 deletions lib/features/home/widgets/order_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
),
),
],
),
),
],
),
Expand Down
100 changes: 58 additions & 42 deletions lib/shared/widgets/add_order_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ class _AddOrderButtonState extends State<AddOrderButton>
}

void _toggleMenu() {
// Guard: return early if animation is in progress to prevent glitches
if (_animationController.isAnimating) {
return;
}

setState(() {
_isMenuOpen = !_isMenuOpen;
if (_isMenuOpen) {
Expand All @@ -57,65 +56,82 @@ class _AddOrderButtonState extends State<AddOrderButton>
@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:
Expand Down
31 changes: 17 additions & 14 deletions lib/shared/widgets/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -53,7 +55,8 @@ class BottomNavBar extends ConsumerWidget {
2,
notificationCount: chatCount,
),
],
],
),
),
);
}
Expand Down