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