From fee02a53b6841e8327b6c636e2b2273ec29967d5 Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Fri, 12 May 2023 21:18:41 +0800 Subject: [PATCH] fix: typo --- ios/Podfile.lock | 53 ++++++++++++++++++++++++-- lib/core/utils/misc.dart | 10 ++--- lib/data/provider/app.dart | 2 +- lib/view/page/home.dart | 2 +- lib/view/page/server/tab.dart | 5 ++- lib/view/page/setting.dart | 7 ++-- lib/view/page/ssh.dart | 70 ++++++++++++++++------------------- 7 files changed, 95 insertions(+), 54 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 42673bc1..bbd90cc7 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,7 +1,39 @@ PODS: - countly_flutter (22.09.0): - Flutter + - DKImagePickerController/Core (4.3.4): + - DKImagePickerController/ImageDataManager + - DKImagePickerController/Resource + - DKImagePickerController/ImageDataManager (4.3.4) + - DKImagePickerController/PhotoGallery (4.3.4): + - DKImagePickerController/Core + - DKPhotoGallery + - DKImagePickerController/Resource (4.3.4) + - DKPhotoGallery (0.0.17): + - DKPhotoGallery/Core (= 0.0.17) + - DKPhotoGallery/Model (= 0.0.17) + - DKPhotoGallery/Preview (= 0.0.17) + - DKPhotoGallery/Resource (= 0.0.17) + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Core (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Preview + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Model (0.0.17): + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Preview (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Resource + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Resource (0.0.17): + - SDWebImage + - SwiftyGif - file_picker (0.0.1): + - DKImagePickerController/PhotoGallery - Flutter - Flutter (1.0.0) - flutter_native_splash (0.0.1): @@ -13,8 +45,12 @@ PODS: - Flutter - r_upgrade (0.0.1): - Flutter + - SDWebImage (5.15.7): + - SDWebImage/Core (= 5.15.7) + - SDWebImage/Core (5.15.7) - share_plus (0.0.1): - Flutter + - SwiftyGif (5.4.4) - url_launcher_ios (0.0.1): - Flutter @@ -29,6 +65,13 @@ DEPENDENCIES: - share_plus (from `.symlinks/plugins/share_plus/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) +SPEC REPOS: + trunk: + - DKImagePickerController + - DKPhotoGallery + - SDWebImage + - SwiftyGif + EXTERNAL SOURCES: countly_flutter: :path: ".symlinks/plugins/countly_flutter/ios" @@ -51,15 +94,19 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: countly_flutter: 135f1a4930f8e26ba223a14201d3f265ea7b4c83 - file_picker: 1d63c4949e05e386da864365f8c13e1e64787675 + DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac + DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 + file_picker: 63d7a9f5a3b5fe8fa001b1af955065e42a6c7b3e Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 plain_notification_token: b36467dc91939a7b6754267c701bbaca14996ee1 r_upgrade: 44d715c61914cce3d01ea225abffe894fd51c114 + SDWebImage: 25bac438318faf37e35650619ebc288a9061d292 share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 + SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 -PODFILE CHECKSUM: 7fb15c416f8685fca4966867a8da218ec592ec2e +PODFILE CHECKSUM: 8fb0b88ad9ca0fa16f109f46126189158d7c8607 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/lib/core/utils/misc.dart b/lib/core/utils/misc.dart index de4cd0fa..d336835f 100644 --- a/lib/core/utils/misc.dart +++ b/lib/core/utils/misc.dart @@ -26,21 +26,21 @@ Future shareFiles(BuildContext context, List filePaths) async { } else { text = '${filePaths.length} ${S.of(context)!.files}'; } - _app.setMoveBg(false); + _app.setCanMoveBg(false); // ignore: deprecated_member_use await Share.shareFiles(filePaths, text: 'ServerBox -> $text'); - _app.setMoveBg(true); + _app.setCanMoveBg(true); return filePaths.isNotEmpty; } -void copy(String text) { +void copy2Clipboard(String text) { Clipboard.setData(ClipboardData(text: text)); } Future pickOneFile() async { - _app.setMoveBg(false); + _app.setCanMoveBg(false); final result = await FilePicker.platform.pickFiles(type: FileType.any); - _app.setMoveBg(true); + _app.setCanMoveBg(true); return result?.files.single.path; } diff --git a/lib/data/provider/app.dart b/lib/data/provider/app.dart index 62feebc3..138254d6 100644 --- a/lib/data/provider/app.dart +++ b/lib/data/provider/app.dart @@ -12,7 +12,7 @@ class AppProvider extends BusyProvider { notifyListeners(); } - void setMoveBg(bool moveBg) { + void setCanMoveBg(bool moveBg) { _moveBg = moveBg; } } diff --git a/lib/view/page/home.dart b/lib/view/page/home.dart index 79039bc1..0e9e175a 100644 --- a/lib/view/page/home.dart +++ b/lib/view/page/home.dart @@ -103,7 +103,7 @@ class _MyHomePageState extends State 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), diff --git a/lib/view/page/server/tab.dart b/lib/view/page/server/tab.dart index e61ffdcd..5ae9ca57 100644 --- a/lib/view/page/server/tab.dart +++ b/lib/view/page/server/tab.dart @@ -98,6 +98,7 @@ class _ServerPageState extends State 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 child: Text(ss.failedInfo ?? _s.unknownError), actions: [ TextButton( - onPressed: () => - copy(ss.failedInfo ?? _s.unknownError), + onPressed: () => copy2Clipboard( + ss.failedInfo ?? _s.unknownError), child: Text(_s.copy), ) ], diff --git a/lib/view/page/setting.dart b/lib/view/page/setting.dart index 06cdcdcc..3c826505 100644 --- a/lib/view/page/setting.dart +++ b/lib/view/page/setting.dart @@ -395,7 +395,7 @@ class _SettingPageState extends State { 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 { } 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, diff --git a/lib/view/page/ssh.dart b/lib/view/page/ssh.dart index 6b5ba2bc..0e3b30b1 100644 --- a/lib/view/page/ssh.dart +++ b/lib/view/page/ssh.dart @@ -222,7 +222,10 @@ class _SSHPageState extends State { _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 { }); } - 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 { 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 = [ + 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 { 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, ); }, );