Aplicacion terminada v2

This commit is contained in:
2024-05-20 14:05:58 +02:00
parent 5f4dc6fc01
commit 560a262521
2 changed files with 2 additions and 7 deletions

View File

@ -38,7 +38,6 @@ class _NoticiasPageState extends State<NoticiasPage> {
}
}
// Esperar todas las promesas para que se resuelvan
await Future.wait(noticiasPorTitulo.values.expand((element) => element).toList());
setState(() {});
@ -58,19 +57,16 @@ class _NoticiasPageState extends State<NoticiasPage> {
for (var element in paragraphAndLists) {
if (element.localName == 'p') {
// Guardar el contenido del párrafo actual
if (currentParagraphContent.isNotEmpty) {
content += currentParagraphContent + '\n';
currentParagraphContent = '';
}
currentParagraphContent += element.text.trim() + '\n';
} else if (element.localName == 'ul') {
// Si hay un párrafo antes de la lista, agregarlo al contenido
if (currentParagraphContent.isNotEmpty) {
content += currentParagraphContent + '\n';
currentParagraphContent = '';
}
// Agregar la lista al contenido
var listItems = element.querySelectorAll('li');
for (var listItem in listItems) {
content += '- ${listItem.text.trim()}\n';
@ -78,7 +74,6 @@ class _NoticiasPageState extends State<NoticiasPage> {
}
}
// Agregar el último párrafo si no hay lista después
if (currentParagraphContent.isNotEmpty) {
content += currentParagraphContent + '\n';
}