Skip to content

Conversation

@Catrya
Copy link
Member

@Catrya Catrya commented Jul 22, 2025

  • Updated modal UI with a more elegant design.
  • Added confirmation modals for Release and Dispute buttons.
  • Added Contact, Dispute, Cancel, and Release buttons to missing screens.
  • Changed button text color from white to black and applied bold style for better visibility.

Summary by CodeRabbit

  • New Features

    • Added support for localized button labels and dialog messages in English, Spanish, and Italian, including new prompts for trade cancellation, dispute initiation, and Bitcoin release.
    • Introduced a new option to customize button text color in interactive buttons.
  • Improvements

    • Standardized button appearance and layout for trade actions, with consistent sizing and confirmation dialogs for critical actions.
    • Enhanced trade action workflows with clearer contact options during cooperative cancellations and disputes.
    • Updated button text styles to use bold, black text for improved readability.
  • Bug Fixes

    • Button labels now adapt to the selected language, improving internationalization throughout the app.
  • Tests

    • Updated and expanded mock classes to support new service methods and workflows.

- Updated modal UI with a more elegant design.
- Added confirmation modals for Release and Dispute buttons.
- Added Contact, Dispute, Cancel, and Release buttons to missing screens.
- Changed button text color from white to black and applied bold style for better visibility.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

Walkthrough

This update introduces UI, localization, and state management refinements. It enhances button theming and layout, adds confirmation dialogs for critical actions, and improves internationalization by updating localization files and dynamic string usage. The order state logic is expanded to handle cooperative cancellation and dispute actions with greater granularity. Mock classes are regenerated to reflect new and updated interfaces.

Changes

File(s) Change Summary
lib/core/app_theme.dart
lib/shared/widgets/custom_elevated_button.dart
Updated elevated button theme: text color set to black, font weight set to bold, added fixed/minimum size and tap target settings. Custom button widget updated for consistent bold text and foreground color.
lib/features/order/models/order_state.dart Expanded the actions map to support cooperative cancellation and dispute states for both buyer and seller roles, defining new transitions and allowed actions.
lib/features/trades/screens/trade_detail_screen.dart Refactored UI button layout and logic: centralized confirmation dialogs for cancel/dispute/release actions, standardized button sizing, improved contact button logic for cooperative cancel status, and updated button styling. Added helper methods for dialog and button construction. Minor formatting improvements.
lib/l10n/intl_en.arb
lib/l10n/intl_es.arb
lib/l10n/intl_it.arb
Added and modified localization strings for navigation, trade actions, dialog titles/contents, and button labels in English, Spanish, and Italian. Shortened some labels and added new dialog prompts.
lib/features/order/screens/order_confirmation_screen.dart
lib/features/order/widgets/action_buttons.dart
Replaced hardcoded button labels with localized strings for internationalization. Explicitly set foreground color for submit button.
lib/shared/widgets/mostro_reactive_button.dart Added optional foregroundColor property to MostroReactiveButton, updating the style logic to support both background and foreground color overrides.
test/mocks.mocks.dart Regenerated mocks with updated import aliases, type references, and new mock methods to support extended interfaces and domain logic. Added/renamed fake classes for new types and methods.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TradeDetailScreen
    participant Dialog
    participant OrderState

    User->>TradeDetailScreen: Tap "Cancel", "Dispute", or "Release" button
    TradeDetailScreen->>Dialog: Show confirmation dialog
    Dialog-->>User: Await confirmation
    alt User confirms
        Dialog->>TradeDetailScreen: Return confirmation
        TradeDetailScreen->>OrderState: Perform action (cancel/dispute/release)
    else User cancels
        Dialog->>TradeDetailScreen: Cancel action, reset loading state
    end
Loading

Estimated code review effort

4 (~80 minutes)

Possibly related PRs

Suggested reviewers

  • grunch

Poem

In a meadow of buttons, bold and bright,
Rabbits hop to dialogs, confirming left and right.
With actions now clearer, and languages anew,
Trades and disputes—handled with a view!
So let's leap through these changes, with carrot in hand,
For code that's more friendly, across every land. 🥕✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 227d5b2 and 489277d.

