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()); await Future.wait(noticiasPorTitulo.values.expand((element) => element).toList());
setState(() {}); setState(() {});
@ -58,19 +57,16 @@ class _NoticiasPageState extends State<NoticiasPage> {
for (var element in paragraphAndLists) { for (var element in paragraphAndLists) {
if (element.localName == 'p') { if (element.localName == 'p') {
// Guardar el contenido del párrafo actual
if (currentParagraphContent.isNotEmpty) { if (currentParagraphContent.isNotEmpty) {
content += currentParagraphContent + '\n'; content += currentParagraphContent + '\n';
currentParagraphContent = ''; currentParagraphContent = '';
} }
currentParagraphContent += element.text.trim() + '\n'; currentParagraphContent += element.text.trim() + '\n';
} else if (element.localName == 'ul') { } else if (element.localName == 'ul') {
// Si hay un párrafo antes de la lista, agregarlo al contenido
if (currentParagraphContent.isNotEmpty) { if (currentParagraphContent.isNotEmpty) {
content += currentParagraphContent + '\n'; content += currentParagraphContent + '\n';
currentParagraphContent = ''; currentParagraphContent = '';
} }
// Agregar la lista al contenido
var listItems = element.querySelectorAll('li'); var listItems = element.querySelectorAll('li');
for (var listItem in listItems) { for (var listItem in listItems) {
content += '- ${listItem.text.trim()}\n'; 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) { if (currentParagraphContent.isNotEmpty) {
content += currentParagraphContent + '\n'; content += currentParagraphContent + '\n';
} }

View File

@ -79,7 +79,7 @@ Widget build(BuildContext context) {
children: [ children: [
if (hasMes) if (hasMes)
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0), // Add padding to the divider padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider(color: Colors.green, thickness: 3.0), // Divider antes del párrafo child: Divider(color: Colors.green, thickness: 3.0), // Divider antes del párrafo
), ),
hasText hasText
@ -97,7 +97,7 @@ Widget build(BuildContext context) {
: SizedBox.shrink(), : SizedBox.shrink(),
if (hasMes) if (hasMes)
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 100.0), // Add padding to the divider padding: const EdgeInsets.symmetric(horizontal: 100.0),
child: Divider(color: Colors.green, thickness: 1.0), // Divider después del párrafo child: Divider(color: Colors.green, thickness: 1.0), // Divider después del párrafo
), ),
], ],