131 lines
4 KiB
Dart
131 lines
4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../structs/serversettings.dart';
|
|
|
|
class ServerSettingsPage extends StatefulWidget {
|
|
ServerSettingsPage({super.key});
|
|
|
|
@override
|
|
ServerSettingsState createState() => ServerSettingsState();
|
|
}
|
|
|
|
class ServerSettingsState extends State<ServerSettingsPage> {
|
|
String pass = "";
|
|
TextEditingController passwordController = TextEditingController();
|
|
TextEditingController rconPortController = TextEditingController();
|
|
TextEditingController qPortController = TextEditingController();
|
|
TextEditingController wrapperPortController = TextEditingController();
|
|
|
|
TextEditingController gPortController = TextEditingController();
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
var args = ModalRoute.of(context)!.settings.arguments as ServerSettings;
|
|
|
|
passwordController.text = args.RconPassword;
|
|
rconPortController.text = "${args.RconPort}";
|
|
gPortController.text = "${args.GamePort}";
|
|
qPortController.text = "${args.QueryPort}";
|
|
wrapperPortController.text = "${args.WrapperPort}";
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text("Server Settings"),
|
|
backgroundColor: Color.fromARGB(255, 100, 0, 0),
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 256,
|
|
child: ListTile(title: Text("Rcon Password")),
|
|
),
|
|
Expanded(
|
|
child: TextField(
|
|
controller: passwordController,
|
|
decoration: InputDecoration(
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8))),
|
|
))
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 256,
|
|
child: ListTile(
|
|
title: Text("Rcon Port"),
|
|
),
|
|
),
|
|
Expanded(child: TextField(controller: rconPortController))
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 256,
|
|
child: ListTile(
|
|
title: Text("Game Port"),
|
|
),
|
|
),
|
|
Expanded(child: TextField(controller: gPortController))
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 256,
|
|
child: ListTile(
|
|
title: Text("Query Port"),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: TextField(
|
|
controller: qPortController,
|
|
))
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 256,
|
|
child: ListTile(
|
|
title: Text("Wrapper Port"),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: TextField(
|
|
controller: wrapperPortController,
|
|
)),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
Navigator.pop(
|
|
context,
|
|
ServerSettings(
|
|
RconPassword: passwordController.text,
|
|
RconPort: int.parse(rconPortController.text),
|
|
GamePort: int.parse(gPortController.text),
|
|
QueryPort: int.parse(qPortController.text),
|
|
WrapperPort:
|
|
int.parse(wrapperPortController.text)));
|
|
},
|
|
child: Text("Submit"))
|
|
],
|
|
)
|
|
],
|
|
)),
|
|
),
|
|
);
|
|
}
|
|
}
|