|
|
|
@ -121,7 +121,7 @@ class _TextTabState extends State<TextTab> {
@@ -121,7 +121,7 @@ class _TextTabState extends State<TextTab> {
|
|
|
|
|
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<TextTab> {
@@ -196,7 +196,7 @@ class _TextTabState extends State<TextTab> {
|
|
|
|
|
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<TextTab> {
@@ -226,7 +226,7 @@ class _TextTabState extends State<TextTab> {
|
|
|
|
|
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(); |
|
|
|
|