-
Notifications
You must be signed in to change notification settings - Fork 17
Display all payment methods in orders #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes update the display of payment methods in both the order list item widget and the take order screen. Instead of showing only the first payment method, all payment methods are now shown as a comma-separated string, with improved text overflow handling for better visual presentation. The underlying data extraction was also improved to correctly parse multiple payment methods from the event tags. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant OrderListItemWidget
participant OrderData
User->>OrderListItemWidget: View order card
OrderListItemWidget->>OrderData: Fetch paymentMethods list
OrderListItemWidget->>OrderListItemWidget: Join paymentMethods with commas
OrderListItemWidget->>User: Display all payment methods (comma-separated, ellipsis if overflow)
sequenceDiagram
participant User
participant TakeOrderScreen
participant OrderData
User->>TakeOrderScreen: View seller amount section
TakeOrderScreen->>OrderData: Fetch paymentMethods list
TakeOrderScreen->>TakeOrderScreen: Join paymentMethods with commas
TakeOrderScreen->>User: Display all payment methods (comma-separated, plural label)
Assessment against linked issues
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
lib/features/home/widgets/order_list_item.dart (1)
223-234: Good implementation with one clarity concern.The changes correctly implement the requirement to display all payment methods as a comma-separated string. The
Expandedwidget andTextOverflow.ellipsisare excellent additions for handling long payment method lists gracefully.However, the fallback text
'tm'is unclear and inconsistent with the more descriptive fallback used in the other file.Consider using a more descriptive fallback text:
- : 'tm', + : 'No payment methods',lib/features/order/screens/take_order_screen.dart (1)
63-65: Correct implementation with minor text inconsistency.The logic correctly joins all payment methods with commas and the variable name change to
methodsis appropriate for the plural context.Consider making the fallback text consistent with the plural label:
- : 'No payment method'; + : 'No payment methods';
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/features/home/widgets/order_list_item.dart(1 hunks)lib/features/order/screens/take_order_screen.dart(2 hunks)
🔇 Additional comments (1)
lib/features/order/screens/take_order_screen.dart (1)
88-88: Good label update to plural form.The label correctly reflects that multiple payment methods may be displayed.
Catrya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @AndreaDiazCorreia it's not working for me. Look at the event there with several payment methods, but only one is shown in the app.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lib/data/models/nostr_event.dart (1)
22-28: Collect payment methods from allpmtags, not just the first
firstWherestops at the first match, so any additionalpmtags in the event are silently ignored.
If the protocol ever allows (or already produces) severalpmtags – e.g. one per method – the current implementation will under-report methods and the UI will still show an incomplete list.- final tag = tags?.firstWhere((t) => t[0] == 'pm', orElse: () => []); - if (tag != null && tag.length > 1) { - return tag.sublist(1); - } - return []; + final pmTags = tags + ?.where((t) => t.isNotEmpty && t.first == 'pm') // robust guard + .toList() ?? + []; + + // Flatten and drop the 'pm' key + return pmTags.expand((t) => t.skip(1)).toList();This keeps the public contract unchanged (
List<String>⇢List<String>) while guaranteeing that every declared payment method is surfaced.
If multiplepmtags are indeed impossible, please add a short comment to document that assumption.
| final tag = tags?.firstWhere((t) => t[0] == 'pm', orElse: () => []); | ||
| if (tag != null && tag.length > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible RangeError when a tag is unexpectedly empty
The predicate t[0] == 'pm' assumes every tag contains at least one element. A malformed event with an empty tag ([]) would throw.
Using t.isNotEmpty && t.first == 'pm' (as in the diff above) removes that risk at negligible cost.
🤖 Prompt for AI Agents
In lib/data/models/nostr_event.dart around lines 23 to 24, the code assumes each
tag has at least one element by accessing t[0], which can cause a RangeError if
a tag is empty. To fix this, update the predicate in firstWhere to check that
the tag is not empty before accessing its first element, using t.isNotEmpty &&
t.first == 'pm' to safely avoid the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good suggestion conejito
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grunch ¡Gracias! Me alegra que la sugerencia te resulte útil. Si necesitas que prepare el diff con el ajuste (t.isNotEmpty && t.first == 'pm') o cualquier otra cosa, avísame y con gusto lo planifico. 🐇😊
|
@AndreaDiazCorreia funciona bien, excepto lo que señaló coderabbit, muestra |
Genial, gracias catrya, vamos a hacer merge asi, si mostrod sigue el estandar no debe ser necesaria esa validación, gracias andrea utACK |


Fix #115: Show all payment methods separated by commas in both order list items and detail view, instead of showing only the first method.
Summary by CodeRabbit