fix: typo

This commit is contained in:
lollipopkit
2023-05-12 21:18:41 +08:00
parent cbeaa9705f
commit fee02a53b6
7 changed files with 95 additions and 54 deletions

View File

@@ -103,7 +103,7 @@ class _MyHomePageState extends State<MyHomePage>
return Scaffold(
drawer: _buildDrawer(),
appBar: AppBar(
title: Text(tabTitleName(context, _selectIndex)),
title: const Text(BuildData.name),
actions: [
IconButton(
icon: const Icon(Icons.developer_mode, size: 23),

View File

@@ -98,6 +98,7 @@ class _ServerPageState extends State<ServerPage>
pro.serverOrder.move(oldIndex, newIndex);
}),
children: pro.serverOrder
.where((e) => pro.servers.containsKey(e))
.map((e) => _buildEachServerCard(pro.servers[e]))
.toList(),
);
@@ -168,8 +169,8 @@ class _ServerPageState extends State<ServerPage>
child: Text(ss.failedInfo ?? _s.unknownError),
actions: [
TextButton(
onPressed: () =>
copy(ss.failedInfo ?? _s.unknownError),
onPressed: () => copy2Clipboard(
ss.failedInfo ?? _s.unknownError),
child: Text(_s.copy),
)
],

View File

@@ -395,7 +395,7 @@ class _SettingPageState extends State<SettingPage> {
padding: EdgeInsets.zero,
onPressed: () {
if (_pushToken != null) {
copy(_pushToken!);
copy2Clipboard(_pushToken!);
showSnackBar(context, Text(_s.success));
} else {
showSnackBar(context, Text(_s.getPushTokenFailed));
@@ -421,9 +421,10 @@ class _SettingPageState extends State<SettingPage> {
}
Widget _buildFont() {
final fontName = getFileName(_setting.fontPath.fetch());
return ListTile(
title: Text(_s.chooseFontFile),
trailing: Text(getFileName(_setting.fontPath.fetch()) ?? _s.notSelected),
title: Text(_s.choose),
trailing: Text(fontName ?? _s.notSelected),
onTap: () {
showRoundDialog(
context: context,

View File

@@ -222,7 +222,10 @@ class _SSHPageState extends State<SSHPage> {
_paste();
break;
case VirtualKeyFunc.copy:
copy(terminalSelected);
final selected = terminalSelected;
if (selected != null) {
copy2Clipboard(selected);
}
break;
case VirtualKeyFunc.snippet:
showSnippetDialog(context, _s, (s) {
@@ -241,10 +244,10 @@ class _SSHPageState extends State<SSHPage> {
});
}
String get terminalSelected {
String? get terminalSelected {
final range = _terminalController.selection;
if (range == null) {
return '';
return null;
}
return _terminal.buffer.getText(range);
}
@@ -255,29 +258,30 @@ class _SSHPageState extends State<SSHPage> {
return;
}
final selected = terminalSelected;
if (selected.trim().isEmpty) {
// _menuController.show(
// context: context,
// contextMenuBuilder: (context) {
// return TextSelectionToolbar(
// anchorAbove: details.globalPosition,
// anchorBelow: details.globalPosition,
// children: [
// TextButton(
// child: Text(
// _s.paste,
// style: _menuTextStyle,
// ),
// onPressed: () async {
// _paste();
// _menuController.remove();
// },
// )
// ],
// );
// },
// );
return;
final children = <Widget>[
TextButton(
onPressed: () {
_paste();
},
child: Text(_s.paste),
),
];
if (selected?.trim().isNotEmpty ?? false) {
children.add(
TextButton(
child: Text(
_s.copy,
style: _menuTextStyle,
),
onPressed: () {
_terminalController.setSelection(null);
if (selected != null) {
copy2Clipboard(selected);
}
_menuController.remove();
},
),
);
}
_menuController.show(
context: context,
@@ -285,19 +289,7 @@ class _SSHPageState extends State<SSHPage> {
return TextSelectionToolbar(
anchorAbove: details.globalPosition,
anchorBelow: details.globalPosition,
children: [
TextButton(
child: Text(
_s.copy,
style: _menuTextStyle,
),
onPressed: () {
_terminalController.setSelection(null);
copy(selected);
_menuController.remove();
},
),
],
children: children,
);
},
);