Small fixes
This commit is contained in:
parent
a54d0e4c0f
commit
043b06dedc
8 changed files with 2678 additions and 93 deletions
|
@ -6,8 +6,10 @@ import 'package:zontreck/Constants.dart';
|
|||
import 'package:zontreck/Packets.dart';
|
||||
import 'package:zontreck/Settings.dart';
|
||||
|
||||
import '../LastNames.dart';
|
||||
|
||||
class RegisterAccountPage extends StatefulWidget {
|
||||
RegisterAccountPage({super.key});
|
||||
const RegisterAccountPage({super.key});
|
||||
|
||||
@override
|
||||
RegisterAccountState createState() => RegisterAccountState();
|
||||
|
@ -48,7 +50,7 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
|||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("OpenSim - Register Account"),
|
||||
title: const Text("OpenSim - Register Account"),
|
||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||
),
|
||||
floatingActionButton: canSubmit
|
||||
|
@ -70,17 +72,17 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
|||
APIEndpoint.Register, packet) as S2CSimpleReplyPacket;
|
||||
|
||||
if (response.done) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text(
|
||||
"User Account Created. You must now login to finish setting up the account")));
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content:
|
||||
Text("Fatal error when creating user account")));
|
||||
}
|
||||
},
|
||||
child: Text("Create my Account"))
|
||||
child: const Text("Create my Account"))
|
||||
: null,
|
||||
body: FooterView(
|
||||
footer: Footer(
|
||||
|
@ -90,20 +92,20 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
|||
const Text("${Constants.COPYRIGHT}\n${Constants.VERSION}")),
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
settings.hasNoUsers
|
||||
? ListTile(
|
||||
title: Text("There are no users on this grid."),
|
||||
title: const Text("There are no users on this grid."),
|
||||
tileColor: Constants.TITLEBAR_COLOR,
|
||||
subtitle: Text(
|
||||
"This account will be granted Level 240, and the User Title : ${UserTitles.OPERATOR.title}"),
|
||||
)
|
||||
: SizedBox(),
|
||||
: const SizedBox(),
|
||||
ListTile(
|
||||
title: Text("First Name"),
|
||||
title: const Text("First Name"),
|
||||
subtitle: TextField(
|
||||
controller: firstNameController,
|
||||
onChanged: (v) {
|
||||
|
@ -112,7 +114,7 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
|||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Last Name"),
|
||||
title: const Text("Last Name"),
|
||||
subtitle: Constants.ALLOW_ANY_LAST_NAME ||
|
||||
settings.hasNoUsers
|
||||
? TextField(
|
||||
|
@ -131,10 +133,10 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
|||
LastNames.getCurrentNames(),
|
||||
)),
|
||||
ListTile(
|
||||
title: Text("Password"),
|
||||
title: const Text("Password"),
|
||||
subtitle: TextField(
|
||||
controller: password,
|
||||
decoration: InputDecoration(
|
||||
decoration: const InputDecoration(
|
||||
hintText: "*******",
|
||||
),
|
||||
obscureText: true,
|
||||
|
@ -145,10 +147,10 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
|||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Password Confirmation"),
|
||||
title: const Text("Password Confirmation"),
|
||||
subtitle: TextField(
|
||||
controller: confirm,
|
||||
decoration: InputDecoration(
|
||||
decoration: const InputDecoration(
|
||||
hintText: "*******",
|
||||
),
|
||||
obscureText: true,
|
||||
|
@ -160,21 +162,21 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
|||
),
|
||||
passwordMatches ||
|
||||
password.text == "" && confirm.text == ""
|
||||
? Divider(
|
||||
? const Divider(
|
||||
thickness: 2,
|
||||
)
|
||||
: ListTile(
|
||||
: const ListTile(
|
||||
title: Text("Passwords do not match"),
|
||||
tileColor: Constants.TITLEBAR_COLOR,
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Email Address"),
|
||||
title: const Text("Email Address"),
|
||||
subtitle: TextField(
|
||||
onChanged: (V) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: email,
|
||||
decoration: InputDecoration(
|
||||
decoration: const InputDecoration(
|
||||
hintText:
|
||||
"Your email address. It is not used by zontreck.com, but if needed, can be used to reach you"),
|
||||
),
|
||||
|
@ -186,23 +188,3 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
|||
]));
|
||||
}
|
||||
}
|
||||
|
||||
enum LastNames {
|
||||
Aabye,
|
||||
Aarde,
|
||||
Bailey,
|
||||
Caballero;
|
||||
|
||||
static List<DropdownMenuEntry<Object?>> getCurrentNames() {
|
||||
return [
|
||||
LastNames.Aabye.getEntry(),
|
||||
LastNames.Aarde.getEntry(),
|
||||
LastNames.Bailey.getEntry(),
|
||||
LastNames.Caballero.getEntry()
|
||||
];
|
||||
}
|
||||
|
||||
DropdownMenuEntry<String> getEntry() {
|
||||
return DropdownMenuEntry(value: this.name, label: this.name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue