Migrate settings into its own special entry to utilize type adapters fully.

This commit is contained in:
Zontreck 2023-11-03 14:17:07 -07:00
parent 8f28b5a399
commit d03613b0c7
7 changed files with 74 additions and 58 deletions

View file

@ -61,18 +61,18 @@ class HomePageState extends State<HomePage> {
leading: Icon(CupertinoIcons.gear),
subtitle: Text("Linux Proton"),
onTap: () {
if (settings.steamcmd_path.isNotEmpty)
if (settings.inst!.steamcmd_path.isNotEmpty)
Navigator.pushNamed(context, "/proton");
},
), // Not yet implemented
ListTile(
title: Text("SteamCMD"),
leading: Icon(Icons.comment_rounded),
subtitle: settings.steamcmd_path.isEmpty
subtitle: settings.inst!.steamcmd_path.isEmpty
? Text("Path Not Set")
: Text(settings.steamcmd_path),
: Text(settings.inst!.steamcmd_path),
onTap: () {
if (settings.steamcmd_path.isNotEmpty) {
if (settings.inst!.steamcmd_path.isNotEmpty) {
Navigator.pushNamed(context, "/steamcmd");
}
},
@ -80,18 +80,18 @@ class HomePageState extends State<HomePage> {
ListTile(
title: Text("Server Path"),
leading: Icon(CupertinoIcons.folder),
subtitle: settings.game_path.isEmpty
subtitle: settings.inst!.game_path.isEmpty
? Text("Not Set")
: Text(settings.game_path),
: Text(settings.inst!.game_path),
onTap: () async {
var path = await getDirectoryPath();
setState(() {
if (path != null && path.isNotEmpty) {
settings.game_path = path;
settings.steamcmd_path =
settings.inst!.game_path = path;
settings.inst!.steamcmd_path =
path + Platform.pathSeparator + "scmd";
Directory.current = Directory(settings.game_path);
Directory.current = Directory(settings.inst!.game_path);
}
});