dart: fix

This commit is contained in:
2025-08-15 22:52:13 +08:00
parent 44bf771f4c
commit 99104527d4
30 changed files with 57 additions and 56 deletions

View File

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

View File

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

View File

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

View File

@@ -285,7 +285,7 @@ class HomeGameDoctorUI extends HookConsumerWidget {
);
}
_onTapButton(
Future<void> _onTapButton(
BuildContext context, String key, HomeUIModelState homeState) async {
switch (key) {
case "rsi_log":

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -24,7 +24,7 @@ class ServerQrState extends _$ServerQrState {
_context = context;
}
popDialog() {
void popDialog() {
_context?.pop();
}
}

View File

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

View File

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

View File

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

View File

@@ -164,7 +164,7 @@ class IndexUI extends HookConsumerWidget {
);
}
_goDownloader(BuildContext context) {
void _goDownloader(BuildContext context) {
context.push('/index/downloader');
}
}

View File

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

View File

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

View File

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

View File

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