mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
new: add copy btn for ask ai (#975)
This commit is contained in:
@@ -250,6 +250,13 @@ class _AskAiSheetState extends ConsumerState<_AskAiSheet> {
|
||||
context.showSnackBar(libL10n.success);
|
||||
}
|
||||
|
||||
Future<void> _copyText(BuildContext context, String text) async {
|
||||
if (text.trim().isEmpty) return;
|
||||
await Clipboard.setData(ClipboardData(text: text));
|
||||
if (!mounted) return;
|
||||
context.showSnackBar(libL10n.success);
|
||||
}
|
||||
|
||||
void _sendMessage() {
|
||||
if (_isStreaming) return;
|
||||
final text = _inputController.text.trim();
|
||||
@@ -310,7 +317,23 @@ class _AskAiSheetState extends ConsumerState<_AskAiSheet> {
|
||||
streaming ? l10n.askAiAwaitingResponse : l10n.askAiNoResponse,
|
||||
style: theme.textTheme.bodySmall,
|
||||
)
|
||||
: SimpleMarkdown(data: content);
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SimpleMarkdown(data: content),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton.icon(
|
||||
onPressed: () => _copyText(context, content),
|
||||
icon: const Icon(Icons.copy, size: 18),
|
||||
label: Text(libL10n.copy),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
return Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: CardX(
|
||||
|
||||
@@ -252,7 +252,7 @@ class SSHPageState extends ConsumerState<SSHPage>
|
||||
deleteDetection: isMobile,
|
||||
autofocus: false,
|
||||
keyboardAppearance: _isDark ? Brightness.dark : Brightness.light,
|
||||
showToolbar: isMobile,
|
||||
showToolbar: true,
|
||||
viewOffset: Offset(2 * _horizonPadding, CustomAppBar.sysStatusBarHeight),
|
||||
hideScrollBar: false,
|
||||
focusNode: widget.args.focusNode,
|
||||
|
||||
Reference in New Issue
Block a user