Add a toolbar to execute quick actions to Scribe suggestion
Actions : - copy - regenerate
This commit is contained in:
@@ -45,6 +45,7 @@ export 'scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_hea
|
|||||||
export 'scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_loading.dart';
|
export 'scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_loading.dart';
|
||||||
export 'scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_success.dart';
|
export 'scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_success.dart';
|
||||||
export 'scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_success_list_actions.dart';
|
export 'scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_success_list_actions.dart';
|
||||||
|
export 'scribe/ai/presentation/widgets/modal/suggestion/ai_scribe_suggestion_success_toolbar.dart';
|
||||||
export 'scribe/ai/presentation/widgets/overlay/ai_selection_overlay.dart';
|
export 'scribe/ai/presentation/widgets/overlay/ai_selection_overlay.dart';
|
||||||
export 'scribe/ai/presentation/widgets/search/ai_scribe_bar.dart';
|
export 'scribe/ai/presentation/widgets/search/ai_scribe_bar.dart';
|
||||||
export 'scribe/ai/presentation/widgets/mobile/ai_scribe_mobile_actions_bottom_sheet.dart';
|
export 'scribe/ai/presentation/widgets/mobile/ai_scribe_mobile_actions_bottom_sheet.dart';
|
||||||
|
|||||||
@@ -125,5 +125,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"copy": "نسخ",
|
||||||
|
"@copy": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"retry": "إعادة المحاولة",
|
||||||
|
"@retry": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,5 +125,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"copy": "Kopieren",
|
||||||
|
"@copy": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"retry": "Erneut versuchen",
|
||||||
|
"@retry": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,5 +125,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"copy": "Copy",
|
||||||
|
"@copy": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"retry": "Retry",
|
||||||
|
"@retry": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,5 +125,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"copy": "Copier",
|
||||||
|
"@copy": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"retry": "Réessayer",
|
||||||
|
"@retry": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,5 +125,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"copy": "Copia",
|
||||||
|
"@copy": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"retry": "Riprova",
|
||||||
|
"@retry": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2026-01-26T09:26:56.495094",
|
"@@last_modified": "2026-02-04T15:15:31.191557",
|
||||||
"categoryCorrectGrammar": "Correct",
|
"categoryCorrectGrammar": "Correct",
|
||||||
"@categoryCorrectGrammar": {
|
"@categoryCorrectGrammar": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -125,5 +125,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"copy": "Copy",
|
||||||
|
"@copy": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"retry": "Retry",
|
||||||
|
"@retry": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,5 +125,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"copy": "Копировать",
|
||||||
|
"@copy": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"retry": "Повторить",
|
||||||
|
"@retry": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,5 +125,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"copy": "Sao chép",
|
||||||
|
"@copy": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"retry": "Thử lại",
|
||||||
|
"@retry": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,6 +177,21 @@ class ScribeLocalizations {
|
|||||||
name: 'insert',
|
name: 'insert',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Suggestion Success Toolbar
|
||||||
|
String get copy {
|
||||||
|
return Intl.message(
|
||||||
|
'Copy',
|
||||||
|
name: 'copy',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get retry {
|
||||||
|
return Intl.message(
|
||||||
|
'Retry',
|
||||||
|
name: 'retry',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ScribeLocalizationsDelegate
|
class _ScribeLocalizationsDelegate
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ mixin AiScribeSuggestionStateMixin<T extends StatefulWidget> on State<T> {
|
|||||||
suggestionText: suggestionText,
|
suggestionText: suggestionText,
|
||||||
hasContent: hasContent,
|
hasContent: hasContent,
|
||||||
onSelectAction: onSelectAction,
|
onSelectAction: onSelectAction,
|
||||||
|
onLoadSuggestion: loadSuggestion,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
@@ -7,12 +7,14 @@ class AiScribeSuggestionSuccess extends StatelessWidget {
|
|||||||
final String suggestionText;
|
final String suggestionText;
|
||||||
final bool hasContent;
|
final bool hasContent;
|
||||||
final OnSelectAiScribeSuggestionAction onSelectAction;
|
final OnSelectAiScribeSuggestionAction onSelectAction;
|
||||||
|
final VoidCallback onLoadSuggestion;
|
||||||
|
|
||||||
const AiScribeSuggestionSuccess({
|
const AiScribeSuggestionSuccess({
|
||||||
super.key,
|
super.key,
|
||||||
required this.imagePaths,
|
required this.imagePaths,
|
||||||
required this.suggestionText,
|
required this.suggestionText,
|
||||||
required this.onSelectAction,
|
required this.onSelectAction,
|
||||||
|
required this.onLoadSuggestion,
|
||||||
this.hasContent = false,
|
this.hasContent = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -42,6 +44,7 @@ class AiScribeSuggestionSuccess extends StatelessWidget {
|
|||||||
suggestionText: suggestionText,
|
suggestionText: suggestionText,
|
||||||
hasContent: hasContent,
|
hasContent: hasContent,
|
||||||
onSelectAction: onSelectAction,
|
onSelectAction: onSelectAction,
|
||||||
|
onLoadSuggestion: onLoadSuggestion,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
+43
-36
@@ -14,12 +14,14 @@ class AiScribeSuggestionSuccessListActions extends StatelessWidget {
|
|||||||
final String suggestionText;
|
final String suggestionText;
|
||||||
final bool hasContent;
|
final bool hasContent;
|
||||||
final OnSelectAiScribeSuggestionAction onSelectAction;
|
final OnSelectAiScribeSuggestionAction onSelectAction;
|
||||||
|
final VoidCallback onLoadSuggestion;
|
||||||
|
|
||||||
const AiScribeSuggestionSuccessListActions({
|
const AiScribeSuggestionSuccessListActions({
|
||||||
super.key,
|
super.key,
|
||||||
required this.imagePaths,
|
required this.imagePaths,
|
||||||
required this.suggestionText,
|
required this.suggestionText,
|
||||||
required this.onSelectAction,
|
required this.onSelectAction,
|
||||||
|
required this.onLoadSuggestion,
|
||||||
this.hasContent = false,
|
this.hasContent = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -27,45 +29,50 @@ class AiScribeSuggestionSuccessListActions extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final localizations = ScribeLocalizations.of(context);
|
final localizations = ScribeLocalizations.of(context);
|
||||||
|
|
||||||
return Row(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
children: [
|
||||||
if (hasContent)
|
AiScribeSuggestionSuccessToolbar(suggestionText: suggestionText, onLoadSuggestion: onLoadSuggestion, imagePaths: imagePaths),
|
||||||
Flexible(
|
Row(
|
||||||
child: Container(
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
constraints: const BoxConstraints(minWidth: 67),
|
spacing: 8,
|
||||||
height: 36,
|
children: [
|
||||||
child: ConfirmDialogButton(
|
if (hasContent)
|
||||||
label: AiScribeSuggestionActions.replace.getLabel(localizations),
|
Flexible(
|
||||||
textColor: AppColor.primaryMain,
|
child: Container(
|
||||||
onTapAction: () {
|
constraints: const BoxConstraints(minWidth: 67),
|
||||||
Navigator.of(context).pop();
|
height: 36,
|
||||||
onSelectAction(
|
child: ConfirmDialogButton(
|
||||||
AiScribeSuggestionActions.replace,
|
label: AiScribeSuggestionActions.replace.getLabel(localizations),
|
||||||
suggestionText,
|
textColor: AppColor.primaryMain,
|
||||||
);
|
onTapAction: () {
|
||||||
},
|
Navigator.of(context).pop();
|
||||||
|
onSelectAction(
|
||||||
|
AiScribeSuggestionActions.replace,
|
||||||
|
suggestionText,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Container(
|
||||||
|
constraints: const BoxConstraints(minWidth: 72),
|
||||||
|
height: 36,
|
||||||
|
child: ConfirmDialogButton(
|
||||||
|
label: AiScribeSuggestionActions.insert.getLabel(localizations),
|
||||||
|
backgroundColor: AppColor.blueD2E9FF,
|
||||||
|
textColor: AppColor.primaryMain,
|
||||||
|
onTapAction: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
onSelectAction(
|
||||||
|
AiScribeSuggestionActions.insert,
|
||||||
|
suggestionText,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
Flexible(
|
|
||||||
child: Container(
|
|
||||||
constraints: const BoxConstraints(minWidth: 72),
|
|
||||||
height: 36,
|
|
||||||
child: ConfirmDialogButton(
|
|
||||||
label: AiScribeSuggestionActions.insert.getLabel(localizations),
|
|
||||||
backgroundColor: AppColor.blueD2E9FF,
|
|
||||||
textColor: AppColor.primaryMain,
|
|
||||||
onTapAction: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
onSelectAction(
|
|
||||||
AiScribeSuggestionActions.insert,
|
|
||||||
suggestionText,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:scribe/scribe.dart';
|
||||||
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
|
|
||||||
|
class AiScribeSuggestionSuccessToolbar extends StatelessWidget {
|
||||||
|
final String suggestionText;
|
||||||
|
final VoidCallback onLoadSuggestion;
|
||||||
|
final ImagePaths imagePaths;
|
||||||
|
|
||||||
|
const AiScribeSuggestionSuccessToolbar({
|
||||||
|
super.key,
|
||||||
|
required this.suggestionText,
|
||||||
|
required this.onLoadSuggestion,
|
||||||
|
required this.imagePaths,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TMailButtonWidget.fromIcon(
|
||||||
|
icon: imagePaths.icCopy,
|
||||||
|
iconSize: AIScribeSizes.icon,
|
||||||
|
iconColor: AIScribeColors.secondaryIcon,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
tooltipMessage: ScribeLocalizations.of(context).copy,
|
||||||
|
onTapActionCallback: () {
|
||||||
|
Clipboard.setData(ClipboardData(text: suggestionText));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TMailButtonWidget.fromIcon(
|
||||||
|
icon: imagePaths.icRefresh,
|
||||||
|
iconSize: AIScribeSizes.icon,
|
||||||
|
iconColor: AIScribeColors.secondaryIcon,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
tooltipMessage: ScribeLocalizations.of(context).retry,
|
||||||
|
onTapActionCallback: onLoadSuggestion,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user