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> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
'源文本${tab.content.isEmpty ? '' : ' (${tab.content.length}字符)'}', '源文本${tab.content.isEmpty ? '' : ' (${tab.fileName!.isEmpty ? '' : '${tab.fileName},'}${tab.content.length})'}',
style: const TextStyle(fontWeight: FontWeight.bold), style: const TextStyle(fontWeight: FontWeight.bold),
), ),
Row( Row(
@ -196,7 +196,7 @@ class _TextTabState extends State<TextTab> {
focusNode: _focusNode, focusNode: _focusNode,
maxLines: null, maxLines: null,
scrollController: _scrollController, // 使 scrollController: _scrollController, // 使
onChanged: (text) => _provider.updateContent(widget.tabId, text), onChanged: (text) => _provider.updateContent(widget.tabId, text, tab.fileName),
decoration: const InputDecoration( decoration: const InputDecoration(
border: InputBorder.none, border: InputBorder.none,
contentPadding: EdgeInsets.all(16), contentPadding: EdgeInsets.all(16),
@ -226,7 +226,7 @@ class _TextTabState extends State<TextTab> {
final file = File(result.files.single.path!); final file = File(result.files.single.path!);
final content = await file.readAsString(); final content = await file.readAsString();
_provider.updateContent(widget.tabId, content); _provider.updateContent(widget.tabId, content, result.files.first.name);
setState(() { setState(() {
_controller.text = content; _controller.text = content;
_detectLanguage(); _detectLanguage();

Loading…
Cancel
Save