import 'dart:io'; import 'package:file_selector/file_selector.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:servermanager/settings.dart'; class HomePage extends StatefulWidget { Settings settings; HomePage({super.key, required this.settings}); @override HomePageState createState() => HomePageState(settings: settings); } class HomePageState extends State { Settings settings = Settings(); HomePageState({required this.settings}); @override Widget build(BuildContext context) { settings.Read(); return Scaffold( appBar: AppBar( title: Text("Conan Exiles Server Manager"), backgroundColor: Color.fromARGB(255, 100, 0, 0), ), drawer: Drawer( child: SingleChildScrollView( child: Column(children: [ DrawerHeader( child: Column( children: [ Icon(Icons.computer), Text("Conan Exiles Server Manager") ], )), Column( children: [ ListTile( title: Text("S E R V E R"), leading: Icon(Icons.cloud), subtitle: Text("The game server!"), onTap: () { Navigator.pushNamed(context, "/server"); }, ) ], ) ]), )), body: SingleChildScrollView( padding: EdgeInsets.all(16), child: Column( children: [ ListTile( title: Text("SteamCMD"), leading: Icon(Icons.comment_rounded), subtitle: settings.steamcmd_path.isEmpty ? Text("Path Not Set") : Text(settings.steamcmd_path), onTap: () { if (settings.steamcmd_path.isNotEmpty) { Navigator.pushNamed(context, "/steamcmd"); } }, ), ListTile( title: Text("Server Path"), leading: Icon(CupertinoIcons.folder), subtitle: settings.game_path.isEmpty ? Text("Not Set") : Text(settings.game_path), onTap: () async { var path = await getDirectoryPath(); setState(() { if (path != null && path.isNotEmpty) { settings.game_path = path; settings.steamcmd_path = path + Platform.pathSeparator + "scmd"; Directory.current = Directory(settings.game_path); } }); await settings.Open(); settings.Read(); }, ) ], )), ); } }