📒 Files selected for processing (3)
  • lib/features/trades/screens/trade_detail_screen.dart (11 hunks)
  • lib/l10n/intl_es.arb (5 hunks)
  • lib/l10n/intl_it.arb (5 hunks)
📓 Path-based instructions (2)
lib/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

lib/**/*.dart: Use S.of(context).yourKey for all user-facing strings
Always check mounted before using context after async operations

Files:

  • lib/features/trades/screens/trade_detail_screen.dart
**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

**/*.dart: Remove unused imports and dependencies
Use const constructors where possible

Files:

  • lib/features/trades/screens/trade_detail_screen.dart
🧠 Learnings (1)
lib/features/trades/screens/trade_detail_screen.dart (5)

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/**/*.dart : Always check mounted before using context after async operations

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

Learnt from: chebizarro
PR: #127
File: lib/features/order/notfiers/abstract_mostro_notifier.dart:45-54
Timestamp: 2025-06-26T15:03:23.529Z
Learning: In AbstractMostroNotifier, state updates occur for all messages regardless of timestamp to hydrate the OrderNotifier from MostroStorage during sync, while handleEvent is only called for recent messages (within 60 seconds) to prevent re-triggering side effects like notifications and navigation for previously handled messages. This design prevents displaying stale notifications when the app is reopened or brought to the foreground.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

✅ Files skipped from review due to trivial changes (1)
  • lib/l10n/intl_es.arb
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/l10n/intl_it.arb
🧰 Additional context used
📓 Path-based instructions (2)
lib/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

lib/**/*.dart: Use S.of(context).yourKey for all user-facing strings
Always check mounted before using context after async operations

Files:

  • lib/features/trades/screens/trade_detail_screen.dart
**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

**/*.dart: Remove unused imports and dependencies
Use const constructors where possible

Files:

  • lib/features/trades/screens/trade_detail_screen.dart
🧠 Learnings (1)
lib/features/trades/screens/trade_detail_screen.dart (5)

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/**/*.dart : Always check mounted before using context after async operations

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

Learnt from: chebizarro
PR: #127
File: lib/features/order/notfiers/abstract_mostro_notifier.dart:45-54
Timestamp: 2025-06-26T15:03:23.529Z
Learning: In AbstractMostroNotifier, state updates occur for all messages regardless of timestamp to hydrate the OrderNotifier from MostroStorage during sync, while handleEvent is only called for recent messages (within 60 seconds) to prevent re-triggering side effects like notifications and navigation for previously handled messages. This design prevents displaying stale notifications when the app is reopened or brought to the foreground.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (14)
lib/features/trades/screens/trade_detail_screen.dart (14)

82-82: LGTM: Improved button layout refactoring

The replacement of the old button layout with _buildButtonRow improves consistency and maintainability by centralizing button layout logic.


239-241: LGTM: Enhanced status handling for cooperative cancellation

Good addition of Status.cooperativelyCanceled to the cancel action conditions, ensuring proper handling of the cooperative cancellation flow.


251-263: LGTM: Dynamic button text based on cancellation context

Excellent implementation of context-aware button text that changes based on whether the user is accepting a peer's cancellation request or initiating their own cancellation.


312-316: LGTM: Centralized dispute button creation

Good refactoring to use a dedicated _buildDisputeButton method for consistency with other confirmation dialog patterns.


321-398: LGTM: Proper mounted state checking implemented

The release button confirmation dialog correctly implements the mounted state check after the async operation, addressing the previous review concern. The dialog styling is consistent and user-friendly.


432-432: LGTM: Enhanced UX for cooperative cancellation

Adding a contact button when the user has initiated a cooperative cancellation provides better user experience by enabling communication during the pending state.


490-498: LGTM: Comprehensive contact button handling

Good logic to ensure contact buttons are available for cooperatively canceled trades, with proper deduplication to avoid adding multiple contact buttons.


525-601: LGTM: Well-structured cancel confirmation dialog

The _buildCancelButton method provides a clean, reusable confirmation dialog with proper styling and localization. The implementation correctly handles user confirmation before proceeding with cancellation.


