[Scribe] Add toolbar with copy and retry action#4310
[Scribe] Add toolbar with copy and retry action#4310zatteo wants to merge 2 commits intofeat/scribe-tabletfrom
Conversation
To be able to reuse this color without loosing a correct semantic name.
|
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 You can disable this status message by setting the
WalkthroughThis PR adds a new suggestion success toolbar widget to the AI Scribe module with copy and retry functionality. It includes the new widget export in the public API, introduces localization entries for "copy" and "retry" across multiple languages (Arabic, German, English, French, Italian, Russian, Vietnamese), adds corresponding localization getters in ScribeLocalizations, and updates the suggestion success widget hierarchy to propagate a new onLoadSuggestion callback. Additionally, it renames AIScribeColors.bottomsheetIcon to secondaryIcon and updates related usage in mobile actions. Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@scribe/lib/scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_success_list_actions.dart`:
- Around line 32-38: The project uses the Row.spacing property (seen in
AiScribeSuggestionSuccessListActions where a Row with spacing: 8 is used), which
requires Flutter 3.10+, so update pubspec.yaml environment to include a Flutter
SDK constraint (for example flutter: ">=3.10.0") alongside the existing dart SDK
constraint to ensure the code compiles with the required Flutter version.
🧹 Nitpick comments (1)
scribe/lib/scribe/ai/presentation/utils/modal/ai_scribe_suggestion_state_mixin.dart (1)
101-111: Guard against overlapping retries to avoid stale suggestions.With the retry action now wired to
loadSuggestion(Line 110), rapid taps can trigger concurrent requests and allow a slower response to overwrite the latest result. Consider serializing or tracking the latest request and ignoring stale responses (or disabling retry while loading).♻️ Suggested guard against stale responses
class AiScribeSuggestionStateMixin<T extends StatefulWidget> on State<T> { + int _loadRequestId = 0; GenerateAITextInteractor? get interactor => _interactor; GenerateAITextInteractor? _interactor; @@ Future<void> loadSuggestion() async { + final requestId = ++_loadRequestId; _suggestionState.value = dartz.Right(GenerateAITextLoading()); @@ - if (!mounted) return; + if (!mounted || requestId != _loadRequestId) return;
| return Column( | ||
| children: [ | ||
| if (hasContent) | ||
| Flexible( | ||
| child: Container( | ||
| constraints: const BoxConstraints(minWidth: 67), | ||
| height: 36, | ||
| child: ConfirmDialogButton( | ||
| label: AiScribeSuggestionActions.replace.getLabel(localizations), | ||
| textColor: AppColor.primaryMain, | ||
| onTapAction: () { | ||
| Navigator.of(context).pop(); | ||
| onSelectAction( | ||
| AiScribeSuggestionActions.replace, | ||
| suggestionText, | ||
| ); | ||
| }, | ||
| AiScribeSuggestionSuccessToolbar(suggestionText: suggestionText, onLoadSuggestion: onLoadSuggestion, imagePaths: imagePaths), | ||
| Row( | ||
| mainAxisAlignment: MainAxisAlignment.end, | ||
| spacing: 8, | ||
| children: [ |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check Flutter version constraints in pubspec.yaml files
echo "=== Checking Flutter version constraints ==="
fd -t f 'pubspec.yaml' --exec cat {} \; 2>/dev/null | grep -A 10 'environment:' | head -30Repository: linagora/tmail-flutter
Length of output: 530
🏁 Script executed:
#!/bin/bash
# Find and read the main pubspec.yaml file
echo "=== Finding pubspec.yaml files ==="
fd -t f 'pubspec.yaml' | head -5
echo -e "\n=== Reading main pubspec.yaml ==="
cat pubspec.yaml 2>/dev/null || echo "Not in root"
echo -e "\n=== Searching for flutter: version constraint ==="
rg -A 5 'flutter:' pubspec.yaml 2>/dev/null | head -30Repository: linagora/tmail-flutter
Length of output: 10521
Add explicit Flutter version constraint to pubspec.yaml.
The code uses the spacing property on Row (Flutter 3.10+), but pubspec.yaml does not specify a minimum Flutter version. Currently, only the Dart SDK is constrained (>=3.0.0 <4.0.0). Add an explicit Flutter version requirement to ensure compatibility:
environment:
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0"🤖 Prompt for AI Agents
In
`@scribe/lib/scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_success_list_actions.dart`
around lines 32 - 38, The project uses the Row.spacing property (seen in
AiScribeSuggestionSuccessListActions where a Row with spacing: 8 is used), which
requires Flutter 3.10+, so update pubspec.yaml environment to include a Flutter
SDK constraint (for example flutter: ">=3.10.0") alongside the existing dart SDK
constraint to ensure the code compiles with the required Flutter version.
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
It simply warns us to avoid runtime errors when running our project on a Flutter version below 3.10 using spacing in Row/Column. IMO, you can ignore it for now; we'll update it fully when we upgrade to a newer Flutter version.
|
This PR has been deployed to https://linagora.github.io/tmail-flutter/4310. |
...ib/scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_success_toolbar.dart
Outdated
Show resolved
Hide resolved
Actions : - copy - regenerate
5fb0172 to
d456975
Compare
Demo
Screen.Recording.2026-02-04.at.15.24.10.mov
Screen.Recording.2026-02-04.at.15.34.34.mov
Summary by CodeRabbit
New Features
Style