feat: add loading and error widget support for StacNetworkWidget#390
Closed
Potatomonsta wants to merge 4 commits intodevfrom
Closed
feat: add loading and error widget support for StacNetworkWidget#390Potatomonsta wants to merge 4 commits intodevfrom
Potatomonsta wants to merge 4 commits intodevfrom
Conversation
Add optional loadingWidget and errorWidget fields to StacNetworkWidget to allow custom widgets to be displayed during network request states. - Add loadingWidget and errorWidget as optional StacWidget? fields - Update StacNetworkWidgetParser to parse and pass widgets to Stac.fromNetwork - Update documentation with examples showing loading and error states
Contributor
WalkthroughAdds optional Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (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 |
packages/stac/lib/src/parsers/widgets/stac_network_widget/stac_network_widget_parser.dart
Show resolved
Hide resolved
Refactor the loading widget in StacNetworkWidgetParser to ensure a consistent loading experience by using Center with CircularProgressIndicator. This change improves the visual feedback during network requests.
…/stac into mn/network-widget-loader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for custom loading and error widgets in the
StacNetworkWidget. Users can now provide optionalloadingWidgetanderrorWidgetproperties that will be displayed during the network request lifecycle.Changes:
loadingWidgetanderrorWidgetas optionalStacWidget?fields toStacNetworkWidgetStacNetworkWidgetParserto parse these widgets and pass them toStac.fromNetworkas builder functionsExample Usage:
{ "type": "networkWidget", "request": { "actionType": "networkRequest", "url": "https://example.com/data", "method": "get" }, "loadingWidget": { "type": "center", "child": { "type": "circularProgressIndicator" } }, "errorWidget": { "type": "center", "child": { "type": "text", "data": "Failed to load" } } }Related Issues
Closes #243
Type of Change
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.