603-676: LGTM: Consistent dispute confirmation dialog

The _buildDisputeButton method follows the same pattern as the cancel button, providing consistent UX for critical actions with proper confirmation dialogs.


690-737: LGTM: Improved button layout with consistent sizing

The new _buildButtonRow method provides excellent responsive button layout:

  • Single buttons remain naturally centered
  • Two buttons get equal width distribution
  • Multiple buttons use wrap layout with minimum width constraints
  • Consistent height (48px) and border radius (24px) for visual uniformity

This is a significant UX improvement.


743-761: LGTM: Enhanced close button styling

The close button styling improvements provide better visual consistency with explicit styling parameters including padding, shape, and minimum size constraints.


945-945: Minor formatting improvement

Clean code formatting improvement in the countdown widget calculation.


985-987: LGTM: Improved message filtering logic

Good enhancement to filter out messages with invalid timestamps before processing, improving robustness of the countdown timer logic.


999-1001: LGTM: Enhanced timestamp validation

Additional validation to prevent processing messages with future timestamps improves the reliability of the countdown timer functionality.


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (1)
test/mocks.mocks.dart (1)

1-2180: Do not manually edit generated mock files

This is a generated file created by Mockito. According to the coding guidelines, generated files (*.mocks.dart) should never be manually edited. If there are issues with the mocks, regenerate them using:

dart run build_runner build -d
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 47ca757 and 3f439a0.

📒 Files selected for processing (8)
  • lib/core/app_theme.dart (1 hunks)
  • lib/features/order/models/order_state.dart (4 hunks)
  • lib/features/trades/screens/trade_detail_screen.dart (7 hunks)
  • lib/l10n/intl_en.arb (4 hunks)
  • lib/l10n/intl_es.arb (5 hunks)
  • lib/l10n/intl_it.arb (5 hunks)
  • lib/shared/widgets/custom_elevated_button.dart (1 hunks)
  • test/mocks.mocks.dart (57 hunks)
📓 Path-based instructions (8)
lib/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

lib/**/*.dart: Use S.of(context).yourKey for all user-facing strings
Always check mounted before using context after async operations

Files:

  • lib/shared/widgets/custom_elevated_button.dart
  • lib/core/app_theme.dart
  • lib/features/order/models/order_state.dart
  • lib/features/trades/screens/trade_detail_screen.dart
**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

