Small fixes

This commit is contained in:
zontreck 2024-05-17 17:40:04 -07:00
parent a54d0e4c0f
commit 043b06dedc
8 changed files with 2678 additions and 93 deletions

View file

@ -47,6 +47,8 @@ enum InventoryFolder {
}
class CreateInventoryPopup extends StatefulWidget {
const CreateInventoryPopup({super.key});
@override
State<StatefulWidget> createState() => CreateInventoryState();
}
@ -70,7 +72,7 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
setState(() {
status = "Enabling user account";
});
await Future.delayed(Duration(milliseconds: 500));
await Future.delayed(const Duration(milliseconds: 500));
Settings settings = Settings();
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);
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text(
"Inventory successfully created. Your account is now active")));
}
@ -95,7 +97,7 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
bool processing = false;
Future<void> startProcessing() async {
total = InventoryFolder.values.length;
await Future.delayed(Duration(seconds: 5));
await Future.delayed(const Duration(seconds: 5));
UUID rootFolder = UUID.generate(4);
@ -130,8 +132,8 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
client: Constants.CLIENTPSK);
setState(() {
status = ("Creating Inventory Folder: ${name}");
if (Constants.DEBUG) print("Creating Inventory Folder: ${name}");
status = ("Creating Inventory Folder: $name");
if (Constants.DEBUG) print("Creating Inventory Folder: $name");
});
var reply = await settings.sendPacketToEndpoint(
@ -143,16 +145,17 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
context: context,
builder: (V) {
return AlertDialog(
title: Text("FATAL ERROR"),
title: const Text("FATAL ERROR"),
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()}"),
);
});
} else
} else {
setState(() {
status = ("Created Inventory Folder : ${name}");
if (Constants.DEBUG) print("Created Inventory Folder: ${name}");
status = ("Created Inventory Folder : $name");
if (Constants.DEBUG) print("Created Inventory Folder: $name");
});
}
value++;
@ -161,23 +164,23 @@ class CreateInventoryState extends State<CreateInventoryPopup> {
});
}
Timer.periodic(Duration(milliseconds: 500), createFolder);
Timer.periodic(const Duration(milliseconds: 500), createFolder);
}
@override
Widget build(BuildContext context) {
return AlertDialog(
icon: Icon(Icons.folder_copy),
title: Text("Please Wait... Activating Account"),
icon: const Icon(Icons.folder_copy),
title: const Text("Please Wait... Activating Account"),
content: SizedBox(
height: 75,
child: Column(
children: [
Text("Creating necessary Inventory Folders"),
const Text("Creating necessary Inventory Folders"),
Text(
status,
),
Divider(),
const Divider(),
LinearProgressIndicator(
value: getProgress(),
color: Constants.PORTFOLIO_CARD_COLOR,