Add a delay for disabling mods in bulk
This commit is contained in:
parent
b2a7493539
commit
3b7876532b
10 changed files with 57 additions and 39 deletions
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:servermanager/structs/discordHookHelper.dart';
|
||||
|
||||
import '../structs/mod.dart';
|
||||
import '../structs/settings.dart';
|
||||
|
@ -24,28 +23,31 @@ class ModManagerState extends State<ModManager> {
|
|||
backgroundColor: Color.fromARGB(255, 100, 0, 0),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
for (Mod M in settings.inst!.mods) {
|
||||
M.enabled = false;
|
||||
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
|
||||
settings.loggedInUser!
|
||||
.sendDiscordActionLog("${M.mod_name} was disabled");
|
||||
;
|
||||
}
|
||||
|
||||
setState(() {});
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
icon: Icon(Icons.swipe_down)),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
for (Mod M in settings.inst!.mods) {
|
||||
M.enabled = true;
|
||||
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
|
||||
settings.loggedInUser!
|
||||
.sendDiscordActionLog("${M.mod_name} was enabled");
|
||||
}
|
||||
|
||||
setState(() {});
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
icon: Icon(Icons.swipe_up))
|
||||
],
|
||||
|
@ -65,7 +67,7 @@ class ModManagerState extends State<ModManager> {
|
|||
settings.inst!.mods[end] = item;
|
||||
|
||||
settings.loggedInUser!.sendDiscordActionLog(
|
||||
"Reordered Mod List\n\n${item.mod_name} is now in load order ${end}");
|
||||
"Reordered Mod List\n\n${item.mod_name} is now in load order $end");
|
||||
} else if (oldIndex > newIndex) {
|
||||
//From bottom to top
|
||||
Mod item = settings.inst!.mods[oldIndex];
|
||||
|
@ -75,7 +77,7 @@ class ModManagerState extends State<ModManager> {
|
|||
settings.inst!.mods[newIndex] = item;
|
||||
|
||||
settings.loggedInUser!.sendDiscordActionLog(
|
||||
"Reordered Mod List\n\n${item.mod_name} is now in load order ${newIndex}");
|
||||
"Reordered Mod List\n\n${item.mod_name} is now in load order $newIndex");
|
||||
}
|
||||
setState(() {
|
||||
settings.Write();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue