Ultima version para Google Play, cambios en politicas y colores. Nuevo aviso legal
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:crcivan/BloC/DataService.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:crcivan/BloC/DataService.dart';
|
||||
import 'package:html/parser.dart' as htmlParser;
|
||||
import 'package:crcivan/BloC/contenedores_event.dart';
|
||||
import 'package:html/dom.dart' as htmlDom;
|
||||
import 'package:crcivan/bars/app_bar';
|
||||
import 'package:crcivan/widgets/background_widget.dart';
|
||||
import 'package:crcivan/bars/bottom_bar';
|
||||
import 'package:crcivan/widgets/background_widget.dart';
|
||||
import 'package:crcivan/pages/utils.dart';
|
||||
|
||||
class EmbalsesPage extends StatefulWidget {
|
||||
const EmbalsesPage({Key? key}) : super(key: key);
|
||||
@ -16,6 +18,7 @@ class EmbalsesPage extends StatefulWidget {
|
||||
|
||||
class _EmbalsesPageState extends State<EmbalsesPage> {
|
||||
final DataService dataService = DataService();
|
||||
String communicationDate = '';
|
||||
List<Map<String, dynamic>> embalsesData = [];
|
||||
List<String> descripciones = ['Cota (m)', 'Volumen (Hm3)', 'Entrada (l/s)', 'Salida (l/s)'];
|
||||
|
||||
@ -23,6 +26,7 @@ class _EmbalsesPageState extends State<EmbalsesPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
obtenerDatos();
|
||||
obtenerFechaComunicacion();
|
||||
}
|
||||
|
||||
Future<void> obtenerDatos() async {
|
||||
@ -36,73 +40,97 @@ class _EmbalsesPageState extends State<EmbalsesPage> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> obtenerFechaComunicacion() async {
|
||||
try {
|
||||
final date = await dataService.obtenerFechaComunicacionEmbalses();
|
||||
setState(() {
|
||||
communicationDate = date;
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: const CustomAppBar(),
|
||||
body: BackgroundWidget(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView.builder(
|
||||
itemCount: embalsesData.length,
|
||||
itemBuilder: (context, index) {
|
||||
final embalseData = embalsesData[index];
|
||||
final nombreEmbalse = embalseData['nombre'];
|
||||
final listaElementos = embalseData['elementos'];
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
communicationDate,
|
||||
style: TextStyle(
|
||||
fontSize: getResponsiveFontSize(context, 18.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: embalsesData.length,
|
||||
itemBuilder: (context, index) {
|
||||
final embalseData = embalsesData[index];
|
||||
final nombreEmbalse = embalseData['nombre'];
|
||||
final listaElementos = embalseData['elementos'];
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.5),
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
nombreEmbalse!,
|
||||
style: const TextStyle(
|
||||
fontSize: 25.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.5),
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
Row(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: List.generate(
|
||||
listaElementos.length,
|
||||
(index) => Text(
|
||||
'${descripciones[index]}: ${listaElementos[index]}',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 20.0,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
nombreEmbalse!,
|
||||
style: TextStyle(
|
||||
fontSize: getResponsiveFontSize(context, 25.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: List.generate(
|
||||
listaElementos.length,
|
||||
(index) => Text(
|
||||
'${descripciones[index]}: ${listaElementos[index]}',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: getResponsiveFontSize(context, 20.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: const CustomBottomBar(),
|
||||
|
||||
Reference in New Issue
Block a user