Aplicacion terminada v2
This commit is contained in:
@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user