Small fixes
This commit is contained in:
parent
a54d0e4c0f
commit
043b06dedc
8 changed files with 2678 additions and 93 deletions
2597
lib/LastNames.dart
Normal file
2597
lib/LastNames.dart
Normal file
File diff suppressed because it is too large
Load diff
|
@ -63,8 +63,9 @@ class Settings {
|
||||||
NbtUtils.writeBoolean(tag, "loggedIn", settings.loggedIn);
|
NbtUtils.writeBoolean(tag, "loggedIn", settings.loggedIn);
|
||||||
tag.put("name", StringTag.valueOf(settings.userName));
|
tag.put("name", StringTag.valueOf(settings.userName));
|
||||||
tag.put("display", StringTag.valueOf(settings.displayName));
|
tag.put("display", StringTag.valueOf(settings.displayName));
|
||||||
if (settings.currentUser != null)
|
if (settings.currentUser != null) {
|
||||||
tag.put("user", settings.currentUser!.save());
|
tag.put("user", settings.currentUser!.save());
|
||||||
|
}
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:zontreck/Packets.dart';
|
||||||
import 'package:zontreck/Settings.dart';
|
import 'package:zontreck/Settings.dart';
|
||||||
|
|
||||||
class LoginAccountPage extends StatefulWidget {
|
class LoginAccountPage extends StatefulWidget {
|
||||||
LoginAccountPage({super.key});
|
const LoginAccountPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => LoginAccountState();
|
State<StatefulWidget> createState() => LoginAccountState();
|
||||||
|
@ -25,35 +25,35 @@ class LoginAccountState extends State<LoginAccountPage> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("OpenSim - Login"),
|
title: const Text("OpenSim - Login"),
|
||||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("First Name"),
|
title: const Text("First Name"),
|
||||||
subtitle: TextField(
|
subtitle: TextField(
|
||||||
controller: first,
|
controller: first,
|
||||||
decoration: InputDecoration(hintText: "Jane"),
|
decoration: const InputDecoration(hintText: "Jane"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Last Name"),
|
title: const Text("Last Name"),
|
||||||
subtitle: TextField(
|
subtitle: TextField(
|
||||||
controller: last,
|
controller: last,
|
||||||
decoration: InputDecoration(hintText: "Smith"),
|
decoration: const InputDecoration(hintText: "Smith"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Password"),
|
title: const Text("Password"),
|
||||||
subtitle: TextField(
|
subtitle: TextField(
|
||||||
controller: pass,
|
controller: pass,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
obscuringCharacter: "*",
|
obscuringCharacter: "*",
|
||||||
decoration: InputDecoration(hintText: "*******"),
|
decoration: const InputDecoration(hintText: "*******"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
@ -68,7 +68,7 @@ class LoginAccountState extends State<LoginAccountPage> {
|
||||||
print("RESPONSE : ${response.encode()}");
|
print("RESPONSE : ${response.encode()}");
|
||||||
if (response.loggedIn) {
|
if (response.loggedIn) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text("Login success")));
|
const SnackBar(content: Text("Login success")));
|
||||||
|
|
||||||
settings.loggedIn = true;
|
settings.loggedIn = true;
|
||||||
settings.currentUser = response.user;
|
settings.currentUser = response.user;
|
||||||
|
@ -87,7 +87,7 @@ class LoginAccountState extends State<LoginAccountPage> {
|
||||||
"Error while logging in: ${response.reason}")));
|
"Error while logging in: ${response.reason}")));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text("Login"))
|
child: const Text("Login"))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -16,10 +16,10 @@ class MainPage extends StatelessWidget {
|
||||||
routes: {
|
routes: {
|
||||||
"/": (context) => const HomePage(),
|
"/": (context) => const HomePage(),
|
||||||
"/opensim": (context) => const OpenSimPage(),
|
"/opensim": (context) => const OpenSimPage(),
|
||||||
"/opensim/register": (context) => RegisterAccountPage(),
|
"/opensim/register": (context) => const RegisterAccountPage(),
|
||||||
"/opensim/login": (context) => LoginAccountPage(),
|
"/opensim/login": (context) => const LoginAccountPage(),
|
||||||
"/portfolio": (context) => PortfolioPage(),
|
"/portfolio": (context) => const PortfolioPage(),
|
||||||
"/portfolio/coun": (context) => CardsOfUtterNonsense()
|
"/portfolio/coun": (context) => const CardsOfUtterNonsense()
|
||||||
},
|
},
|
||||||
theme: ThemeData.dark(),
|
theme: ThemeData.dark(),
|
||||||
);
|
);
|
||||||
|
@ -87,9 +87,9 @@ class HomePageState extends State<HomePage> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("P O R T F O L I O"),
|
title: const Text("P O R T F O L I O"),
|
||||||
subtitle: Text("View my work"),
|
subtitle: const Text("View my work"),
|
||||||
leading: Icon(Icons.book_online),
|
leading: const Icon(Icons.book_online),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushNamed(context, "/portfolio");
|
Navigator.pushNamed(context, "/portfolio");
|
||||||
},
|
},
|
||||||
|
|
|
@ -117,7 +117,7 @@ class OpenSimPageState extends State<OpenSimPage> {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
if (prefs.containsKey("settings")) {
|
if (prefs.containsKey("settings")) {
|
||||||
String encoded = prefs.getString("settings")!;
|
String encoded = prefs.getString("settings")!;
|
||||||
CompoundTag tag = await NbtIo.readBase64String(encoded) as CompoundTag;
|
CompoundTag tag = await NbtIo.readBase64String(encoded);
|
||||||
if (tag.contains("user")) {
|
if (tag.contains("user")) {
|
||||||
settings.currentUser = User.load(tag.get("user") as CompoundTag);
|
settings.currentUser = User.load(tag.get("user") as CompoundTag);
|
||||||
settings.loggedIn = true;
|
settings.loggedIn = true;
|
||||||
|
@ -157,7 +157,7 @@ class OpenSimPageState extends State<OpenSimPage> {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (B) {
|
builder: (B) {
|
||||||
return CreateInventoryPopup();
|
return const CreateInventoryPopup();
|
||||||
});
|
});
|
||||||
activating = false;
|
activating = false;
|
||||||
// Force user to re-login
|
// Force user to re-login
|
||||||
|
@ -188,7 +188,7 @@ class OpenSimPageState extends State<OpenSimPage> {
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: polling
|
child: polling
|
||||||
? Column(
|
? const Column(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Please wait... downloading content"),
|
title: Text("Please wait... downloading content"),
|
||||||
|
@ -236,7 +236,7 @@ class OpenSimPageState extends State<OpenSimPage> {
|
||||||
|
|
||||||
didChangeDependencies();
|
didChangeDependencies();
|
||||||
},
|
},
|
||||||
child: Text("LOGOUT"))
|
child: const Text("LOGOUT"))
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: Center(
|
: Center(
|
||||||
|
@ -249,14 +249,14 @@ class OpenSimPageState extends State<OpenSimPage> {
|
||||||
|
|
||||||
didChangeDependencies();
|
didChangeDependencies();
|
||||||
},
|
},
|
||||||
child: Text("Login")),
|
child: const Text("Login")),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.pushNamed(
|
await Navigator.pushNamed(
|
||||||
context, "/opensim/register");
|
context, "/opensim/register");
|
||||||
didChangeDependencies();
|
didChangeDependencies();
|
||||||
},
|
},
|
||||||
child: Text("Register Account"))
|
child: const Text("Register Account"))
|
||||||
],
|
],
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
|
|
|
@ -4,13 +4,13 @@ import 'package:footer/footer_view.dart';
|
||||||
import 'package:zontreck/Constants.dart';
|
import 'package:zontreck/Constants.dart';
|
||||||
|
|
||||||
class PortfolioPage extends StatelessWidget {
|
class PortfolioPage extends StatelessWidget {
|
||||||
PortfolioPage({super.key});
|
const PortfolioPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("Zontreck.com - Portfolio of Tara Piccari"),
|
title: const Text("Zontreck.com - Portfolio of Tara Piccari"),
|
||||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||||
),
|
),
|
||||||
body: FooterView(
|
body: FooterView(
|
||||||
|
@ -21,26 +21,26 @@ class PortfolioPage extends StatelessWidget {
|
||||||
const Text("${Constants.COPYRIGHT}\n${Constants.VERSION}")),
|
const Text("${Constants.COPYRIGHT}\n${Constants.VERSION}")),
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
PortfolioEntry(
|
PortfolioEntry(
|
||||||
title: ListTile(title: Text("Cards of Utter Nonsense")),
|
title: const ListTile(title: Text("Cards of Utter Nonsense")),
|
||||||
body: Text(
|
body: const Text(
|
||||||
"A product I created for Second Life, but may port to the mobile phone at some point"),
|
"A product I created for Second Life, but may port to the mobile phone at some point"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushNamed(context, "/portfolio/coun");
|
Navigator.pushNamed(context, "/portfolio/coun");
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
PortfolioEntry(
|
PortfolioEntry(
|
||||||
title: Text("Zontreck.com"),
|
title: const Text("Zontreck.com"),
|
||||||
body: Text(
|
body: const Text(
|
||||||
("This website, which is written entirely in Flutter, with some supporting API files in PHP")),
|
("This website, which is written entirely in Flutter, with some supporting API files in PHP")),
|
||||||
onTap: () {}),
|
onTap: () {}),
|
||||||
PortfolioEntry(
|
PortfolioEntry(
|
||||||
title: Text("Minecraft Modding"),
|
title: const Text("Minecraft Modding"),
|
||||||
body: Text(
|
body: const Text(
|
||||||
"These mods are all written in Java. The various mods I currently maintain, previously maintained, or have contributed to are: Thresholds, Aria's Essentials, LibZontreck, Let's Do Beachparty, WatchMyDurability"),
|
"These mods are all written in Java. The various mods I currently maintain, previously maintained, or have contributed to are: Thresholds, Aria's Essentials, LibZontreck, Let's Do Beachparty, WatchMyDurability"),
|
||||||
onTap: () {})
|
onTap: () {})
|
||||||
],
|
],
|
||||||
|
@ -56,8 +56,8 @@ class PortfolioEntry extends StatelessWidget {
|
||||||
final Widget body;
|
final Widget body;
|
||||||
final Function() onTap;
|
final Function() onTap;
|
||||||
|
|
||||||
PortfolioEntry(
|
const PortfolioEntry(
|
||||||
{required this.title, required this.body, required this.onTap});
|
{super.key, required this.title, required this.body, required this.onTap});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -67,14 +67,14 @@ class PortfolioEntry extends StatelessWidget {
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 225,
|
width: 225,
|
||||||
height: 325,
|
height: 325,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
title,
|
title,
|
||||||
Divider(
|
const Divider(
|
||||||
thickness: 4,
|
thickness: 4,
|
||||||
),
|
),
|
||||||
body
|
body
|
||||||
|
@ -88,14 +88,16 @@ class PortfolioEntry extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CardsOfUtterNonsense extends StatelessWidget {
|
class CardsOfUtterNonsense extends StatelessWidget {
|
||||||
|
const CardsOfUtterNonsense({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("Portfolio Entry - Cards of Utter Nonsense"),
|
title: const Text("Portfolio Entry - Cards of Utter Nonsense"),
|
||||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: const Padding(
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
|
@ -6,8 +6,10 @@ import 'package:zontreck/Constants.dart';
|
||||||
import 'package:zontreck/Packets.dart';
|
import 'package:zontreck/Packets.dart';
|
||||||
import 'package:zontreck/Settings.dart';
|
import 'package:zontreck/Settings.dart';
|
||||||
|
|
||||||
|
import '../LastNames.dart';
|
||||||
|
|
||||||
class RegisterAccountPage extends StatefulWidget {
|
class RegisterAccountPage extends StatefulWidget {
|
||||||
RegisterAccountPage({super.key});
|
const RegisterAccountPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
RegisterAccountState createState() => RegisterAccountState();
|
RegisterAccountState createState() => RegisterAccountState();
|
||||||
|
@ -48,7 +50,7 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("OpenSim - Register Account"),
|
title: const Text("OpenSim - Register Account"),
|
||||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||||
),
|
),
|
||||||
floatingActionButton: canSubmit
|
floatingActionButton: canSubmit
|
||||||
|
@ -70,17 +72,17 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
||||||
APIEndpoint.Register, packet) as S2CSimpleReplyPacket;
|
APIEndpoint.Register, packet) as S2CSimpleReplyPacket;
|
||||||
|
|
||||||
if (response.done) {
|
if (response.done) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
"User Account Created. You must now login to finish setting up the account")));
|
"User Account Created. You must now login to finish setting up the account")));
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
content:
|
content:
|
||||||
Text("Fatal error when creating user account")));
|
Text("Fatal error when creating user account")));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text("Create my Account"))
|
child: const Text("Create my Account"))
|
||||||
: null,
|
: null,
|
||||||
body: FooterView(
|
body: FooterView(
|
||||||
footer: Footer(
|
footer: Footer(
|
||||||
|
@ -90,20 +92,20 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
||||||
const Text("${Constants.COPYRIGHT}\n${Constants.VERSION}")),
|
const Text("${Constants.COPYRIGHT}\n${Constants.VERSION}")),
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
settings.hasNoUsers
|
settings.hasNoUsers
|
||||||
? ListTile(
|
? ListTile(
|
||||||
title: Text("There are no users on this grid."),
|
title: const Text("There are no users on this grid."),
|
||||||
tileColor: Constants.TITLEBAR_COLOR,
|
tileColor: Constants.TITLEBAR_COLOR,
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
"This account will be granted Level 240, and the User Title : ${UserTitles.OPERATOR.title}"),
|
"This account will be granted Level 240, and the User Title : ${UserTitles.OPERATOR.title}"),
|
||||||
)
|
)
|
||||||
: SizedBox(),
|
: const SizedBox(),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("First Name"),
|
title: const Text("First Name"),
|
||||||
subtitle: TextField(
|
subtitle: TextField(
|
||||||
controller: firstNameController,
|
controller: firstNameController,
|
||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
|
@ -112,7 +114,7 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Last Name"),
|
title: const Text("Last Name"),
|
||||||
subtitle: Constants.ALLOW_ANY_LAST_NAME ||
|
subtitle: Constants.ALLOW_ANY_LAST_NAME ||
|
||||||
settings.hasNoUsers
|
settings.hasNoUsers
|
||||||
? TextField(
|
? TextField(
|
||||||
|
@ -131,10 +133,10 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
||||||
LastNames.getCurrentNames(),
|
LastNames.getCurrentNames(),
|
||||||
)),
|
)),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Password"),
|
title: const Text("Password"),
|
||||||
subtitle: TextField(
|
subtitle: TextField(
|
||||||
controller: password,
|
controller: password,
|
||||||
decoration: InputDecoration(
|
decoration: const InputDecoration(
|
||||||
hintText: "*******",
|
hintText: "*******",
|
||||||
),
|
),
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
|
@ -145,10 +147,10 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Password Confirmation"),
|
title: const Text("Password Confirmation"),
|
||||||
subtitle: TextField(
|
subtitle: TextField(
|
||||||
controller: confirm,
|
controller: confirm,
|
||||||
decoration: InputDecoration(
|
decoration: const InputDecoration(
|
||||||
hintText: "*******",
|
hintText: "*******",
|
||||||
),
|
),
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
|
@ -160,21 +162,21 @@ class RegisterAccountState extends State<RegisterAccountPage> {
|
||||||
),
|
),
|
||||||
passwordMatches ||
|
passwordMatches ||
|
||||||
password.text == "" && confirm.text == ""
|
password.text == "" && confirm.text == ""
|
||||||
? Divider(
|
? const Divider(
|
||||||
thickness: 2,
|
thickness: 2,
|
||||||
)
|
)
|
||||||
: ListTile(
|
: const ListTile(
|
||||||
title: Text("Passwords do not match"),
|
title: Text("Passwords do not match"),
|
||||||
tileColor: Constants.TITLEBAR_COLOR,
|
tileColor: Constants.TITLEBAR_COLOR,
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Email Address"),
|
title: const Text("Email Address"),
|
||||||
subtitle: TextField(
|
subtitle: TextField(
|
||||||
onChanged: (V) {
|
onChanged: (V) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
controller: email,
|
controller: email,
|
||||||
decoration: InputDecoration(
|
decoration: const InputDecoration(
|
||||||
hintText:
|
hintText:
|
||||||
"Your email address. It is not used by zontreck.com, but if needed, can be used to reach you"),
|
"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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ enum InventoryFolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CreateInventoryPopup extends StatefulWidget {
|
class CreateInventoryPopup extends StatefulWidget {
|
||||||
|
const CreateInventoryPopup({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => CreateInventoryState();
|
State<StatefulWidget> createState() => CreateInventoryState();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +72,7 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
|
||||||
setState(() {
|
setState(() {
|
||||||
status = "Enabling user account";
|
status = "Enabling user account";
|
||||||
});
|
});
|
||||||
await Future.delayed(Duration(milliseconds: 500));
|
await Future.delayed(const Duration(milliseconds: 500));
|
||||||
|
|
||||||
Settings settings = Settings();
|
Settings settings = Settings();
|
||||||
C2SActivateUserPacket activate =
|
C2SActivateUserPacket activate =
|
||||||
|
@ -83,11 +85,11 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await Future.delayed(Duration(seconds: 1));
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
"Inventory successfully created. Your account is now active")));
|
"Inventory successfully created. Your account is now active")));
|
||||||
}
|
}
|
||||||
|
@ -95,7 +97,7 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
|
||||||
bool processing = false;
|
bool processing = false;
|
||||||
Future<void> startProcessing() async {
|
Future<void> startProcessing() async {
|
||||||
total = InventoryFolder.values.length;
|
total = InventoryFolder.values.length;
|
||||||
await Future.delayed(Duration(seconds: 5));
|
await Future.delayed(const Duration(seconds: 5));
|
||||||
|
|
||||||
UUID rootFolder = UUID.generate(4);
|
UUID rootFolder = UUID.generate(4);
|
||||||
|
|
||||||
|
@ -130,8 +132,8 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
|
||||||
client: Constants.CLIENTPSK);
|
client: Constants.CLIENTPSK);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
status = ("Creating Inventory Folder: ${name}");
|
status = ("Creating Inventory Folder: $name");
|
||||||
if (Constants.DEBUG) print("Creating Inventory Folder: ${name}");
|
if (Constants.DEBUG) print("Creating Inventory Folder: $name");
|
||||||
});
|
});
|
||||||
|
|
||||||
var reply = await settings.sendPacketToEndpoint(
|
var reply = await settings.sendPacketToEndpoint(
|
||||||
|
@ -143,16 +145,17 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
|
||||||
context: context,
|
context: context,
|
||||||
builder: (V) {
|
builder: (V) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text("FATAL ERROR"),
|
title: const Text("FATAL ERROR"),
|
||||||
content: Text(
|
content: Text(
|
||||||
"For an unknown reason, we failed to create the inventory folders. Some may have been created, but there was an error while processing: ${makeFolder.encodeSafe()}"),
|
"For an unknown reason, we failed to create the inventory folders. Some may have been created, but there was an error while processing: ${makeFolder.encodeSafe()}"),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
status = ("Created Inventory Folder : ${name}");
|
status = ("Created Inventory Folder : $name");
|
||||||
if (Constants.DEBUG) print("Created Inventory Folder: ${name}");
|
if (Constants.DEBUG) print("Created Inventory Folder: $name");
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
value++;
|
value++;
|
||||||
|
|
||||||
|
@ -161,23 +164,23 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer.periodic(Duration(milliseconds: 500), createFolder);
|
Timer.periodic(const Duration(milliseconds: 500), createFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
icon: Icon(Icons.folder_copy),
|
icon: const Icon(Icons.folder_copy),
|
||||||
title: Text("Please Wait... Activating Account"),
|
title: const Text("Please Wait... Activating Account"),
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: 75,
|
height: 75,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Text("Creating necessary Inventory Folders"),
|
const Text("Creating necessary Inventory Folders"),
|
||||||
Text(
|
Text(
|
||||||
status,
|
status,
|
||||||
),
|
),
|
||||||
Divider(),
|
const Divider(),
|
||||||
LinearProgressIndicator(
|
LinearProgressIndicator(
|
||||||
value: getProgress(),
|
value: getProgress(),
|
||||||
color: Constants.PORTFOLIO_CARD_COLOR,
|
color: Constants.PORTFOLIO_CARD_COLOR,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue