fix: reset payment methods when fiat currency changes (#352) - #353
Conversation
- Clear selected payment methods when user changes fiat currency - Clear custom payment method field and visibility flag - Prevents invalid payment methods being sent for wrong currency - Fixes #352
WalkthroughA Riverpod listener was added to monitor the Changes
Sequence DiagramsequenceDiagram
participant User
participant Screen as Add Order Screen
participant Provider as selectedFiatCodeProvider
participant Listener as Currency Change Listener
participant State as _AddOrderScreenState
User->>Provider: Changes fiat currency
Provider->>Listener: notifies (previous value → new value)
alt Previous value exists and widget mounted
Listener->>State: Clear _selectedPaymentMethods
Listener->>State: Set _showCustomPaymentMethod = false
Listener->>State: Clear _customPaymentMethodController
State->>Screen: Rebuild with reset state
else First load or widget unmounted
Listener->>Listener: Skip reset (no-op)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (4)lib/features/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.dart📄 CodeRabbit inference engine (AGENTS.md)
Files:
lib/**/*.dart📄 CodeRabbit inference engine (AGENTS.md)
Files:
lib/**/screens/**/*.dart📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-10-21T21:47:03.451ZApplied to files:
📚 Learning: 2025-10-22T12:29:26.971ZApplied to files:
🔇 Additional comments (1)
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. Comment |
Fixes #352 by automatically resetting payment methods when fiat currency changes using a Riverpod listener.
Summary by CodeRabbit
Release Notes