Browse Source

滚动条又来了

master
hejl 2 months ago
parent
commit
1e443ad1c0
  1. 6
      win_text_editor/lib/app/widgets/text_tab.dart

6
win_text_editor/lib/app/widgets/text_tab.dart

@ -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();

Loading…
Cancel
Save