Apply automatic dart fixes
This commit is contained in:
parent
fc9dc6f4d3
commit
e0561ea13f
6 changed files with 41 additions and 49 deletions
|
@ -28,8 +28,9 @@ class InputBox extends StatelessWidget {
|
|||
this.hasInputField = true}) {
|
||||
if (isDefault) {
|
||||
value.text = "";
|
||||
} else
|
||||
} else {
|
||||
value.text = defaultText;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -44,22 +45,22 @@ class InputBox extends StatelessWidget {
|
|||
onSubmit();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: hasInputField ? Text("Submit") : Text("OK"),
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(states) => const Color.fromARGB(255, 0, 83, 3))),
|
||||
child: hasInputField ? Text("Submit") : Text("OK"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
onCancel();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text("Cancel"),
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(states) => const Color.fromARGB(255, 109, 7, 0))))
|
||||
(states) => const Color.fromARGB(255, 109, 7, 0))),
|
||||
child: Text("Cancel"))
|
||||
],
|
||||
content: Container(
|
||||
content: SizedBox(
|
||||
height: 128,
|
||||
//decoration: BoxDecoration(
|
||||
//border: Border.all(style: BorderStyle.solid),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
import 'package:servermanager/mod.dart';
|
||||
import 'package:servermanager/settings.dart';
|
||||
|
||||
|
@ -34,8 +33,9 @@ class GameServerPageState extends State<GameServerPage> {
|
|||
SnackBar(content: Text("Wait until the download completes")));
|
||||
|
||||
return false;
|
||||
} else
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(16),
|
||||
|
@ -199,11 +199,11 @@ class ModManagerState extends State<ModManager> {
|
|||
itemBuilder: (ctx, idx) {
|
||||
Mod mod = settings.inst!.mods[idx];
|
||||
return Padding(
|
||||
key: Key("${mod.mod_instance_id()}"),
|
||||
key: Key(mod.mod_instance_id()),
|
||||
padding: EdgeInsets.all(12),
|
||||
child: ListTile(
|
||||
title: Text(mod.mod_name),
|
||||
subtitle: Text("ID: " + mod.mod_id.toString()),
|
||||
subtitle: Text("ID: ${mod.mod_id}"),
|
||||
onTap: () async {
|
||||
final reply = await Navigator.pushNamed(
|
||||
context, "/server/mods/edit",
|
||||
|
@ -212,14 +212,15 @@ class ModManagerState extends State<ModManager> {
|
|||
mod_name: mod.mod_name,
|
||||
newMod: false));
|
||||
|
||||
if (reply != null)
|
||||
if (reply != null) {
|
||||
setState(() {
|
||||
settings.inst!.mods[idx] = reply as Mod;
|
||||
});
|
||||
else
|
||||
} else {
|
||||
setState(() {
|
||||
settings.inst!.mods.removeAt(idx);
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -352,16 +353,17 @@ class ModPage extends StatelessWidget {
|
|||
]),
|
||||
),
|
||||
onWillPop: () async {
|
||||
int id_val = 0;
|
||||
int idVal = 0;
|
||||
try {
|
||||
id_val = int.parse(id.text);
|
||||
idVal = int.parse(id.text);
|
||||
} catch (E) {}
|
||||
|
||||
if (willDelete)
|
||||
if (willDelete) {
|
||||
Navigator.pop(context, null);
|
||||
else
|
||||
} else {
|
||||
Navigator.pop(context,
|
||||
Mod(mod_id: id_val, mod_name: name.text, newMod: false));
|
||||
Mod(mod_id: idVal, mod_name: name.text, newMod: false));
|
||||
}
|
||||
return true;
|
||||
},
|
||||
),
|
||||
|
|
|
@ -61,8 +61,9 @@ class HomePageState extends State<HomePage> {
|
|||
leading: Icon(CupertinoIcons.gear),
|
||||
subtitle: Text("Linux Proton"),
|
||||
onTap: () {
|
||||
if (settings.steamcmd_path.isNotEmpty)
|
||||
if (settings.steamcmd_path.isNotEmpty) {
|
||||
Navigator.pushNamed(context, "/proton");
|
||||
}
|
||||
},
|
||||
), // Not yet implemented
|
||||
ListTile(
|
||||
|
@ -89,7 +90,7 @@ class HomePageState extends State<HomePage> {
|
|||
if (path != null && path.isNotEmpty) {
|
||||
settings.game_path = path;
|
||||
settings.steamcmd_path =
|
||||
path + Platform.pathSeparator + "scmd";
|
||||
"$path${Platform.pathSeparator}scmd";
|
||||
|
||||
Directory.current = Directory(settings.game_path);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class Proton extends StatefulWidget {
|
|||
Future<void> runProton(String command, List<String> argx) async {
|
||||
Settings settings = Settings();
|
||||
Directory dir =
|
||||
Directory(settings.game_path + Platform.pathSeparator + "pfx");
|
||||
Directory("${settings.game_path}${Platform.pathSeparator}pfx");
|
||||
|
||||
if (dir.existsSync()) {
|
||||
await dir.delete(recursive: true);
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:servermanager/credentials.dart';
|
||||
import 'package:servermanager/mod.dart';
|
||||
import 'package:servermanager/settingsEntry.dart';
|
||||
import 'package:servermanager/steamcmd.dart';
|
||||
|
||||
class Settings {
|
||||
Settings._();
|
||||
|
@ -35,8 +32,9 @@ class Settings {
|
|||
bool isValid() {
|
||||
if (!Hive.isBoxOpen("settings")) {
|
||||
return false;
|
||||
} else
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Future<Box<E>> Open<E>() {
|
||||
|
@ -51,44 +49,40 @@ class Settings {
|
|||
}
|
||||
|
||||
String getServerPath() {
|
||||
return game_path + Platform.pathSeparator + "server";
|
||||
return "$game_path${Platform.pathSeparator}server";
|
||||
}
|
||||
|
||||
bool checkInitDone() {
|
||||
if (File(steamcmd_path + Platform.pathSeparator + "cxinit").existsSync()) {
|
||||
if (File("$steamcmd_path${Platform.pathSeparator}cxinit").existsSync()) {
|
||||
return true;
|
||||
} else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String getSteamCmd() {
|
||||
return steamcmd_path +
|
||||
Platform.pathSeparator +
|
||||
"steamcmd" +
|
||||
(Platform.isWindows ? ".exe" : ".sh");
|
||||
return "$steamcmd_path${Platform.pathSeparator}steamcmd${Platform.isWindows ? ".exe" : ".sh"}";
|
||||
}
|
||||
|
||||
String getSteamCmd2FA() {
|
||||
return steamcmd_path +
|
||||
Platform.pathSeparator +
|
||||
"steamcmd-2fa" +
|
||||
(Platform.isWindows ? ".exe" : "");
|
||||
return "$steamcmd_path${Platform.pathSeparator}steamcmd-2fa${Platform.isWindows ? ".exe" : ""}";
|
||||
}
|
||||
|
||||
String getModPath() {
|
||||
return game_path + Platform.pathSeparator + "mods";
|
||||
return "$game_path${Platform.pathSeparator}mods";
|
||||
}
|
||||
|
||||
Future<void> createModFolderIfNotExists() async {
|
||||
if (Directory(getModPath()).existsSync())
|
||||
if (Directory(getModPath()).existsSync()) {
|
||||
return;
|
||||
else
|
||||
} else {
|
||||
await Directory(getModPath()).create(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
bool serverInstalled() {
|
||||
return File(
|
||||
getServerPath() + Platform.pathSeparator + "ConanSandboxServer.exe")
|
||||
"${getServerPath()}${Platform.pathSeparator}ConanSandboxServer.exe")
|
||||
.existsSync();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import 'package:archive/archive_io.dart';
|
|||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
import 'package:servermanager/credentials.dart';
|
||||
import 'package:servermanager/dialogbox.dart';
|
||||
import 'package:servermanager/settings.dart';
|
||||
|
@ -68,9 +67,7 @@ class SteamCMDState extends State<SteamCMD> {
|
|||
|
||||
if (Platform.isWindows) {
|
||||
// Download zip file
|
||||
final path = settings.steamcmd_path +
|
||||
Platform.pathSeparator +
|
||||
"windows.zip";
|
||||
final path = "${settings.steamcmd_path}${Platform.pathSeparator}windows.zip";
|
||||
final reply = await dio.download(windows, path);
|
||||
|
||||
final bytes = File(path).readAsBytesSync();
|
||||
|
@ -94,9 +91,7 @@ class SteamCMDState extends State<SteamCMD> {
|
|||
await Process.start("steamcmd.exe", ["+quit"]);
|
||||
} else {
|
||||
// Download tgz file
|
||||
final path = settings.steamcmd_path +
|
||||
Platform.pathSeparator +
|
||||
"linux.tgz";
|
||||
final path = "${settings.steamcmd_path}${Platform.pathSeparator}linux.tgz";
|
||||
final reply = await dio.download(linux, path);
|
||||
|
||||
final bytes = File(path).readAsBytesSync();
|
||||
|
@ -145,13 +140,12 @@ class SteamCMDState extends State<SteamCMD> {
|
|||
(Platform.isWindows
|
||||
? "steamcmd-2fa.exe"
|
||||
: "steamcmd-2fa"));
|
||||
if (!Platform.isWindows)
|
||||
if (!Platform.isWindows) {
|
||||
var proc = await Process.start("chmod", [
|
||||
"+x",
|
||||
settings.steamcmd_path +
|
||||
Platform.pathSeparator +
|
||||
"steamcmd-2fa"
|
||||
"${settings.steamcmd_path}${Platform.pathSeparator}steamcmd-2fa"
|
||||
]);
|
||||
}
|
||||
}),
|
||||
ListTile(
|
||||
title: Text("Credentials"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue