opt.: upgrade linter & fix lint issues

This commit is contained in:
lollipopkit
2023-12-06 11:09:05 +08:00
parent 143cb1e7c1
commit 8a3fd342c6
38 changed files with 92 additions and 94 deletions

View File

@@ -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;

View File

@@ -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) {

View File

@@ -25,8 +25,8 @@ enum SSHErrType {
}
class SSHErr extends Err<SSHErrType> {
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<DockerErrType> {
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<ICloudErrType> {
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<WebdavErrType> {
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() {

View File

@@ -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();
}
}

View File

@@ -55,9 +55,9 @@ Future<void> 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;

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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();

View File

@@ -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<DockerManagePage> createState() => _DockerManagePageState();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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<HomePage> createState() => _HomePageState();

View File

@@ -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();

View File

@@ -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;

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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;

View File

@@ -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();

View File

@@ -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();

View File

@@ -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<LocalStoragePage> createState() => _LocalStoragePageState();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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;

View File

@@ -3,11 +3,11 @@ import 'package:flutter/material.dart';
class ChoiceChipX<T> 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<T> state;

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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<InlineSpan> _buildTextSpans(Color c) {
final widgets = <InlineSpan>[];
@@ -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 = () {

View File

@@ -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:

View File

@@ -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