**/*.dart: Remove unused imports and dependencies
Use const constructors where possible

Files:

  • lib/shared/widgets/custom_elevated_button.dart
  • lib/core/app_theme.dart
  • lib/features/order/models/order_state.dart
  • lib/features/trades/screens/trade_detail_screen.dart
  • test/mocks.mocks.dart
lib/l10n/intl_{en,es,it}.arb

📄 CodeRabbit Inference Engine (CLAUDE.md)

Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Files:

  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
lib/l10n/*.arb

📄 CodeRabbit Inference Engine (CLAUDE.md)

Use proper ARB metadata for parameterized strings

Files:

  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
lib/l10n/**

📄 CodeRabbit Inference Engine (CLAUDE.md)

Internationalization files are located in lib/l10n/

Files:

  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
{**/*.g.dart,**/*.mocks.dart,lib/generated/**}

📄 CodeRabbit Inference Engine (CLAUDE.md)

{**/*.g.dart,**/*.mocks.dart,lib/generated/**}: NEVER manually edit generated files (*.g.dart, *.mocks.dart, lib/generated/)
NEVER add individual ignore comments (e.g., // ignore: must_be_immutable) to generated files (*.g.dart, *.mocks.dart, lib/generated/)
If analyzer issues exist in generated files, regenerate them using dart run build_runner build -d instead of adding ignore comments

Files:

  • test/mocks.mocks.dart
test/mocks.mocks.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

test/mocks.mocks.dart: DO NOT modify test/mocks.mocks.dart - it already has file-level ignores
Mock files (test/mocks.mocks.dart) should only have file-level // ignore_for_file: must_be_immutable and not individual ignores

Files:

  • test/mocks.mocks.dart
test/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

Unit tests should be placed in the test/ directory

Files:

  • test/mocks.mocks.dart
🧠 Learnings (7)
lib/shared/widgets/custom_elevated_button.dart (1)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: All changes should pass flutter analyze before commit

lib/l10n/intl_en.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

lib/features/order/models/order_state.dart (3)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

lib/l10n/intl_es.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

lib/l10n/intl_it.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

lib/features/trades/screens/trade_detail_screen.dart (2)

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

test/mocks.mocks.dart (22)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to test/mocks.dart : Mocks are generated using Mockito in test/mocks.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to test/mocks.mocks.dart : DO NOT modify test/mocks.mocks.dart - it already has file-level ignores

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to test/mocks.mocks.dart : Mock files (test/mocks.mocks.dart) should only have file-level // ignore_for_file: must_be_immutable and not individual ignores

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to {/*.g.dart,/*.mocks.dart,lib/generated/**} : NEVER manually edit generated files (*.g.dart, *.mocks.dart, lib/generated/)

Learnt from: chebizarro
PR: #110
File: test/notifiers/take_order_notifier_test.dart:72-74
Timestamp: 2025-06-04T19:35:20.209Z
Learning: MostroService methods like takeBuyOrder() and takeSellOrder() return Future and trigger side effects through other mechanisms rather than direct return values. When testing these methods, focus on verifying method calls and testing state changes through the provider system rather than mocking return values.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to {/*.g.dart,/*.mocks.dart,lib/generated/**} : NEVER add individual ignore comments (e.g., // ignore: must_be_immutable) to generated files (*.g.dart, *.mocks.dart, lib/generated/)

Learnt from: chebizarro
PR: #74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, Riverpod code generation is used with @Riverpod annotations. Providers like eventStorageProvider are generated in .g.dart files from annotated functions in the main provider files. These providers are accessible by importing the main provider file (e.g., mostro_service_provider.dart), not by importing a separate provider file.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to **/*.dart : Remove unused imports and dependencies

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Use Riverpod for all state management

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/background/**/*.dart : Background services are implemented in the background/ directory

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/repositories/**/*.dart : All data access should go through repository classes in data/repositories/

Learnt from: Catrya
PR: #215
File: lib/features/order/notfiers/order_notifier.dart:0-0
Timestamp: 2025-07-20T23:33:17.689Z
Learning: In AbstractMostroNotifier, the handleEvent method is synchronous and returns void, not Future. Do not suggest adding await to super.handleEvent() calls as this would cause compilation errors.

Learnt from: Catrya
PR: #215
File: lib/features/order/notfiers/order_notifier.dart:0-0
Timestamp: 2025-07-20T23:33:17.689Z
Learning: In AbstractMostroNotifier, the handleEvent method is synchronous and returns void, not Future. Do not suggest adding await to super.handleEvent() calls as this would cause compilation errors.

Learnt from: Catrya
PR: #215
File: lib/features/order/notfiers/order_notifier.dart:0-0
Timestamp: 2025-07-20T23:33:17.689Z
Learning: In AbstractMostroNotifier, the handleEvent method is synchronous and returns void, not Future. Do not suggest adding await to super.handleEvent() calls as this would cause compilation errors.

Learnt from: chebizarro
PR: #74
File: lib/notifications/notification_service.dart:54-59
Timestamp: 2025-05-08T16:31:29.582Z
Learning: In the Nostr protocol, event.id will never be null in events returned by relay subscriptions, so null safety checks for this property are unnecessary.

Learnt from: chebizarro
PR: #74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, eventStorageProvider is exported from package:mostro_mobile/shared/providers/mostro_service_provider.dart and not from a separate event_storage_provider.dart file.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: chebizarro
PR: #74
File: lib/services/mostro_service.dart:97-103
Timestamp: 2025-05-06T15:49:55.079Z
Learning: In the Mostro protocol, an order cannot be canceled unless it has a valid orderId, so null checks on orderId during cancel operations are unnecessary.

🪛 RuboCop (1.76.1)
lib/l10n/intl_es.arb

[warning] 549-549: Duplicated key in hash literal.

