mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-08-20 13:00:12 +08:00
dart: fix
This commit is contained in:
@@ -32,6 +32,8 @@ analyzer:
|
||||
exclude:
|
||||
- "**/*.g.dart"
|
||||
- "**/*.freezed.dart"
|
||||
- "**/generated/*.dart"
|
||||
- "**/generated/**/*.dart"
|
||||
errors:
|
||||
invalid_annotation_target: ignore
|
||||
# Additional information about this file can be found at
|
||||
|
@@ -81,7 +81,7 @@ GoRouter router(Ref ref) {
|
||||
pageBuilder: (context, state) => myPageBuilder(context, state, const AdvancedLocalizationUI()))
|
||||
],
|
||||
),
|
||||
GoRoute(path: '/tools', builder: (_, __) => const SizedBox(), routes: [
|
||||
GoRoute(path: '/tools', builder: (_, _) => const SizedBox(), routes: [
|
||||
GoRoute(
|
||||
path: 'unp4kc',
|
||||
pageBuilder: (context, state) => myPageBuilder(context, state, const UnP4kcUI()),
|
||||
@@ -295,7 +295,7 @@ class AppGlobalModel extends _$AppGlobalModel {
|
||||
}
|
||||
}
|
||||
|
||||
void changeLocale(value) async {
|
||||
void changeLocale(dynamic value) async {
|
||||
final appConfBox = await Hive.openBox("app_conf");
|
||||
if (value is Locale) {
|
||||
if (value.languageCode == "auto") {
|
||||
|
@@ -21,7 +21,7 @@ class ConstConf {
|
||||
class AppConf {
|
||||
static List<String>? _networkGameChannels;
|
||||
|
||||
static setNetworkChannels(List<String>? channels) {
|
||||
static void setNetworkChannels(List<String>? channels) {
|
||||
_networkGameChannels = channels;
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,7 @@ import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||
class SystemHelper {
|
||||
static String powershellPath = "powershell.exe";
|
||||
|
||||
static initPowershellPath() async {
|
||||
static Future<void> initPowershellPath() async {
|
||||
try {
|
||||
var result = await Process.run(powershellPath, ["echo", "pong"]);
|
||||
if (!result.stdout.toString().startsWith("pong") && powershellPath == "powershell.exe") {
|
||||
@@ -58,7 +58,7 @@ class SystemHelper {
|
||||
return result.stderr;
|
||||
}
|
||||
|
||||
static doRemoveNvmePath() async {
|
||||
static Future<bool> doRemoveNvmePath() async {
|
||||
try {
|
||||
var result = await Process.run(powershellPath, [
|
||||
"Clear-ItemProperty",
|
||||
@@ -110,7 +110,7 @@ class SystemHelper {
|
||||
return "";
|
||||
}
|
||||
|
||||
static killRSILauncher() async {
|
||||
static Future<void> killRSILauncher() async {
|
||||
var psr = await Process.run(powershellPath, ["ps", "\"RSI Launcher\"", "|select -expand id"]);
|
||||
if (psr.stderr == "") {
|
||||
for (var value in (psr.stdout ?? "").toString().split("\n")) {
|
||||
@@ -139,7 +139,7 @@ class SystemHelper {
|
||||
}
|
||||
}
|
||||
|
||||
static checkAndLaunchRSILauncher(String path) async {
|
||||
static Future<void> checkAndLaunchRSILauncher(String path) async {
|
||||
// check running and kill
|
||||
await killRSILauncher();
|
||||
// launch
|
||||
@@ -254,7 +254,7 @@ foreach ($adapter in $adapterMemory) {
|
||||
return int.parse(binaryString, radix: 2).toRadixString(16).padLeft(hexDigits, '0').toUpperCase();
|
||||
}
|
||||
|
||||
static Future openDir(path, {bool isFile = false}) async {
|
||||
static Future openDir(dynamic path, {bool isFile = false}) async {
|
||||
dPrint("SystemHelper.openDir path === $path");
|
||||
if (Platform.isWindows) {
|
||||
await Process.run(
|
||||
|
@@ -7,7 +7,7 @@ import 'package:starcitizen_doctor/common/rust/api/http_api.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/http_package.dart';
|
||||
|
||||
class RSHttp {
|
||||
static init() async {
|
||||
static Future<void> init() async {
|
||||
await rust_http.setDefaultHeader(headers: {
|
||||
"User-Agent":
|
||||
"SCToolBox/${ConstConf.appVersion} (${ConstConf.appVersionCode})${ConstConf.isMSE ? "" : " DEV"} RSHttp"
|
||||
|
@@ -8,7 +8,7 @@ export 'package:starcitizen_doctor/generated/l10n.dart';
|
||||
var _logLock = Lock();
|
||||
File? _logFile;
|
||||
|
||||
void dPrint(src) async {
|
||||
void dPrint(dynamic src) async {
|
||||
if (kDebugMode) {
|
||||
print(src);
|
||||
return;
|
||||
|
@@ -50,7 +50,7 @@ class MultiWindowManager {
|
||||
// sendAppStateBroadcast(appGlobalState);
|
||||
}
|
||||
|
||||
static sendAppStateBroadcast(AppGlobalState appGlobalState) {
|
||||
static void sendAppStateBroadcast(AppGlobalState appGlobalState) {
|
||||
DesktopMultiWindow.invokeMethod(
|
||||
0,
|
||||
'app_state_broadcast',
|
||||
|
@@ -27,7 +27,7 @@ void main(List<String> args) async {
|
||||
runApp(const ProviderScope(child: App()));
|
||||
}
|
||||
|
||||
_initWindow() async {
|
||||
Future<void> _initWindow() async {
|
||||
await windowManager.ensureInitialized();
|
||||
await windowManager.setTitleBarStyle(
|
||||
TitleBarStyle.hidden,
|
||||
|
@@ -219,7 +219,7 @@ class Unp4kCModel extends _$Unp4kCModel {
|
||||
}
|
||||
}
|
||||
|
||||
openFile(String filePath) async {
|
||||
Future<void> openFile(String filePath) async {
|
||||
final tempDir = await getTemporaryDirectory();
|
||||
final tempPath =
|
||||
"${tempDir.absolute.path}\\SCToolbox_unp4kc\\${SCLoggerHelper.getGameChannelID(getGamePath())}\\";
|
||||
@@ -229,7 +229,7 @@ class Unp4kCModel extends _$Unp4kCModel {
|
||||
extractFile(filePath, tempPath, mode: "extract_open");
|
||||
}
|
||||
|
||||
extractFile(String filePath, String outputPath,
|
||||
Future<void> extractFile(String filePath, String outputPath,
|
||||
{String mode = "extract"}) async {
|
||||
// remove first \\
|
||||
if (filePath.startsWith("\\")) {
|
||||
|
@@ -567,7 +567,7 @@ class AboutUI extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
_onCheckUpdate(BuildContext context, WidgetRef ref) async {
|
||||
Future<void> _onCheckUpdate(BuildContext context, WidgetRef ref) async {
|
||||
if (ConstConf.isMSE) {
|
||||
launchUrlString("ms-windows-store://pdp/?productid=9NF3SWFWNKL1");
|
||||
return;
|
||||
|
@@ -118,7 +118,7 @@ class HomeGameLoginUIModel extends _$HomeGameLoginUIModel {
|
||||
}
|
||||
|
||||
// ignore: avoid_build_context_in_providers
|
||||
goWebView(BuildContext context, String title, String url,
|
||||
Future<void> goWebView(BuildContext context, String title, String url,
|
||||
{bool useLocalization = false,
|
||||
bool loginMode = false,
|
||||
RsiLoginCallback? rsiLoginCallback,
|
||||
|
@@ -64,7 +64,7 @@ class HomeDownloaderUIModel extends _$HomeDownloaderUIModel {
|
||||
return state;
|
||||
}
|
||||
|
||||
onTapButton(BuildContext context, String key) async {
|
||||
Future<void> onTapButton(BuildContext context, String key) async {
|
||||
final aria2cState = ref.read(aria2cModelProvider);
|
||||
switch (key) {
|
||||
case "pause_all":
|
||||
@@ -194,14 +194,14 @@ class HomeDownloaderUIModel extends _$HomeDownloaderUIModel {
|
||||
return l;
|
||||
}
|
||||
|
||||
openFolder(Aria2Task task) {
|
||||
void openFolder(Aria2Task task) {
|
||||
final f = getFilesFormTask(task).firstOrNull;
|
||||
if (f != null) {
|
||||
SystemHelper.openDir(File(f.path!).absolute.path.replaceAll("/", "\\"));
|
||||
}
|
||||
}
|
||||
|
||||
_listenDownloader() async {
|
||||
Future<void> _listenDownloader() async {
|
||||
try {
|
||||
while (true) {
|
||||
final aria2cState = ref.read(aria2cModelProvider);
|
||||
|
@@ -285,7 +285,7 @@ class HomeGameDoctorUI extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
_onTapButton(
|
||||
Future<void> _onTapButton(
|
||||
BuildContext context, String key, HomeUIModelState homeState) async {
|
||||
switch (key) {
|
||||
case "rsi_log":
|
||||
|
@@ -113,7 +113,7 @@ class HomeGameDoctorUIModel extends _$HomeGameDoctorUIModel {
|
||||
}
|
||||
|
||||
// ignore: avoid_build_context_in_providers
|
||||
doCheck(BuildContext context) async {
|
||||
Future<void> doCheck(BuildContext context) async {
|
||||
if (state.isChecking) return;
|
||||
state = state.copyWith(
|
||||
isChecking: true, lastScreenInfo: S.current.doctor_action_analyzing);
|
||||
@@ -124,7 +124,7 @@ class HomeGameDoctorUIModel extends _$HomeGameDoctorUIModel {
|
||||
}
|
||||
|
||||
// ignore: avoid_build_context_in_providers
|
||||
_statCheck(BuildContext context) async {
|
||||
Future<void> _statCheck(BuildContext context) async {
|
||||
final homeState = ref.read(homeUIModelProvider);
|
||||
final scInstalledPath = homeState.scInstalledPath!;
|
||||
|
||||
|
@@ -718,7 +718,7 @@ class HomeUI extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
_showPlacard(BuildContext context, HomeUIModelState homeState) {
|
||||
void _showPlacard(BuildContext context, HomeUIModelState homeState) {
|
||||
switch (homeState.appPlacardData?.linkType) {
|
||||
case "external":
|
||||
launchUrlString(homeState.appPlacardData?.link);
|
||||
@@ -736,7 +736,7 @@ class HomeUI extends HookConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
_onTapFestival(BuildContext context) {
|
||||
void _onTapFestival(BuildContext context) {
|
||||
showDialog(context: context, builder: (context) => const HomeCountdownDialogUI());
|
||||
}
|
||||
|
||||
|
@@ -69,7 +69,7 @@ class HomeUIModel extends _$HomeUIModel {
|
||||
return state;
|
||||
}
|
||||
|
||||
closePlacard() async {
|
||||
Future<void> closePlacard() async {
|
||||
final box = await Hive.openBox("app_conf");
|
||||
await box.put("close_placard", state.appPlacardData?.version);
|
||||
state = state.copyWith(appPlacardData: null);
|
||||
@@ -281,7 +281,7 @@ class HomeUIModel extends _$HomeUIModel {
|
||||
}
|
||||
|
||||
// ignore: avoid_build_context_in_providers
|
||||
launchRSI(BuildContext context) async {
|
||||
Future<void> launchRSI(BuildContext context) async {
|
||||
if (state.scInstalledPath == "not_install") {
|
||||
showToast(context, S.current.home_info_valid_installation_required);
|
||||
return;
|
||||
@@ -312,7 +312,7 @@ class HomeUIModel extends _$HomeUIModel {
|
||||
ref.read(localizationUIModelProvider.notifier).onChangeGameInstallPath(value);
|
||||
}
|
||||
|
||||
doLaunchGame(
|
||||
Future<void> doLaunchGame(
|
||||
// ignore: avoid_build_context_in_providers
|
||||
BuildContext context,
|
||||
String launchExe,
|
||||
|
@@ -239,7 +239,7 @@ class InputMethodDialogUI extends HookConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
_onSwitchAutoTranslate(
|
||||
Future<void> _onSwitchAutoTranslate(
|
||||
BuildContext context, InputMethodDialogUIModel model, bool b) async {
|
||||
if (b) {
|
||||
final ok = await showConfirmDialogs(
|
||||
|
@@ -148,7 +148,7 @@ class InputMethodDialogUIModel extends _$InputMethodDialogUIModel {
|
||||
}
|
||||
}
|
||||
|
||||
toggleAutoTranslate(bool b) async {
|
||||
Future<void> toggleAutoTranslate(bool b) async {
|
||||
state = state.copyWith(isEnableAutoTranslate: b);
|
||||
final appConf = await Hive.openBox("app_conf");
|
||||
await appConf.put("isEnableAutoTranslate", b);
|
||||
|
@@ -2,7 +2,6 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
@@ -24,7 +24,7 @@ class ServerQrState extends _$ServerQrState {
|
||||
_context = context;
|
||||
}
|
||||
|
||||
popDialog() {
|
||||
void popDialog() {
|
||||
_context?.pop();
|
||||
}
|
||||
}
|
||||
|
@@ -225,7 +225,7 @@ class AdvancedLocalizationUI extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
_showContent(BuildContext context, AppAdvancedLocalizationClassKeysData item) {
|
||||
void _showContent(BuildContext context, AppAdvancedLocalizationClassKeysData item) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
|
@@ -455,7 +455,7 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
||||
};
|
||||
}
|
||||
|
||||
_updateStatus() async {
|
||||
Future<void> _updateStatus() async {
|
||||
final iniPath = "${_scDataDir.absolute.path}\\Localization\\${state.selectedLanguage}\\global.ini";
|
||||
final patchStatus =
|
||||
MapEntry(await _getLangCfgEnableLang(lang: state.selectedLanguage!), await _getInstalledIniVersion(iniPath));
|
||||
|
@@ -73,7 +73,7 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
|
||||
showGraphicsPerformanceTip: v != _graphicsPerformanceTipVersion);
|
||||
}
|
||||
|
||||
_readConf() async {
|
||||
Future<void> _readConf() async {
|
||||
if (state.performanceMap == null) return;
|
||||
state = state.copyWith(enabled: true);
|
||||
|
||||
@@ -95,14 +95,14 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
|
||||
}
|
||||
}
|
||||
|
||||
closeTip() async {
|
||||
Future<void> closeTip() async {
|
||||
final box = await Hive.openBox("app_conf");
|
||||
await box.put(
|
||||
"close_graphics_performance_tip", _graphicsPerformanceTipVersion);
|
||||
_init();
|
||||
}
|
||||
|
||||
onChangePreProfile(String key) {
|
||||
void onChangePreProfile(String key) {
|
||||
switch (key) {
|
||||
case "low":
|
||||
state.performanceMap?.forEach((key, v) {
|
||||
@@ -144,11 +144,11 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
|
||||
state = state.copyWith();
|
||||
}
|
||||
|
||||
refresh() async {
|
||||
Future<void> refresh() async {
|
||||
_init();
|
||||
}
|
||||
|
||||
clean(BuildContext context) async {
|
||||
Future<void> clean(BuildContext context) async {
|
||||
state = state.copyWith(
|
||||
workingString: S.current.performance_info_delete_config_file);
|
||||
if (await confFile.exists()) {
|
||||
@@ -164,7 +164,7 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
|
||||
state = state.copyWith(workingString: "");
|
||||
}
|
||||
|
||||
cleanShaderCache(BuildContext? context) async {
|
||||
Future<void> cleanShaderCache(BuildContext? context) async {
|
||||
final gameShaderCachePath = await SCLoggerHelper.getShaderCachePath();
|
||||
final l =
|
||||
await Directory(gameShaderCachePath!).list(recursive: false).toList();
|
||||
@@ -181,7 +181,7 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
|
||||
}
|
||||
}
|
||||
|
||||
applyProfile(bool cleanShader) async {
|
||||
Future<void> applyProfile(bool cleanShader) async {
|
||||
if (state.performanceMap == null) return;
|
||||
AnalyticsApi.touch("performance_apply");
|
||||
state = state.copyWith(
|
||||
@@ -222,7 +222,7 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
|
||||
state = state.copyWith(workingString: "");
|
||||
}
|
||||
|
||||
updateState() {
|
||||
void updateState() {
|
||||
state = state.copyWith();
|
||||
}
|
||||
}
|
||||
|
@@ -164,7 +164,7 @@ class IndexUI extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
_goDownloader(BuildContext context) {
|
||||
void _goDownloader(BuildContext context) {
|
||||
context.push('/index/downloader');
|
||||
}
|
||||
}
|
@@ -116,7 +116,7 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
}
|
||||
}
|
||||
|
||||
_saveCustomPath(String pathKey, String dir) async {
|
||||
Future<void> _saveCustomPath(String pathKey, String dir) async {
|
||||
final confBox = await Hive.openBox("app_conf");
|
||||
await confBox.put(pathKey, dir);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
_initState();
|
||||
}
|
||||
|
||||
showLogs() async {
|
||||
Future<void> showLogs() async {
|
||||
SystemHelper.openDir(getDPrintFile()?.absolute.path.replaceAll("/", "\\"),
|
||||
isFile: true);
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ class SplashUI extends HookConsumerWidget {
|
||||
context.go("/index");
|
||||
}
|
||||
|
||||
_showAlert(BuildContext context, Box<dynamic> appConf) async {
|
||||
Future<void> _showAlert(BuildContext context, Box<dynamic> appConf) async {
|
||||
final userOk = await showConfirmDialogs(
|
||||
context,
|
||||
S.current.app_splash_dialog_u_a_p_p,
|
||||
|
@@ -63,7 +63,7 @@ class ToolsUIModel extends _$ToolsUIModel {
|
||||
return state;
|
||||
}
|
||||
|
||||
loadToolsCard(BuildContext context, {bool skipPathScan = false}) async {
|
||||
Future<void> loadToolsCard(BuildContext context, {bool skipPathScan = false}) async {
|
||||
if (state.isItemLoading) return;
|
||||
var items = <ToolsItemData>[];
|
||||
state = state.copyWith(items: items, isItemLoading: true);
|
||||
@@ -352,7 +352,7 @@ class ToolsUIModel extends _$ToolsUIModel {
|
||||
SystemHelper.checkAndLaunchRSILauncher(state.rsiLauncherInstalledPath);
|
||||
}
|
||||
|
||||
openDir(path) async {
|
||||
Future<void> openDir(dynamic path) async {
|
||||
SystemHelper.openDir(path);
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ class ToolsUIModel extends _$ToolsUIModel {
|
||||
return true;
|
||||
}
|
||||
|
||||
_onChangePhotographyMode(BuildContext context, bool isEnable) async {
|
||||
Future<void> _onChangePhotographyMode(BuildContext context, bool isEnable) async {
|
||||
_checkPhotographyStatus(context, setMode: !isEnable).unwrap(context: context);
|
||||
loadToolsCard(context, skipPathScan: true);
|
||||
}
|
||||
@@ -539,15 +539,15 @@ class ToolsUIModel extends _$ToolsUIModel {
|
||||
state = state.copyWith(rsiLauncherInstalledPath: s);
|
||||
}
|
||||
|
||||
_doHostsBooster(BuildContext context) async {
|
||||
Future<void> _doHostsBooster(BuildContext context) async {
|
||||
showDialog(context: context, builder: (BuildContext context) => const HostsBoosterDialogUI());
|
||||
}
|
||||
|
||||
_unp4kc(BuildContext context) async {
|
||||
Future<void> _unp4kc(BuildContext context) async {
|
||||
context.push("/tools/unp4kc");
|
||||
}
|
||||
|
||||
static rsiEnhance(BuildContext context, {bool showNotGameInstallMsg = false}) async {
|
||||
static Future<void> rsiEnhance(BuildContext context, {bool showNotGameInstallMsg = false}) async {
|
||||
if ((await SystemHelper.getPID("\"RSI Launcher\"")).isNotEmpty) {
|
||||
if (!context.mounted) return;
|
||||
showToast(context, S.current.tools_action_info_rsi_launcher_running_warning,
|
||||
@@ -562,7 +562,7 @@ class ToolsUIModel extends _$ToolsUIModel {
|
||||
));
|
||||
}
|
||||
|
||||
_showLogAnalyze(BuildContext context) async {
|
||||
Future<void> _showLogAnalyze(BuildContext context) async {
|
||||
if (state.scInstalledPath.isEmpty) {
|
||||
showToast(context, S.current.tools_action_info_valid_game_directory_needed);
|
||||
return;
|
||||
|
@@ -213,11 +213,11 @@ class WebViewModel {
|
||||
return finalUrl;
|
||||
}
|
||||
|
||||
launch(String url, AppVersionData appVersionData) async {
|
||||
Future<void> launch(String url, AppVersionData appVersionData) async {
|
||||
webview.launch(await _handleMirrorsUrl(url, appVersionData));
|
||||
}
|
||||
|
||||
initLocalization(AppWebLocalizationVersionsData v) async {
|
||||
Future<void> initLocalization(AppWebLocalizationVersionsData v) async {
|
||||
localizationScript = await rootBundle.loadString('assets/web_script.js');
|
||||
|
||||
/// https://github.com/CxJuice/Uex_Chinese_Translate
|
||||
|
@@ -35,7 +35,7 @@ class _CountdownTimeTextState extends State<CountdownTimeText> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
_onUpdateTime(_) {
|
||||
void _onUpdateTime(_) {
|
||||
final now = DateTime.now();
|
||||
final dur = widget.targetTime.difference(now);
|
||||
setState(() {
|
||||
|
@@ -212,7 +212,7 @@ class LoadingWidget<T> extends HookConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
addPostFrameCallback(Function() callback) {
|
||||
void addPostFrameCallback(Function() callback) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
callback();
|
||||
});
|
||||
|
Reference in New Issue
Block a user