feat(ui): Move draftlist from sdk to sample app.#2637
feat(ui): Move draftlist from sdk to sample app.#2637
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@sample_app/lib/widgets/stream_draft_list_view.dart`:
- Around line 274-283: The _LoadMoreError widget currently hardcodes
Colors.white for the Text and Icon causing poor contrast in light themes; update
the build so both the Text(error) and Icon use theme-based foreground colors
instead (e.g., replace Colors.white with Theme.of(context).colorScheme.onSurface
or IconTheme.of(context).color) so the row respects current Theme brightness and
accessibility; ensure you access Theme.of(context) inside the widget's build
method and apply it to the TextStyle and Icon color.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 89458776-9b99-4084-9282-279707ad4860
⛔ Files ignored due to path filters (2)
packages/stream_chat_flutter/test/src/scroll_view/draft_scroll_view/goldens/ci/stream_draft_list_tile_dark.pngis excluded by!**/*.pngpackages/stream_chat_flutter/test/src/scroll_view/draft_scroll_view/goldens/ci/stream_draft_list_tile_light.pngis excluded by!**/*.png
📒 Files selected for processing (12)
docs/docs_screenshots/test/draft_list/draft_list_view_test.dartpackages/stream_chat_flutter/CHANGELOG.mdpackages/stream_chat_flutter/lib/src/theme/draft_list_tile_theme.dartpackages/stream_chat_flutter/lib/src/theme/stream_chat_theme.dartpackages/stream_chat_flutter/lib/src/theme/themes.dartpackages/stream_chat_flutter/lib/stream_chat_flutter.dartpackages/stream_chat_flutter/test/src/scroll_view/draft_scroll_view/stream_draft_list_tile_test.dartpackages/stream_chat_flutter/test/src/theme/draft_list_tile_theme_test.dartsample_app/lib/pages/draft_list_page.dartsample_app/lib/widgets/stream_draft_list_tile.dartsample_app/lib/widgets/stream_draft_list_tile_theme.dartsample_app/lib/widgets/stream_draft_list_view.dart
💤 Files with no reviewable changes (7)
- packages/stream_chat_flutter/lib/src/theme/themes.dart
- packages/stream_chat_flutter/test/src/theme/draft_list_tile_theme_test.dart
- packages/stream_chat_flutter/lib/stream_chat_flutter.dart
- docs/docs_screenshots/test/draft_list/draft_list_view_test.dart
- packages/stream_chat_flutter/test/src/scroll_view/draft_scroll_view/stream_draft_list_tile_test.dart
- packages/stream_chat_flutter/lib/src/theme/draft_list_tile_theme.dart
- packages/stream_chat_flutter/lib/src/theme/stream_chat_theme.dart
| return InkWell( | ||
| onTap: onTap, | ||
| child: Padding( | ||
| padding: const EdgeInsets.all(16), | ||
| child: Row( | ||
| mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| children: [ | ||
| Text(error, style: const TextStyle(color: Colors.white)), | ||
| const Icon(Icons.refresh, color: Colors.white), | ||
| ], |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, check if the file exists and get its structure
fd -t f "stream_draft_list_view.dart" sample_app/Repository: GetStream/stream-chat-flutter
Length of output: 124
🏁 Script executed:
# Read the file around the specified lines to verify the code
wc -l sample_app/lib/widgets/stream_draft_list_view.dartRepository: GetStream/stream-chat-flutter
Length of output: 128
🏁 Script executed:
# Get the specific lines mentioned in the review (274-283)
sed -n '270,290p' sample_app/lib/widgets/stream_draft_list_view.dartRepository: GetStream/stream-chat-flutter
Length of output: 589
🏁 Script executed:
# Also check for the _LoadMoreError widget definition
rg -n "_LoadMoreError" sample_app/lib/widgets/stream_draft_list_view.dart -A 30Repository: GetStream/stream-chat-flutter
Length of output: 2179
🏁 Script executed:
# Check if there's any styling or background color applied to the parent widgets
sed -n '200,210p' sample_app/lib/widgets/stream_draft_list_view.dartRepository: GetStream/stream-chat-flutter
Length of output: 493
🏁 Script executed:
# Search for the parent widget structure and any theming applied
rg -n "StreamDraftListView\|loadMoreErrorBuilder" sample_app/lib/widgets/stream_draft_list_view.dart -B 5 -A 15 | head -60Repository: GetStream/stream-chat-flutter
Length of output: 55
🏁 Script executed:
# Check for similar hardcoded colors in this file
rg -n "Colors\.white|Colors\.black" sample_app/lib/widgets/stream_draft_list_view.dartRepository: GetStream/stream-chat-flutter
Length of output: 211
🏁 Script executed:
# Look at the _ErrorWidget definition to see if it uses similar patterns
rg -n "_ErrorWidget" sample_app/lib/widgets/stream_draft_list_view.dart -A 25 | head -70Repository: GetStream/stream-chat-flutter
Length of output: 1083
Use theme-based colors for load-more error row instead of hardcoded white.
The hardcoded white text and icon at lines 281-282 become unreadable on light backgrounds, making the retry action inaccessible. Unlike _ErrorWidget which uses semantic widgets without hardcoding colors, _LoadMoreError forces white foreground without a guaranteed background, degrading visibility in light themes.
Suggested fix
`@override`
Widget build(BuildContext context) {
+ final errorColor = Theme.of(context).colorScheme.error;
+
return InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.all(16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(error, style: const TextStyle(color: Colors.white)),
- const Icon(Icons.refresh, color: Colors.white),
+ Text(error, style: TextStyle(color: errorColor)),
+ Icon(Icons.refresh, color: errorColor),
],
),
),
);
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sample_app/lib/widgets/stream_draft_list_view.dart` around lines 274 - 283,
The _LoadMoreError widget currently hardcodes Colors.white for the Text and Icon
causing poor contrast in light themes; update the build so both the Text(error)
and Icon use theme-based foreground colors instead (e.g., replace Colors.white
with Theme.of(context).colorScheme.onSurface or IconTheme.of(context).color) so
the row respects current Theme brightness and accessibility; ensure you access
Theme.of(context) inside the widget's build method and apply it to the TextStyle
and Icon color.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v10.0.0 #2637 +/- ##
===========================================
+ Coverage 67.04% 67.08% +0.03%
===========================================
Files 418 415 -3
Lines 25146 24985 -161
===========================================
- Hits 16860 16762 -98
+ Misses 8286 8223 -63 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Submit a pull request
CLA
Description of the pull request
Draft list was not supposed to be part of the sdk, so this is moved to the sample app.
Summary by CodeRabbit
Breaking Changes
Chores