(Lint/DuplicateHashKey)

lib/l10n/intl_it.arb

[warning] 564-564: Duplicated key in hash literal.

(Lint/DuplicateHashKey)

🧰 Additional context used
📓 Path-based instructions (8)
lib/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

lib/**/*.dart: Use S.of(context).yourKey for all user-facing strings
Always check mounted before using context after async operations

Files:

  • lib/shared/widgets/custom_elevated_button.dart
  • lib/core/app_theme.dart
  • lib/features/order/models/order_state.dart
  • lib/features/trades/screens/trade_detail_screen.dart
**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

**/*.dart: Remove unused imports and dependencies
Use const constructors where possible

Files:

  • lib/shared/widgets/custom_elevated_button.dart
  • lib/core/app_theme.dart
  • lib/features/order/models/order_state.dart
  • lib/features/trades/screens/trade_detail_screen.dart
  • test/mocks.mocks.dart
lib/l10n/intl_{en,es,it}.arb

📄 CodeRabbit Inference Engine (CLAUDE.md)

Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Files:

  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
lib/l10n/*.arb

📄 CodeRabbit Inference Engine (CLAUDE.md)

Use proper ARB metadata for parameterized strings

Files:

  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
lib/l10n/**

📄 CodeRabbit Inference Engine (CLAUDE.md)

Internationalization files are located in lib/l10n/

Files:

  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
  • lib/l10n/intl_it.arb
{**/*.g.dart,**/*.mocks.dart,lib/generated/**}

📄 CodeRabbit Inference Engine (CLAUDE.md)

{**/*.g.dart,**/*.mocks.dart,lib/generated/**}: NEVER manually edit generated files (*.g.dart, *.mocks.dart, lib/generated/)
NEVER add individual ignore comments (e.g., // ignore: must_be_immutable) to generated files (*.g.dart, *.mocks.dart, lib/generated/)
If analyzer issues exist in generated files, regenerate them using dart run build_runner build -d instead of adding ignore comments

Files:

  • test/mocks.mocks.dart
test/mocks.mocks.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

test/mocks.mocks.dart: DO NOT modify test/mocks.mocks.dart - it already has file-level ignores
Mock files (test/mocks.mocks.dart) should only have file-level // ignore_for_file: must_be_immutable and not individual ignores

Files:

  • test/mocks.mocks.dart
test/**/*.dart

📄 CodeRabbit Inference Engine (CLAUDE.md)

Unit tests should be placed in the test/ directory

Files:

  • test/mocks.mocks.dart
🧠 Learnings (7)
lib/shared/widgets/custom_elevated_button.dart (1)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: All changes should pass flutter analyze before commit

lib/l10n/intl_en.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

lib/features/order/models/order_state.dart (3)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

lib/l10n/intl_es.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

