Add validators, widget updates, tests, fixtures, test doubles and CI workflow - #9
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4409aa6b9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await widget.onSubmit?.call( | ||
| _emailController.text.trim(), | ||
| _passwordController.text, | ||
| ); |
There was a problem hiding this comment.
Reset submit state when login request fails
If onSubmit throws (for example, on a network/auth failure), the await exits _submit before _isSubmitting is set back to false, leaving the button disabled with a spinner and no way to retry in the same screen state. This makes transient backend errors effectively block the login UI until a rebuild, so the call should be wrapped in try/finally (and optionally surfaced as an error message).
Useful? React with 👍 / 👎.
| _error = null; | ||
| }); | ||
|
|
||
| final rows = await widget.onApplyFilters?.call(filters) ?? const <String>[]; |
There was a problem hiding this comment.
Clear admin loading state when filter fetch throws
A thrown exception from onApplyFilters skips the _isLoading = false update, so the Apply button stays disabled and the loading indicator persists indefinitely after a failing fetch. In production this can happen on API errors/timeouts and prevents users from retrying filters without leaving the page; use try/finally to always restore loading state.
Useful? React with 👍 / 👎.
Motivation
flutter testcommand.Description
lib/core/validation/input_validators.dartfor profile name, quantity, promo codes, and filters (date range and min-total checks).AuthScreensupportsonSubmitand submit state,CartScreensupports qty changes and total calculation, andAdminScreensupports report filters withonApplyFilters.test/including unit tests for validators,RefreshSessionUseCase, refresh-token interceptor behavior, and error mapper, widget tests for login/cart/admin UIs, and integration-style widget tests for auth flow, cart+checkout, and admin reports.test/doubles/mock_repositories.dartandtest/fixtures/*.json, and added a GitHub Actions workflow.github/workflows/ci.ymlplus aTestingsection inREADME.mddocumentingflutter test --reporter expanded.Testing
test/core/*,test/features/*), widget tests (test/widget/*), and integration-style widget tests (test/integration/*) but these are created and committed rather than executed here.flutter testlocally in this environment, but it could not be executed because the Flutter SDK is not available (flutter: command not found).flutter pub getandflutter test --reporter expandedin GitHub Actions via.github/workflows/ci.ymlso tests will run on push/PR in the repository environment.Codex Task