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_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_toolbar.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/mobile/ai_scribe_mobile_actions_bottom_sheet.dart';
|
||||
|
||||
@@ -125,5 +125,17 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"copy": "نسخ",
|
||||
"@copy": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"retry": "إعادة المحاولة",
|
||||
"@retry": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,5 +125,17 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"copy": "Kopieren",
|
||||
"@copy": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"retry": "Erneut versuchen",
|
||||
"@retry": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,5 +125,17 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"copy": "Copy",
|
||||
"@copy": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"retry": "Retry",
|
||||
"@retry": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -125,5 +125,17 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"copy": "Copier",
|
||||
"@copy": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"retry": "Réessayer",
|
||||
"@retry": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,5 +125,17 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"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": {
|
||||
"type": "text",
|
||||
@@ -125,5 +125,17 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"copy": "Copy",
|
||||
"@copy": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"retry": "Retry",
|
||||
"@retry": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -125,5 +125,17 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"copy": "Копировать",
|
||||
"@copy": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"retry": "Повторить",
|
||||
"@retry": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,5 +125,17 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"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',
|
||||
);
|
||||
}
|
||||
|
||||
// Suggestion Success Toolbar
|
||||
String get copy {
|
||||
return Intl.message(
|
||||
'Copy',
|
||||
name: 'copy',
|
||||
);
|
||||
}
|
||||
|
||||
String get retry {
|
||||
return Intl.message(
|
||||
'Retry',
|
||||
name: 'retry',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ScribeLocalizationsDelegate
|
||||
|
||||
@@ -107,6 +107,7 @@ mixin AiScribeSuggestionStateMixin<T extends StatefulWidget> on State<T> {
|
||||
suggestionText: suggestionText,
|
||||
hasContent: hasContent,
|
||||
onSelectAction: onSelectAction,
|
||||
onLoadSuggestion: loadSuggestion,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -7,12 +7,14 @@ class AiScribeSuggestionSuccess extends StatelessWidget {
|
||||
final String suggestionText;
|
||||
final bool hasContent;
|
||||
final OnSelectAiScribeSuggestionAction onSelectAction;
|
||||
final VoidCallback onLoadSuggestion;
|
||||
|
||||
const AiScribeSuggestionSuccess({
|
||||
super.key,
|
||||
required this.imagePaths,
|
||||
required this.suggestionText,
|
||||
required this.onSelectAction,
|
||||
required this.onLoadSuggestion,
|
||||
this.hasContent = false,
|
||||
});
|
||||
|
||||
@@ -42,6 +44,7 @@ class AiScribeSuggestionSuccess extends StatelessWidget {
|
||||
suggestionText: suggestionText,
|
||||
hasContent: hasContent,
|
||||
onSelectAction: onSelectAction,
|
||||
onLoadSuggestion: onLoadSuggestion,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
+43
-36
@@ -14,12 +14,14 @@ class AiScribeSuggestionSuccessListActions extends StatelessWidget {
|
||||
final String suggestionText;
|
||||
final bool hasContent;
|
||||
final OnSelectAiScribeSuggestionAction onSelectAction;
|
||||
final VoidCallback onLoadSuggestion;
|
||||
|
||||
const AiScribeSuggestionSuccessListActions({
|
||||
super.key,
|
||||
required this.imagePaths,
|
||||
required this.suggestionText,
|
||||
required this.onSelectAction,
|
||||
required this.onLoadSuggestion,
|
||||
this.hasContent = false,
|
||||
});
|
||||
|
||||
@@ -27,45 +29,50 @@ class AiScribeSuggestionSuccessListActions extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final localizations = ScribeLocalizations.of(context);
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
spacing: 8,
|
||||
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: [
|
||||
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,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
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