get article in detail synchrone..
This commit is contained in:
parent
a1836ca76f
commit
8762ecaf11
@ -1 +1 @@
|
|||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2022-10-20 16:40:20.714473","version":"3.0.3"}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2022-10-23 11:11:04.666376","version":"3.0.3"}
|
||||||
@ -222,18 +222,87 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
try {
|
try {
|
||||||
bool isOnline = await hasNetwork();
|
bool isOnline = await hasNetwork();
|
||||||
if(sectionDTO == null || articleDTO == null) {
|
if(sectionDTO == null || articleDTO == null) {
|
||||||
await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.sections, articleId).then((value) async {
|
print("ARTCILE DTO GET ARTICLE");
|
||||||
setState(() {
|
|
||||||
if(value.isNotEmpty) {
|
List<Map<String, dynamic>> sectionTest = await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.sections, articleId);
|
||||||
sectionDTO = DatabaseHelper.instance.getSectionFromDB(value.first);
|
if(sectionTest.isNotEmpty) {
|
||||||
|
sectionDTO = DatabaseHelper.instance.getSectionFromDB(sectionTest.first);
|
||||||
|
print(sectionDTO!.data);
|
||||||
} else {
|
} else {
|
||||||
print("EMPTY SECTION");
|
print("EMPTY SECTION");
|
||||||
}
|
}
|
||||||
if(sectionDTO!.type == SectionType.Article) {
|
if(sectionDTO!.type == SectionType.Article) {
|
||||||
|
print("set article __ !!");
|
||||||
|
print(sectionDTO!.data!);
|
||||||
articleDTO = ArticleDTO.fromJson(jsonDecode(sectionDTO!.data!));
|
articleDTO = ArticleDTO.fromJson(jsonDecode(sectionDTO!.data!));
|
||||||
|
print(articleDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sectionDTO!.imageId != null) {
|
||||||
|
List<Map<String, dynamic>> ressourceTest = await DatabaseHelper
|
||||||
|
.instance.queryWithColumnId(
|
||||||
|
DatabaseTableType.resources, sectionDTO!.imageId!);
|
||||||
|
if (ressourceTest.isNotEmpty) {
|
||||||
|
resourcesModel.add(DatabaseHelper.instance.getResourceFromDB(ressourceTest.first));
|
||||||
|
} else {
|
||||||
|
print("EMPTY resourcesModel - first");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(articleDTO!.images!.isNotEmpty) {
|
||||||
|
for (var image in articleDTO!.images!) {
|
||||||
|
if(image.resourceId != null) {
|
||||||
|
print("image.resourceId != nullimage.resourceId != nullimage.resourceId != null");
|
||||||
|
|
||||||
|
List<Map<String, dynamic>> ressourceArticle = await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.resources, image.resourceId!);
|
||||||
|
if(ressourceArticle.isNotEmpty) {
|
||||||
|
resourcesModel.add(DatabaseHelper.instance.getResourceFromDB(ressourceArticle.first));
|
||||||
|
} else {
|
||||||
|
print("EMPTY resourcesModel - second");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.resources, image.resourceId!).then((value) {
|
||||||
|
print(value);
|
||||||
|
if(value.isNotEmpty) {
|
||||||
|
resourcesModel.add(DatabaseHelper.instance.getResourceFromDB(value.first));
|
||||||
|
} else {
|
||||||
|
print("EMPTY resourcesModel - second");
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(mainResource == null && resourcesModel.isNotEmpty) {
|
||||||
|
mainResource = resourcesModel.first;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.resources, sectionDTO!.imageId!).then((value) {
|
||||||
|
if(value.isNotEmpty) {
|
||||||
|
resourcesModel.add(DatabaseHelper.instance.getResourceFromDB(value.first));
|
||||||
|
} else {
|
||||||
|
print("EMPTY resourcesModel - first");
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
//}
|
||||||
|
|
||||||
|
/*await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.sections, articleId).then((value) async {
|
||||||
|
setState(() {
|
||||||
|
if(value.isNotEmpty) {
|
||||||
|
sectionDTO = DatabaseHelper.instance.getSectionFromDB(value.first);
|
||||||
|
print(sectionDTO!.data);
|
||||||
|
} else {
|
||||||
|
print("EMPTY SECTION");
|
||||||
|
}
|
||||||
|
if(sectionDTO!.type == SectionType.Article) {
|
||||||
|
print("set article __ !!");
|
||||||
|
articleDTO = ArticleDTO.fromJson(jsonDecode(sectionDTO!.data!));
|
||||||
|
print(articleDTO);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(sectionDTO!.imageId != null) {
|
*/
|
||||||
|
/*if(sectionDTO!.imageId != null) {
|
||||||
await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.resources, sectionDTO!.imageId!).then((value) {
|
await DatabaseHelper.instance.queryWithColumnId(DatabaseTableType.resources, sectionDTO!.imageId!).then((value) {
|
||||||
if(value.isNotEmpty) {
|
if(value.isNotEmpty) {
|
||||||
resourcesModel.add(DatabaseHelper.instance.getResourceFromDB(value.first));
|
resourcesModel.add(DatabaseHelper.instance.getResourceFromDB(value.first));
|
||||||
@ -241,8 +310,8 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
print("EMPTY resourcesModel - first");
|
print("EMPTY resourcesModel - first");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
if(articleDTO!.images!.isNotEmpty) {
|
/*if(articleDTO!.images!.isNotEmpty) {
|
||||||
for (var image in articleDTO!.images!) {
|
for (var image in articleDTO!.images!) {
|
||||||
if(image.resourceId != null) {
|
if(image.resourceId != null) {
|
||||||
print("image.resourceId != nullimage.resourceId != nullimage.resourceId != null");
|
print("image.resourceId != nullimage.resourceId != nullimage.resourceId != null");
|
||||||
@ -255,13 +324,13 @@ class _ArticlePageState extends State<ArticlePage> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/*if(mainResource == null && resourcesModel.isNotEmpty) {
|
/*if(mainResource == null && resourcesModel.isNotEmpty) {
|
||||||
mainResource = resourcesModel.first;
|
mainResource = resourcesModel.first;
|
||||||
}*/
|
}*/
|
||||||
}
|
//}
|
||||||
});
|
//});
|
||||||
} else {
|
} else {
|
||||||
// TODO ONLINE
|
// TODO ONLINE
|
||||||
return null; // TODO return local list..
|
return null; // TODO return local list..
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user