1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 15:06:06 +00:00

Ajustements

This commit is contained in:
Yan Maniez 2020-02-22 00:59:48 +01:00
parent 0d81ea6799
commit 033f7ec94a
3 changed files with 74 additions and 41 deletions

View file

@ -40,8 +40,11 @@ Future<Database> getDatabaseInstance() async {
Future<Item> getItemWithId(String id) async {
print("getItemWithId " + id);
final db = await database;
var response = await db
.query("Items", where: "Id = ? OR RootId = ?", whereArgs: [id, id]);
var response = await db.query(
"Items",
where: "Id = ? OR RootId = ?",
whereArgs: [id, id]
);
if (response.isEmpty) {
print("Id not found");
}
@ -54,16 +57,18 @@ Future<Item> loadChildrenItems(Item item) async {
String itemType =
item.ItemType.substring(0, item.ItemType.length - 1);
String family = "";
if (item is MonsterItems) {
family = (item as MonsterItems)?.Family ?? "";
if (item is FilteredItems) {
family = (item as FilteredItems)?.Family ?? "";
}
final db = await database;
var response = await db
.query("Items", where: "ItemType = ? AND Family = ?",
var response = await db.query(
"Items",
where: "ItemType = ? AND Family = ?",
whereArgs: [itemType, family],
orderBy: "NormalizedName");
orderBy: "NormalizedName"
);
if (response.isEmpty) {
print("Id not found");
print("Children not found");
}
item.Children = response.isNotEmpty
? itemsFromMapList(response)