lib/l10n/intl_it.arb (2)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/intl_{en,es,it}.arb : Add new localization keys to all three ARB files (intl_en.arb, intl_es.arb, intl_it.arb)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/l10n/*.arb : Use proper ARB metadata for parameterized strings

lib/features/trades/screens/trade_detail_screen.dart (2)

Learnt from: chebizarro
PR: #74
File: lib/features/trades/models/trade_state.dart:1-15
Timestamp: 2025-05-08T16:06:33.665Z
Learning: In the context of the Mostro Mobile app, the TradeState class is specifically constructed using the tradeStateProvider. While some fields are nullable (lastAction and orderPayload), they are still marked as required parameters to ensure they are explicitly considered during state construction.

Learnt from: chebizarro
PR: #110
File: lib/features/trades/widgets/mostro_message_detail_widget.dart:134-141
Timestamp: 2025-06-08T23:54:09.987Z
Learning: In the OrderState refactor, public keys should be accessed via tradeState.peer?.publicKey from the OrderState instance rather than through session?.peer?.publicKey, as the OrderState encapsulates peer information directly.

test/mocks.mocks.dart (22)

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to test/mocks.dart : Mocks are generated using Mockito in test/mocks.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to test/mocks.mocks.dart : DO NOT modify test/mocks.mocks.dart - it already has file-level ignores

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to test/mocks.mocks.dart : Mock files (test/mocks.mocks.dart) should only have file-level // ignore_for_file: must_be_immutable and not individual ignores

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to {/*.g.dart,/*.mocks.dart,lib/generated/**} : NEVER manually edit generated files (*.g.dart, *.mocks.dart, lib/generated/)

Learnt from: chebizarro
PR: #110
File: test/notifiers/take_order_notifier_test.dart:72-74
Timestamp: 2025-06-04T19:35:20.209Z
Learning: MostroService methods like takeBuyOrder() and takeSellOrder() return Future and trigger side effects through other mechanisms rather than direct return values. When testing these methods, focus on verifying method calls and testing state changes through the provider system rather than mocking return values.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/services/nostr_service.dart : Nostr protocol interactions go through services/nostr_service.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to {/*.g.dart,/*.mocks.dart,lib/generated/**} : NEVER add individual ignore comments (e.g., // ignore: must_be_immutable) to generated files (*.g.dart, *.mocks.dart, lib/generated/)

Learnt from: chebizarro
PR: #74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, Riverpod code generation is used with @Riverpod annotations. Providers like eventStorageProvider are generated in .g.dart files from annotated functions in the main provider files. These providers are accessible by importing the main provider file (e.g., mostro_service_provider.dart), not by importing a separate provider file.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to **/*.dart : Remove unused imports and dependencies

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/models.dart : Models should be exported through data/models.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/shared/providers/mostro_database_provider.dart : Database initialization is in shared/providers/mostro_database_provider.dart

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Use Riverpod for all state management

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/background/**/*.dart : Background services are implemented in the background/ directory

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/features//providers/**/.dart : Providers are organized by feature in features/{feature}/providers/

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/data/repositories/**/*.dart : All data access should go through repository classes in data/repositories/

Learnt from: Catrya
PR: #215
File: lib/features/order/notfiers/order_notifier.dart:0-0
Timestamp: 2025-07-20T23:33:17.689Z
Learning: In AbstractMostroNotifier, the handleEvent method is synchronous and returns void, not Future. Do not suggest adding await to super.handleEvent() calls as this would cause compilation errors.

Learnt from: Catrya
PR: #215
File: lib/features/order/notfiers/order_notifier.dart:0-0
Timestamp: 2025-07-20T23:33:17.689Z
Learning: In AbstractMostroNotifier, the handleEvent method is synchronous and returns void, not Future. Do not suggest adding await to super.handleEvent() calls as this would cause compilation errors.

Learnt from: Catrya
PR: #215
File: lib/features/order/notfiers/order_notifier.dart:0-0
Timestamp: 2025-07-20T23:33:17.689Z
Learning: In AbstractMostroNotifier, the handleEvent method is synchronous and returns void, not Future. Do not suggest adding await to super.handleEvent() calls as this would cause compilation errors.

Learnt from: chebizarro
PR: #74
File: lib/notifications/notification_service.dart:54-59
Timestamp: 2025-05-08T16:31:29.582Z
Learning: In the Nostr protocol, event.id will never be null in events returned by relay subscriptions, so null safety checks for this property are unnecessary.

Learnt from: chebizarro
PR: #74
File: lib/services/mostro_service.dart:70-76
Timestamp: 2025-05-06T15:49:26.443Z
Learning: In the Mostro Mobile codebase, eventStorageProvider is exported from package:mostro_mobile/shared/providers/mostro_service_provider.dart and not from a separate event_storage_provider.dart file.

Learnt from: CR
PR: MostroP2P/mobile#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T01:48:43.335Z
Learning: Applies to lib/core/mostro_fsm.dart : Order state transitions are managed by core/mostro_fsm.dart

Learnt from: chebizarro
PR: #74
File: lib/services/mostro_service.dart:97-103
Timestamp: 2025-05-06T15:49:55.079Z
Learning: In the Mostro protocol, an order cannot be canceled unless it has a valid orderId, so null checks on orderId during cancel operations are unnecessary.

🪛 RuboCop (1.76.1)
lib/l10n/intl_es.arb

