mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
new: editor softWrap (#338)
This commit is contained in:
@@ -171,6 +171,7 @@ class _EditorPageState extends State<EditorPage> {
|
||||
styles: _codeTheme,
|
||||
),
|
||||
child: CodeField(
|
||||
wrap: Stores.setting.editorSoftWrap.fetch(),
|
||||
focusNode: _focusNode,
|
||||
controller: _controller,
|
||||
textStyle: _textStyle,
|
||||
|
||||
@@ -182,6 +182,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
Widget _buildEditor() {
|
||||
return Column(
|
||||
children: [
|
||||
_buildEditorWrap(),
|
||||
_buildEditorFontSize(),
|
||||
_buildEditorTheme(),
|
||||
_buildEditorDarkTheme(),
|
||||
@@ -1114,4 +1115,11 @@ class _SettingPageState extends State<SettingPage> {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEditorWrap() {
|
||||
return ListTile(
|
||||
title: Text(l10n.softWrap),
|
||||
trailing: StoreSwitch(prop: _setting.editorSoftWrap),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:toolbox/core/extension/context/common.dart';
|
||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||
import 'package:toolbox/data/provider/server.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/ui.dart';
|
||||
@@ -14,7 +15,7 @@ class SSHTabPage extends StatefulWidget {
|
||||
const SSHTabPage({super.key});
|
||||
|
||||
@override
|
||||
_SSHTabPageState createState() => _SSHTabPageState();
|
||||
State<SSHTabPage> createState() => _SSHTabPageState();
|
||||
}
|
||||
|
||||
class _SSHTabPageState extends State<SSHTabPage>
|
||||
@@ -84,7 +85,6 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
if (confirm != true) {
|
||||
return;
|
||||
}
|
||||
// debugPrint("Removing a tab whose tabId = $e");
|
||||
_tabIds.remove(e);
|
||||
_refreshTabs();
|
||||
},
|
||||
@@ -115,30 +115,7 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
title: Text(spi.name),
|
||||
subtitle: Text(spi.id, style: UIs.textGrey),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () {
|
||||
final name = () {
|
||||
if (_tabIds.containsKey(spi.name)) {
|
||||
return '${spi.name}(${_tabIds.length + 1})';
|
||||
}
|
||||
return spi.name;
|
||||
}();
|
||||
final key = GlobalKey(debugLabel: 'sshTabPage_$name');
|
||||
_tabIds[name] = SSHPage(
|
||||
key: key,
|
||||
spi: spi,
|
||||
notFromTab: false,
|
||||
onSessionEnd: () {
|
||||
// debugPrint("Session done received on page whose tabId = $name");
|
||||
// debugPrint("key = $key");
|
||||
_tabIds.remove(name);
|
||||
_refreshTabs();
|
||||
},
|
||||
);
|
||||
_refreshTabs();
|
||||
final idx = _tabIds.length - 1;
|
||||
_tabController.animateTo(idx);
|
||||
_fabRN.value = idx;
|
||||
},
|
||||
onTap: () => _onTapInitCard(spi),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -156,6 +133,31 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
);
|
||||
}
|
||||
|
||||
void _onTapInitCard(ServerPrivateInfo spi) {
|
||||
final name = () {
|
||||
if (_tabIds.containsKey(spi.name)) {
|
||||
return '${spi.name}(${_tabIds.length + 1})';
|
||||
}
|
||||
return spi.name;
|
||||
}();
|
||||
final key = GlobalKey<State<SSHPage>>(debugLabel: 'sshTabPage_$name');
|
||||
_tabIds[name] = SSHPage(
|
||||
key: key,
|
||||
spi: spi,
|
||||
notFromTab: false,
|
||||
onSessionEnd: () {
|
||||
// debugPrint("Session done received on page whose tabId = $name");
|
||||
// debugPrint("key = $key");
|
||||
_tabIds.remove(name);
|
||||
_refreshTabs();
|
||||
},
|
||||
);
|
||||
_refreshTabs();
|
||||
final idx = _tabIds.length - 1;
|
||||
_tabController.animateTo(idx);
|
||||
_fabRN.value = idx;
|
||||
}
|
||||
|
||||
void _refreshTabs() {
|
||||
_tabController = TabController(
|
||||
length: _tabIds.length,
|
||||
|
||||
Reference in New Issue
Block a user