From 1e443ad1c036bbe661c025f22315b6a0583ae799 Mon Sep 17 00:00:00 2001 From: hejl Date: Sun, 11 May 2025 16:58:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=9D=A1=E5=8F=88=E6=9D=A5?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- win_text_editor/lib/app/widgets/text_tab.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win_text_editor/lib/app/widgets/text_tab.dart b/win_text_editor/lib/app/widgets/text_tab.dart index 5a80a26..c810097 100644 --- a/win_text_editor/lib/app/widgets/text_tab.dart +++ b/win_text_editor/lib/app/widgets/text_tab.dart @@ -121,7 +121,7 @@ class _TextTabState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - '源文本${tab.content.isEmpty ? '' : ' (${tab.content.length}字符)'}', + '源文本${tab.content.isEmpty ? '' : ' (${tab.fileName!.isEmpty ? '' : '${tab.fileName},'}${tab.content.length}字符)'}', style: const TextStyle(fontWeight: FontWeight.bold), ), Row( @@ -196,7 +196,7 @@ class _TextTabState extends State { focusNode: _focusNode, maxLines: null, scrollController: _scrollController, // 使用同一个滚动控制器 - onChanged: (text) => _provider.updateContent(widget.tabId, text), + onChanged: (text) => _provider.updateContent(widget.tabId, text, tab.fileName), decoration: const InputDecoration( border: InputBorder.none, contentPadding: EdgeInsets.all(16), @@ -226,7 +226,7 @@ class _TextTabState extends State { final file = File(result.files.single.path!); final content = await file.readAsString(); - _provider.updateContent(widget.tabId, content); + _provider.updateContent(widget.tabId, content, result.files.first.name); setState(() { _controller.text = content; _detectLanguage();