Skip to content

Commit

Permalink
Fixes to Code Rabbit's fixes...
Browse files Browse the repository at this point in the history
  • Loading branch information
chebizarro committed Nov 20, 2024
1 parent dd64e6b commit ff12b49
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/data/models/mostro_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MostroMessage<T extends Content> {
? order['id'] as String?
: throw FormatException('Missing id field');

final content = order['content'] ?? Content.fromJson(event['order']['content']) as T;
final content = order['content'] != null ? Content.fromJson(event['order']['content']) as T : null;

return MostroMessage<T>(
action: action,
Expand Down
2 changes: 1 addition & 1 deletion lib/data/models/nostr_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extension NostrEventExtensions on NostrEvent {
// Getters para acceder fácilmente a los tags específicos
String? get recipient => _getTagValue('p');
String? get orderId => _getTagValue('d');
OrderType? get orderType => OrderType.fromString(_getTagValue('k')!);
OrderType? get orderType => _getTagValue('k') != null ? OrderType.fromString(_getTagValue('k')!) : null;
String? get currency => _getTagValue('f');
String? get status => _getTagValue('s');
String? get amount => _getTagValue('amt');
Expand Down
22 changes: 9 additions & 13 deletions lib/presentation/widgets/currency_dropdown.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mostro_mobile/core/theme/app_theme.dart';
import 'package:mostro_mobile/providers/exchange_service_provider.dart';

class CurrencyDropdown extends ConsumerWidget {
Expand All @@ -13,18 +14,19 @@ class CurrencyDropdown extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final currencyCodesAsync = ref.watch(currencyCodesProvider);
final selectedFiatCode = ref.watch(selectedFiatCodeProvider) ?? '';
final selectedFiatCode = ref.watch(selectedFiatCodeProvider);

return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: const Color(0xFF1D212C),
color: AppTheme.dark1,
borderRadius: BorderRadius.circular(8),
),
child: currencyCodesAsync.when(
loading: () => const Center(
child: SizedBox(
height: double.infinity,
height: 24,
width: 24,
child: CircularProgressIndicator(),
),
),
Expand All @@ -43,7 +45,7 @@ class CurrencyDropdown extends ConsumerWidget {
value: code,
child: Text(
'$code - ${currencyCodes[code]}',
style: const TextStyle(color: Colors.white),
style: const TextStyle(color: AppTheme.cream1),
),
);
}).toList();
Expand All @@ -52,18 +54,12 @@ class CurrencyDropdown extends ConsumerWidget {
decoration: InputDecoration(
border: InputBorder.none,
labelText: label,
labelStyle: Theme.of(context).inputDecorationTheme.labelStyle,
labelStyle: const TextStyle(color: AppTheme.grey2),
),
dropdownColor: Theme.of(context).colorScheme.surface,
style: Theme.of(context).textTheme.bodyMedium,
dropdownColor: AppTheme.dark1,
style: TextStyle(color: AppTheme.cream1),
items: items,
value: selectedFiatCode,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please select a currency';
}
return null;
},
onChanged: (value) =>
ref.read(selectedFiatCodeProvider.notifier).state = value,
);
Expand Down

0 comments on commit ff12b49

Please sign in to comment.