From 8a3fd342c6e9ef89153816f312fdf1ea6fee2283 Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Wed, 6 Dec 2023 11:09:05 +0800 Subject: [PATCH] opt.: upgrade linter & fix lint issues --- ios/Runner.xcodeproj/project.pbxproj | 36 ++++++++++++------------- lib/app.dart | 2 +- lib/data/model/app/error.dart | 16 +++++------ lib/data/model/sftp/req.dart | 23 ++++++++-------- lib/data/model/sftp/worker.dart | 6 ++--- lib/data/res/build_data.dart | 4 +-- lib/view/page/backup.dart | 2 +- lib/view/page/debug.dart | 2 +- lib/view/page/docker.dart | 2 +- lib/view/page/editor.dart | 4 +-- lib/view/page/full_screen.dart | 2 +- lib/view/page/home.dart | 2 +- lib/view/page/ping.dart | 2 +- lib/view/page/private_key/edit.dart | 2 +- lib/view/page/private_key/list.dart | 2 +- lib/view/page/server/detail.dart | 2 +- lib/view/page/server/edit.dart | 2 +- lib/view/page/server/tab.dart | 2 +- lib/view/page/setting/android.dart | 2 +- lib/view/page/setting/entry.dart | 2 +- lib/view/page/setting/ios.dart | 2 +- lib/view/page/setting/srv_seq.dart | 2 +- lib/view/page/setting/virt_key.dart | 2 +- lib/view/page/snippet/edit.dart | 2 +- lib/view/page/snippet/list.dart | 2 +- lib/view/page/ssh/page.dart | 5 ++-- lib/view/page/storage/local.dart | 4 +-- lib/view/page/storage/sftp.dart | 4 +-- lib/view/page/storage/sftp_mission.dart | 2 +- lib/view/widget/cardx.dart | 2 +- lib/view/widget/choice_chip.dart | 4 +-- lib/view/widget/fade_in.dart | 4 +-- lib/view/widget/omit_start_text.dart | 4 +-- lib/view/widget/tag.dart | 4 +-- lib/view/widget/two_line_text.dart | 3 +-- lib/view/widget/url_text.dart | 7 +++-- pubspec.lock | 12 ++++----- pubspec.yaml | 4 +-- 38 files changed, 92 insertions(+), 94 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e0aa3f74..6965abbc 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -586,7 +586,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 664; + CURRENT_PROJECT_VERSION = 665; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -596,7 +596,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.664; + MARKETING_VERSION = 1.0.665; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -720,7 +720,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 664; + CURRENT_PROJECT_VERSION = 665; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -730,7 +730,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.664; + MARKETING_VERSION = 1.0.665; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -748,7 +748,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 664; + CURRENT_PROJECT_VERSION = 665; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -758,7 +758,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.664; + MARKETING_VERSION = 1.0.665; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -779,7 +779,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 664; + CURRENT_PROJECT_VERSION = 665; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -792,7 +792,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.664; + MARKETING_VERSION = 1.0.665; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; @@ -818,7 +818,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 664; + CURRENT_PROJECT_VERSION = 665; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -831,7 +831,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.664; + MARKETING_VERSION = 1.0.665; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -854,7 +854,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 664; + CURRENT_PROJECT_VERSION = 665; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -867,7 +867,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.664; + MARKETING_VERSION = 1.0.665; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -890,7 +890,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 664; + CURRENT_PROJECT_VERSION = 665; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -902,7 +902,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.664; + MARKETING_VERSION = 1.0.665; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; @@ -931,7 +931,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 664; + CURRENT_PROJECT_VERSION = 665; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -943,7 +943,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.664; + MARKETING_VERSION = 1.0.665; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; @@ -969,7 +969,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 664; + CURRENT_PROJECT_VERSION = 665; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -981,7 +981,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.664; + MARKETING_VERSION = 1.0.665; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; diff --git a/lib/app.dart b/lib/app.dart index a3f37377..85565a71 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -22,7 +22,7 @@ const _drawerTheme = DrawerThemeData( ); class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); + const MyApp({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/data/model/app/error.dart b/lib/data/model/app/error.dart index 0a8c4f00..10d760e0 100644 --- a/lib/data/model/app/error.dart +++ b/lib/data/model/app/error.dart @@ -25,8 +25,8 @@ enum SSHErrType { } class SSHErr extends Err { - SSHErr({required SSHErrType type, String? message}) - : super(from: ErrFrom.ssh, type: type, message: message); + SSHErr({required super.type, super.message}) + : super(from: ErrFrom.ssh); @override String toString() { @@ -47,8 +47,8 @@ enum DockerErrType { } class DockerErr extends Err { - DockerErr({required DockerErrType type, String? message}) - : super(from: ErrFrom.docker, type: type, message: message); + DockerErr({required super.type, super.message}) + : super(from: ErrFrom.docker); @override String toString() { @@ -63,8 +63,8 @@ enum ICloudErrType { } class ICloudErr extends Err { - ICloudErr({required ICloudErrType type, String? message}) - : super(from: ErrFrom.icloud, type: type, message: message); + ICloudErr({required super.type, super.message}) + : super(from: ErrFrom.icloud); @override String toString() { @@ -79,8 +79,8 @@ enum WebdavErrType { } class WebdavErr extends Err { - WebdavErr({required WebdavErrType type, String? message}) - : super(from: ErrFrom.webdav, type: type, message: message); + WebdavErr({required super.type, super.message}) + : super(from: ErrFrom.webdav); @override String toString() { diff --git a/lib/data/model/sftp/req.dart b/lib/data/model/sftp/req.dart index cfb4bd54..845053e7 100644 --- a/lib/data/model/sftp/req.dart +++ b/lib/data/model/sftp/req.dart @@ -75,29 +75,30 @@ class SftpReqStatus { } void onNotify(dynamic event) { - switch (event.runtimeType) { - case SftpWorkerStatus: - status = event; + var shouldDispose = false; + switch (event) { + case SftpWorkerStatus val: + status = val; if (status == SftpWorkerStatus.finished) { dispose(); } break; - case double: - progress = event; + case double val: + progress = val; break; - case int: - size = event; + case int val: + size = val; break; - case Duration: - spentTime = event; + case Duration d: + spentTime = d; break; default: error = Exception('sftp worker event: $event'); Loggers.app.warning(error); - dispose(); - break; + shouldDispose = true; } notifyListeners(); + if (shouldDispose) dispose(); } } diff --git a/lib/data/model/sftp/worker.dart b/lib/data/model/sftp/worker.dart index 014299f6..2d05b5bd 100644 --- a/lib/data/model/sftp/worker.dart +++ b/lib/data/model/sftp/worker.dart @@ -55,9 +55,9 @@ Future isolateMessageHandler( SendPort mainSendPort, SendErrorFunction sendError, ) async { - switch (data.runtimeType) { - case SftpReq: - switch (data.type) { + switch (data) { + case SftpReq val: + switch (val.type) { case SftpReqType.download: await _download(data, mainSendPort, sendError); break; diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index 2ed6515e..c44296d8 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,9 +2,9 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 664; + static const int build = 665; static const String engine = "3.16.2"; - static const String buildAt = "2023-12-04 15:12:44"; + static const String buildAt = "2023-12-05 18:58:17"; static const int modifications = 1; static const int script = 31; } diff --git a/lib/view/page/backup.dart b/lib/view/page/backup.dart index 029204b1..6a50583d 100644 --- a/lib/view/page/backup.dart +++ b/lib/view/page/backup.dart @@ -25,7 +25,7 @@ import '../../data/res/ui.dart'; import '../widget/custom_appbar.dart'; class BackupPage extends StatelessWidget { - BackupPage({Key? key}) : super(key: key); + BackupPage({super.key}); final icloudLoading = ValueNotifier(false); final webdavLoading = ValueNotifier(false); diff --git a/lib/view/page/debug.dart b/lib/view/page/debug.dart index 74ecb868..37444030 100644 --- a/lib/view/page/debug.dart +++ b/lib/view/page/debug.dart @@ -6,7 +6,7 @@ import 'package:toolbox/data/provider/debug.dart'; import '../widget/custom_appbar.dart'; class DebugPage extends StatefulWidget { - const DebugPage({Key? key}) : super(key: key); + const DebugPage({super.key}); @override _DebugPageState createState() => _DebugPageState(); diff --git a/lib/view/page/docker.dart b/lib/view/page/docker.dart index 7e274863..fc4c6e12 100644 --- a/lib/view/page/docker.dart +++ b/lib/view/page/docker.dart @@ -26,7 +26,7 @@ import '../widget/url_text.dart'; class DockerManagePage extends StatefulWidget { final ServerPrivateInfo spi; - const DockerManagePage({required this.spi, Key? key}) : super(key: key); + const DockerManagePage({required this.spi, super.key}); @override State createState() => _DockerManagePageState(); diff --git a/lib/view/page/editor.dart b/lib/view/page/editor.dart index 4bd69d95..9e236771 100644 --- a/lib/view/page/editor.dart +++ b/lib/view/page/editor.dart @@ -32,12 +32,12 @@ class EditorPage extends StatefulWidget { final String? title; const EditorPage({ - Key? key, + super.key, this.path, this.text, this.langCode, this.title, - }) : super(key: key); + }); @override _EditorPageState createState() => _EditorPageState(); diff --git a/lib/view/page/full_screen.dart b/lib/view/page/full_screen.dart index 675865d7..26dc0a1d 100644 --- a/lib/view/page/full_screen.dart +++ b/lib/view/page/full_screen.dart @@ -23,7 +23,7 @@ import '../../data/model/server/server_private_info.dart'; import '../../data/res/color.dart'; class FullScreenPage extends StatefulWidget { - const FullScreenPage({Key? key}) : super(key: key); + const FullScreenPage({super.key}); @override _FullScreenPageState createState() => _FullScreenPageState(); diff --git a/lib/view/page/home.dart b/lib/view/page/home.dart index 253c4a8f..941d14e5 100644 --- a/lib/view/page/home.dart +++ b/lib/view/page/home.dart @@ -32,7 +32,7 @@ import '../widget/url_text.dart'; import '../widget/value_notifier.dart'; class HomePage extends StatefulWidget { - const HomePage({Key? key}) : super(key: key); + const HomePage({super.key}); @override State createState() => _HomePageState(); diff --git a/lib/view/page/ping.dart b/lib/view/page/ping.dart index 5834b2fe..203b4d8a 100644 --- a/lib/view/page/ping.dart +++ b/lib/view/page/ping.dart @@ -20,7 +20,7 @@ import '../widget/cardx.dart'; final targetReg = RegExp(r'[a-zA-Z0-9\.-_:]+'); class PingPage extends StatefulWidget { - const PingPage({Key? key}) : super(key: key); + const PingPage({super.key}); @override _PingPageState createState() => _PingPageState(); diff --git a/lib/view/page/private_key/edit.dart b/lib/view/page/private_key/edit.dart index ce4a3010..01b82151 100644 --- a/lib/view/page/private_key/edit.dart +++ b/lib/view/page/private_key/edit.dart @@ -21,7 +21,7 @@ import '../../widget/custom_appbar.dart'; const _format = 'text/plain'; class PrivateKeyEditPage extends StatefulWidget { - const PrivateKeyEditPage({Key? key, this.pki}) : super(key: key); + const PrivateKeyEditPage({super.key, this.pki}); final PrivateKeyInfo? pki; diff --git a/lib/view/page/private_key/list.dart b/lib/view/page/private_key/list.dart index 8351bc89..294fb4eb 100644 --- a/lib/view/page/private_key/list.dart +++ b/lib/view/page/private_key/list.dart @@ -18,7 +18,7 @@ import '../../widget/custom_appbar.dart'; import '../../widget/cardx.dart'; class PrivateKeysListPage extends StatefulWidget { - const PrivateKeysListPage({Key? key}) : super(key: key); + const PrivateKeysListPage({super.key}); @override _PrivateKeyListState createState() => _PrivateKeyListState(); diff --git a/lib/view/page/server/detail.dart b/lib/view/page/server/detail.dart index 64352385..54910993 100644 --- a/lib/view/page/server/detail.dart +++ b/lib/view/page/server/detail.dart @@ -25,7 +25,7 @@ import '../../widget/custom_appbar.dart'; import '../../widget/cardx.dart'; class ServerDetailPage extends StatefulWidget { - const ServerDetailPage({Key? key, required this.spi}) : super(key: key); + const ServerDetailPage({super.key, required this.spi}); final ServerPrivateInfo spi; diff --git a/lib/view/page/server/edit.dart b/lib/view/page/server/edit.dart index 54dce858..d3506729 100644 --- a/lib/view/page/server/edit.dart +++ b/lib/view/page/server/edit.dart @@ -20,7 +20,7 @@ import '../../widget/tag.dart'; import '../../widget/value_notifier.dart'; class ServerEditPage extends StatefulWidget { - const ServerEditPage({Key? key, this.spi}) : super(key: key); + const ServerEditPage({super.key, this.spi}); final ServerPrivateInfo? spi; diff --git a/lib/view/page/server/tab.dart b/lib/view/page/server/tab.dart index bf7f2f60..0c4de69e 100644 --- a/lib/view/page/server/tab.dart +++ b/lib/view/page/server/tab.dart @@ -29,7 +29,7 @@ import '../../widget/server_func_btns.dart'; import '../../widget/tag.dart'; class ServerPage extends StatefulWidget { - const ServerPage({Key? key}) : super(key: key); + const ServerPage({super.key}); @override _ServerPageState createState() => _ServerPageState(); diff --git a/lib/view/page/setting/android.dart b/lib/view/page/setting/android.dart index 390bc2ae..c2ba7599 100644 --- a/lib/view/page/setting/android.dart +++ b/lib/view/page/setting/android.dart @@ -15,7 +15,7 @@ import 'package:toolbox/view/widget/cardx.dart'; import 'package:toolbox/view/widget/store_switch.dart'; class AndroidSettingsPage extends StatefulWidget { - const AndroidSettingsPage({Key? key}) : super(key: key); + const AndroidSettingsPage({super.key}); @override _AndroidSettingsPageState createState() => _AndroidSettingsPageState(); diff --git a/lib/view/page/setting/entry.dart b/lib/view/page/setting/entry.dart index 42b3e164..92a7a118 100644 --- a/lib/view/page/setting/entry.dart +++ b/lib/view/page/setting/entry.dart @@ -35,7 +35,7 @@ import '../../widget/store_switch.dart'; import '../../widget/value_notifier.dart'; class SettingPage extends StatefulWidget { - const SettingPage({Key? key}) : super(key: key); + const SettingPage({super.key}); @override _SettingPageState createState() => _SettingPageState(); diff --git a/lib/view/page/setting/ios.dart b/lib/view/page/setting/ios.dart index e04ee6d8..c1e3ba67 100644 --- a/lib/view/page/setting/ios.dart +++ b/lib/view/page/setting/ios.dart @@ -20,7 +20,7 @@ import 'package:toolbox/view/widget/store_switch.dart'; import 'package:watch_connectivity/watch_connectivity.dart'; class IOSSettingsPage extends StatefulWidget { - const IOSSettingsPage({Key? key}) : super(key: key); + const IOSSettingsPage({super.key}); @override _IOSSettingsPageState createState() => _IOSSettingsPageState(); diff --git a/lib/view/page/setting/srv_seq.dart b/lib/view/page/setting/srv_seq.dart index 0c9f324b..eb80141d 100644 --- a/lib/view/page/setting/srv_seq.dart +++ b/lib/view/page/setting/srv_seq.dart @@ -9,7 +9,7 @@ import 'package:toolbox/view/widget/cardx.dart'; import '../../widget/custom_appbar.dart'; class ServerOrderPage extends StatefulWidget { - const ServerOrderPage({Key? key}) : super(key: key); + const ServerOrderPage({super.key}); @override _ServerOrderPageState createState() => _ServerOrderPageState(); diff --git a/lib/view/page/setting/virt_key.dart b/lib/view/page/setting/virt_key.dart index 538d8810..2855a236 100644 --- a/lib/view/page/setting/virt_key.dart +++ b/lib/view/page/setting/virt_key.dart @@ -11,7 +11,7 @@ import 'package:toolbox/view/widget/cardx.dart'; import '../../widget/custom_appbar.dart'; class SSHVirtKeySettingPage extends StatefulWidget { - const SSHVirtKeySettingPage({Key? key}) : super(key: key); + const SSHVirtKeySettingPage({super.key}); @override _SSHVirtKeySettingPageState createState() => _SSHVirtKeySettingPageState(); diff --git a/lib/view/page/snippet/edit.dart b/lib/view/page/snippet/edit.dart index f8ef9362..45f82351 100644 --- a/lib/view/page/snippet/edit.dart +++ b/lib/view/page/snippet/edit.dart @@ -13,7 +13,7 @@ import '../../widget/custom_appbar.dart'; import '../../widget/tag.dart'; class SnippetEditPage extends StatefulWidget { - const SnippetEditPage({Key? key, this.snippet}) : super(key: key); + const SnippetEditPage({super.key, this.snippet}); final Snippet? snippet; diff --git a/lib/view/page/snippet/list.dart b/lib/view/page/snippet/list.dart index fbf34ac8..152f1a15 100644 --- a/lib/view/page/snippet/list.dart +++ b/lib/view/page/snippet/list.dart @@ -15,7 +15,7 @@ import '/data/provider/snippet.dart'; import '../../widget/cardx.dart'; class SnippetListPage extends StatefulWidget { - const SnippetListPage({Key? key}) : super(key: key); + const SnippetListPage({super.key}); @override _SnippetListPageState createState() => _SnippetListPageState(); diff --git a/lib/view/page/ssh/page.dart b/lib/view/page/ssh/page.dart index f05be428..622c4a82 100644 --- a/lib/view/page/ssh/page.dart +++ b/lib/view/page/ssh/page.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'package:dartssh2/dartssh2.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; @@ -33,11 +32,11 @@ class SSHPage extends StatefulWidget { final String? initCmd; final bool pop; const SSHPage({ - Key? key, + super.key, required this.spi, this.initCmd, this.pop = true, - }) : super(key: key); + }); @override _SSHPageState createState() => _SSHPageState(); diff --git a/lib/view/page/storage/local.dart b/lib/view/page/storage/local.dart index 5f4997c1..8e7c884a 100644 --- a/lib/view/page/storage/local.dart +++ b/lib/view/page/storage/local.dart @@ -27,10 +27,10 @@ class LocalStoragePage extends StatefulWidget { final bool isPickFile; final String? initDir; const LocalStoragePage({ - Key? key, + super.key, required this.isPickFile, this.initDir, - }) : super(key: key); + }); @override State createState() => _LocalStoragePageState(); diff --git a/lib/view/page/storage/sftp.dart b/lib/view/page/storage/sftp.dart index 1e289cfa..de5ff523 100644 --- a/lib/view/page/storage/sftp.dart +++ b/lib/view/page/storage/sftp.dart @@ -36,11 +36,11 @@ class SftpPage extends StatefulWidget { final bool isSelect; const SftpPage({ - Key? key, + super.key, required this.spi, required this.isSelect, this.initPath, - }) : super(key: key); + }); @override _SftpPageState createState() => _SftpPageState(); diff --git a/lib/view/page/storage/sftp_mission.dart b/lib/view/page/storage/sftp_mission.dart index 90934cc1..43723f10 100644 --- a/lib/view/page/storage/sftp_mission.dart +++ b/lib/view/page/storage/sftp_mission.dart @@ -16,7 +16,7 @@ import '../../widget/custom_appbar.dart'; import '../../widget/cardx.dart'; class SftpMissionPage extends StatefulWidget { - const SftpMissionPage({Key? key}) : super(key: key); + const SftpMissionPage({super.key}); @override _SftpMissionPageState createState() => _SftpMissionPageState(); diff --git a/lib/view/widget/cardx.dart b/lib/view/widget/cardx.dart index ef354735..b27c75e1 100644 --- a/lib/view/widget/cardx.dart +++ b/lib/view/widget/cardx.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class CardX extends StatelessWidget { - const CardX(this.child, {Key? key, this.color}) : super(key: key); + const CardX(this.child, {super.key, this.color}); final Widget child; final Color? color; diff --git a/lib/view/widget/choice_chip.dart b/lib/view/widget/choice_chip.dart index 0c293da5..d43a88a0 100644 --- a/lib/view/widget/choice_chip.dart +++ b/lib/view/widget/choice_chip.dart @@ -3,11 +3,11 @@ import 'package:flutter/material.dart'; class ChoiceChipX extends StatelessWidget { const ChoiceChipX({ - Key? key, + super.key, required this.label, required this.state, required this.value, - }) : super(key: key); + }); final String label; final ChoiceController state; diff --git a/lib/view/widget/fade_in.dart b/lib/view/widget/fade_in.dart index 832f19c1..58d92024 100644 --- a/lib/view/widget/fade_in.dart +++ b/lib/view/widget/fade_in.dart @@ -6,10 +6,10 @@ class FadeIn extends StatefulWidget { final Duration duration; const FadeIn({ - Key? key, + super.key, required this.child, this.duration = const Duration(milliseconds: 477), - }) : super(key: key); + }); @override _MyFadeInState createState() => _MyFadeInState(); diff --git a/lib/view/widget/omit_start_text.dart b/lib/view/widget/omit_start_text.dart index 3ed707f4..c00231de 100644 --- a/lib/view/widget/omit_start_text.dart +++ b/lib/view/widget/omit_start_text.dart @@ -8,11 +8,11 @@ class OmitStartText extends StatelessWidget { const OmitStartText( this.text, { - Key? key, + super.key, this.maxLines, this.style, this.overflow, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/lib/view/widget/tag.dart b/lib/view/widget/tag.dart index ecff7df3..96519ae1 100644 --- a/lib/view/widget/tag.dart +++ b/lib/view/widget/tag.dart @@ -184,13 +184,13 @@ class TagSwitcher extends StatelessWidget { final String all; const TagSwitcher({ - Key? key, + super.key, required this.tags, required this.width, required this.onTagChanged, required this.all, this.initTag, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/lib/view/widget/two_line_text.dart b/lib/view/widget/two_line_text.dart index 76cb38e8..b0e963fb 100644 --- a/lib/view/widget/two_line_text.dart +++ b/lib/view/widget/two_line_text.dart @@ -2,8 +2,7 @@ import 'package:flutter/material.dart'; import 'package:toolbox/data/res/ui.dart'; class TwoLineText extends StatelessWidget { - const TwoLineText({Key? key, required this.up, required this.down}) - : super(key: key); + const TwoLineText({super.key, required this.up, required this.down}); final String up; final String down; diff --git a/lib/view/widget/url_text.dart b/lib/view/widget/url_text.dart index 724eb13a..380c7314 100644 --- a/lib/view/widget/url_text.dart +++ b/lib/view/widget/url_text.dart @@ -14,12 +14,12 @@ class UrlText extends StatelessWidget { final TextStyle style; const UrlText({ - Key? key, + super.key, required this.text, this.replace, this.textAlign, this.style = const TextStyle(), - }) : super(key: key); + }); List _buildTextSpans(Color c) { final widgets = []; @@ -69,9 +69,8 @@ class UrlText extends StatelessWidget { } class _LinkTextSpan extends TextSpan { - _LinkTextSpan({TextStyle? style, required String text, String? replace}) + _LinkTextSpan({super.style, required String text, String? replace}) : super( - style: style, text: replace ?? text, recognizer: TapGestureRecognizer() ..onTap = () { diff --git a/pubspec.lock b/pubspec.lock index f28c14de..5d204dc7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -342,10 +342,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: be325344c1f3070354a1d84a231a1ba75ea85d413774ec4bdf444c023342e030 + sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6" url: "https://pub.dev" source: hosted - version: "5.5.0" + version: "6.1.1" fixnum: dependency: transitive description: @@ -371,10 +371,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "3.0.1" flutter_localizations: dependency: "direct main" description: flutter @@ -578,10 +578,10 @@ packages: dependency: transitive description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "3.0.0" local_auth: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 6b95f826..61229e65 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,7 +43,7 @@ dependencies: git: ref: master url: https://github.com/lollipopkit/xterm.dart - file_picker: ^5.3.2 + file_picker: ^6.1.1 plain_notification_token: ^0.0.4 highlight: ^0.7.0 flutter_highlight: ^0.7.0 @@ -71,7 +71,7 @@ dev_dependencies: flutter_native_splash: ^2.1.6 hive_generator: ^2.0.0 build_runner: ^2.3.2 - flutter_lints: ^2.0.0 + flutter_lints: ^3.0.0 flutter_test: sdk: flutter