[warning] 549-549: Duplicated key in hash literal.

(Lint/DuplicateHashKey)

lib/l10n/intl_it.arb

[warning] 564-564: Duplicated key in hash literal.

(Lint/DuplicateHashKey)

🔇 Additional comments (10)
lib/shared/widgets/custom_elevated_button.dart (1)

32-32: LGTM! Button styling improvements are well implemented.

The changes consistently update the button appearance:

  • Default foreground color changed from cream to black for better readability
  • Bold font weight applied for improved visibility
  • Color consistency maintained between foregroundColor and text color

These changes align with the PR objectives to improve UI readability.

Also applies to: 39-42

lib/core/app_theme.dart (1)

109-109: LGTM! Theme updates ensure consistent button styling.

The elevated button theme changes align perfectly with the custom button widget updates:

  • Black foreground color improves text visibility
  • Bold font weight enhances readability
  • Global theme consistency maintained

These changes support the PR's goal of improving button text visibility across the app.

Also applies to: 112-112

lib/l10n/intl_en.arb (1)

77-77: Localization keys verified across all languages

All new dialog keys are present in intl_en.arb, intl_es.arb, and intl_it.arb:

  • “disputeTradeDialogTitle” (en:238, es:564, it:579)
  • “releaseTradeDialogTitle” (en:272, es:226, it:235)
  • “areYouSureRelease” (en:273, es:227, it:236)

Localization updates are consistent and contextually appropriate. Approving these changes.

lib/l10n/intl_it.arb (2)

77-77: LGTM! Italian localization properly mirrors English changes.

The Italian localization updates are consistent:

  • Button labels appropriately translated ("RATE", "ANNULLA")
  • New dialog strings added for dispute and release confirmations
  • Translations are contextually appropriate

These changes maintain localization consistency across the app.

Also applies to: 471-471, 579-580, 235-237


564-564: No duplicate key found in intl_it.arb.
Static analysis of lib/l10n/intl_it.arb did not surface any duplicate keys—the acceptCancelButton key appears only once (see lines 560–570). You can disregard the duplicate-key warning.

Likely an incorrect or invalid review comment.

lib/features/order/models/order_state.dart (1)

287-290: LGTM! State machine extensions properly support new workflows.

The order state extensions are well-implemented:

  • New cooperativelyCanceled and dispute status mappings added with appropriate actions
  • Role-based action definitions maintain consistency between seller and buyer perspectives
  • Action flows are logical (e.g., allowing dispute and sendDm in cooperative cancel states)
  • Existing status mappings properly extended with new cooperative cancel actions

These changes provide the necessary state machine support for the new confirmation dialogs and UI workflows introduced in the PR.

Also applies to: 297-309, 328-352, 403-406, 414-422, 441-461

lib/l10n/intl_es.arb (2)

226-228: New localization keys are present in all ARB files

Both releaseTradeDialogTitle and areYouSureRelease have been added to:

  • lib/l10n/intl_en.arb (lines 272–273)
  • lib/l10n/intl_es.arb (lines 226–227)
  • lib/l10n/intl_it.arb (lines 235–236)

No further changes needed.


564-566: All new dispute dialog localization keys are present in all ARB files
Verified that both disputeTradeDialogTitle and disputeTradeDialogContent have been added to:

  • lib/l10n/intl_en.arb (lines 238–239)
  • lib/l10n/intl_es.arb (lines 564–565)
  • lib/l10n/intl_it.arb (lines 579–580)

No further action required.

lib/features/trades/screens/trade_detail_screen.dart (2)

83-84: Good UI improvement with consistent spacing

The change to WrapAlignment.spaceEvenly with consistent 8px spacing improves the button layout uniformity.


534-685: Well-structured dialog helper methods

The _buildCancelButton and _buildDisputeButton helper methods are well-implemented with:

  • Consistent dialog styling and structure
  • Proper handling of user confirmation
  • Clear separation of concerns

This refactoring improves code maintainability and readability.

@Catrya Catrya merged commit f18953b into main Jul 22, 2025
2 checks passed
@Catrya Catrya deleted the improve-buttons branch July 29, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants