Ultima version para Google Play, cambios en politicas y colores. Nuevo aviso legal
This commit is contained in:
@ -20,12 +20,12 @@ if (localPropertiesFile.exists()) {
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
flutterVersionCode = '2'
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
flutterVersionName = '1.1'
|
||||
}
|
||||
|
||||
android {
|
||||
@ -67,8 +67,8 @@ android {
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
versionCode 8
|
||||
versionName "2.1"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,4 +28,76 @@ class DataService {
|
||||
throw Exception('Error al obtener datos');
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> obtenerFechaComunicacionEmbalses() async {
|
||||
final response = await http
|
||||
.get(Uri.parse('https://crcivan.asociacionador.es/contenedores.html'));
|
||||
if (response.statusCode == 200) {
|
||||
final document = htmlParser.parse(response.body);
|
||||
final dateElement =
|
||||
document.querySelector('span[style="font-size: 12pt;"]');
|
||||
final communicationDate = dateElement != null
|
||||
? dateElement.text.replaceAll(':', '').trim()
|
||||
: 'Fecha no encontrada';
|
||||
return communicationDate;
|
||||
} else {
|
||||
throw Exception('Error al obtener la fecha de comunicación');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<Map<String, dynamic>> obtenerDatosSecciones() async {
|
||||
final response = await http.get(Uri.parse('https://crcivan.asociacionador.es/secciones.html'));
|
||||
if (response.statusCode == 200) {
|
||||
final document = htmlParser.parse(response.body);
|
||||
final rows = document.querySelectorAll('table[style="height: 1202px; font-size: 13px;"] tbody tr');
|
||||
List<Map<String, dynamic>> seccionesData = [];
|
||||
String? currentSection;
|
||||
String? currentGuardInfo;
|
||||
List<Map<String, String>> currentSectionData = [];
|
||||
|
||||
// Extraer la fecha de la comunicación
|
||||
final dateRegex = RegExp(r'\d{2}/\d{2}/\d{4}');
|
||||
final dateMatch = dateRegex.firstMatch(document.body!.text);
|
||||
final communicationDate = dateMatch != null ? dateMatch.group(0) : 'Fecha no encontrada';
|
||||
|
||||
for (var row in rows) {
|
||||
var cells = row.querySelectorAll('td');
|
||||
if (cells.length == 2) {
|
||||
var sectionElement = cells[1].querySelector('strong');
|
||||
if (sectionElement != null && sectionElement.text.contains('SECCIÓN')) {
|
||||
if (currentSection != null) {
|
||||
seccionesData.add({
|
||||
'section': currentSection,
|
||||
'guardInfo': currentGuardInfo,
|
||||
'data': currentSectionData,
|
||||
});
|
||||
}
|
||||
currentSection = sectionElement.text.trim();
|
||||
currentGuardInfo = cells[1].querySelector('span[style="text-decoration: underline;"]')?.text.trim();
|
||||
currentSectionData = [];
|
||||
} else {
|
||||
currentSectionData.add({
|
||||
'date': cells[0].text.trim(),
|
||||
'location': cells[1].text.trim(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentSection != null) {
|
||||
seccionesData.add({
|
||||
'section': currentSection,
|
||||
'guardInfo': currentGuardInfo,
|
||||
'data': currentSectionData,
|
||||
});
|
||||
}
|
||||
return {
|
||||
'communicationDate': communicationDate,
|
||||
'seccionesData': seccionesData,
|
||||
};
|
||||
} else {
|
||||
throw Exception('Error al cargar los datos de secciones');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,14 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:crcivan/pages/utils.dart'; // Importar la función global
|
||||
|
||||
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const CustomAppBar({Key? key}) : super(key: key);
|
||||
|
||||
double _getIconSize(BuildContext context) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
return screenWidth > 600 ? 40.0 : 32.0;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double iconSize = _getIconSize(context);
|
||||
|
||||
return AppBar(
|
||||
title: const Text(''),
|
||||
centerTitle: true,
|
||||
backgroundColor: Color.fromARGB(255, 78, 169, 6),
|
||||
backgroundColor: const Color.fromARGB(255, 78, 169, 6),
|
||||
iconTheme: IconThemeData(
|
||||
color: Colors.white, // Cambia este color al que desees
|
||||
size: iconSize, // Ajustar el tamaño del icono
|
||||
),
|
||||
flexibleSpace: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
@ -16,8 +28,8 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
padding: const EdgeInsets.only(top: 10.0),
|
||||
child: Image.asset(
|
||||
'assets/logo-civan.png',
|
||||
height: 200,
|
||||
width: 200,
|
||||
height: getResponsiveFontSize(context, 200.0), // Ajustar la altura de la imagen
|
||||
width: getResponsiveFontSize(context, 200.0), // Ajustar el ancho de la imagen
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -26,5 +38,5 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight); // Tamaño fijo para el AppBar
|
||||
}
|
||||
|
||||
@ -1,43 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:crcivan/pages/utils.dart'; // Importar la función global
|
||||
|
||||
class CustomBottomBar extends StatelessWidget {
|
||||
const CustomBottomBar({Key? key}) : super(key: key);
|
||||
|
||||
Future<void> _launchURL(String url) async {
|
||||
try {
|
||||
await launch(url);
|
||||
} catch (e) {
|
||||
// Captura de la excepción
|
||||
print('An error occurred: $e');
|
||||
try {
|
||||
await launch(url);
|
||||
} catch (e) {
|
||||
// Captura de la excepción
|
||||
print('An error occurred: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BottomNavigationBar(
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.call),
|
||||
label: 'Llamar',
|
||||
return BottomAppBar(
|
||||
child: Container(
|
||||
height: getResponsiveFontSize(context, 80.0), // Ajustar la altura del BottomAppBar
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.call),
|
||||
color: Colors.blue,
|
||||
iconSize: getResponsiveFontSize(context, 24.0), // Ajustar el tamaño del icono
|
||||
onPressed: () {
|
||||
_launchURL('tel:+348766361379');
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Avenida Maella, 35 50700 Caspe (Zaragoza)',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: getResponsiveFontSize(context, 14.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.email),
|
||||
color: Colors.blue,
|
||||
iconSize: getResponsiveFontSize(context, 24.0), // Ajustar el tamaño del icono
|
||||
onPressed: () {
|
||||
_launchURL('mailto:civan@crcivan.com');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.email),
|
||||
label: 'Correo',
|
||||
),
|
||||
],
|
||||
selectedItemColor: Colors.blue,
|
||||
unselectedItemColor: Colors.blue,
|
||||
backgroundColor: const Color.fromARGB(255, 255, 255, 255),
|
||||
currentIndex: 0,
|
||||
onTap: (int index) {
|
||||
if (index == 0) {
|
||||
_launchURL('tel:+348766361379');
|
||||
} else if (index == 1) {
|
||||
_launchURL('mailto:civan@crcivan.com');
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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(),
|
||||
|
||||
@ -1,23 +1,103 @@
|
||||
import 'package:crcivan/BloC/contenedores_event.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:crcivan/bars/app_bar';
|
||||
import 'package:crcivan/bars/bottom_bar';
|
||||
import 'package:crcivan/BloC/contenedores_event.dart';
|
||||
import 'package:crcivan/pages/noticias';
|
||||
import 'package:crcivan/pages/pregon';
|
||||
import 'package:crcivan/pages/embalses';
|
||||
import 'package:crcivan/pages/secciones';
|
||||
import 'package:crcivan/widgets/background_widget.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:crcivan/pages/utils.dart'; // Importar la función global
|
||||
|
||||
class MyHomePage extends StatelessWidget {
|
||||
class MyHomePage extends StatefulWidget {
|
||||
const MyHomePage({super.key, required this.title});
|
||||
final String title;
|
||||
|
||||
@override
|
||||
_MyHomePageState createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
verificarPrimerInicio();
|
||||
}
|
||||
|
||||
Future<void> verificarPrimerInicio() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
bool yaMostrado = prefs.getBool('aviso_mostrado') ?? false;
|
||||
|
||||
if (!yaMostrado) {
|
||||
Future.delayed(Duration.zero, () => mostrarAvisoLegal());
|
||||
await prefs.setBool('aviso_mostrado', true);
|
||||
}
|
||||
}
|
||||
|
||||
void mostrarAvisoLegal() {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text("Aviso Legal"),
|
||||
content: SingleChildScrollView(
|
||||
child: Text(
|
||||
"1. Relación con Entidades Oficiales:\n"
|
||||
"Esta aplicación no está afiliada, respaldada ni oficialmente conectada con ninguna entidad gubernamental, institución o autoridad pública. "
|
||||
"CR-Civán no representa a ninguna organización oficial ni gubernamental.\n\n"
|
||||
"2. Datos de los Embalses:\n"
|
||||
"Los datos sobre el estado de los embalses son proporcionados exclusivamente por la Confederación Hidrográfica del Ebro (CHE), "
|
||||
"los cuales están a disposición de todo el mundo en (https://www.saihebro.com/homepage/estado-cuenca-ebro). "
|
||||
"Los datos mostrados en esta aplicación no han sido alterados ni modificados; simplemente se presentan para mayor comodidad del usuario. "
|
||||
"CR-Civán no representa ni tiene relación directa con la Confederación Hidrográfica del Ebro y, por lo tanto, no se hace responsable de la exactitud o veracidad de los datos proporcionados por la CHE.\n\n"
|
||||
"3. Información Meteorológica:\n"
|
||||
"La información meteorológica se proporciona a través de un enlace a la página oficial de la Agencia Estatal de Meteorología (AEMET), "
|
||||
"disponible en (https://www.aemet.es). CR-Civán no se hace responsable de la exactitud de los datos proporcionados por AEMET, "
|
||||
"ya que la aplicación solo redirige al usuario a su página oficial sin modificar ni representar la información de manera directa. "
|
||||
"La información meteorológica se muestra en un navegador externo y no dentro de la propia aplicación, por lo que CR-Civán no se responsabiliza del contenido mostrado en dicho enlace.\n\n"
|
||||
"4. Responsabilidad sobre los Datos:\n"
|
||||
"Todos los datos presentados en esta aplicación provienen de fuentes externas y no han sido alterados ni modificados. "
|
||||
"CR-Civán no asume ninguna responsabilidad sobre la veracidad o exactitud de los mismos.",
|
||||
style: TextStyle(
|
||||
fontSize: getResponsiveFontSize(
|
||||
context, 16)), // Ajustar el tamaño del texto aquí
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
Color.fromARGB(255, 255, 255, 255), // Color del botón
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text("LO ENTIENDO"),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
double getResponsiveFontSize(BuildContext context, double baseFontSize) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
// Ajustar el tamaño del texto en función del ancho de la pantalla
|
||||
if (screenWidth > 600) {
|
||||
return baseFontSize * 1.5; // Aumentar el tamaño del texto en tablets
|
||||
} else {
|
||||
return baseFontSize; // Mantener el tamaño del texto en teléfonos
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: const CustomAppBar(), //Barra superior personalizada
|
||||
appBar: const CustomAppBar(),
|
||||
body: BackgroundWidget(
|
||||
//Widget fondo del fichero BackgroundWidget
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -31,22 +111,21 @@ class MyHomePage extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
//Botón Noticias
|
||||
width: 300.0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20.0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromARGB(255, 78, 169, 6),
|
||||
color: const Color.fromARGB(255, 240, 35, 35),
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
),
|
||||
child: const Text(
|
||||
'Noticias',
|
||||
child: Text(
|
||||
'Avisos',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 32.0,
|
||||
fontSize: getResponsiveFontSize(context, 32.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@ -62,22 +141,21 @@ class MyHomePage extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
//Botón Pregón
|
||||
width: 300.0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20.0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromARGB(255, 78, 169, 6),
|
||||
color: const Color.fromARGB(255, 230, 226, 0),
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'Pregón',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 32.0,
|
||||
fontSize: getResponsiveFontSize(context, 32.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@ -94,22 +172,21 @@ class MyHomePage extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
//Botón Embalses
|
||||
width: 300.0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20.0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromARGB(255, 78, 169, 6),
|
||||
color: const Color.fromARGB(255, 6, 71, 169),
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'Embalses',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 32.0,
|
||||
fontSize: getResponsiveFontSize(context, 32.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@ -119,25 +196,55 @@ class MyHomePage extends StatelessWidget {
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
launchAemetURL(); //Función a link externo
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const SeccionesPage()),
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
//Botón Tiempo
|
||||
width: 300.0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20.0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromARGB(255, 78, 169, 6),
|
||||
color: const Color.fromARGB(255, 97, 97, 97),
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
),
|
||||
child: const Text(
|
||||
'Tiempo',
|
||||
child: Text(
|
||||
'Secciones',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 32.0,
|
||||
fontSize: getResponsiveFontSize(context, 32.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
launchAemetURL();
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 300.0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20.0),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromARGB(255, 255, 255, 255),
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
),
|
||||
child: Text(
|
||||
'Tiempo',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Color.fromARGB(255, 78, 169, 6),
|
||||
fontSize: getResponsiveFontSize(context, 32.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@ -150,12 +257,22 @@ class MyHomePage extends StatelessWidget {
|
||||
onTap: () {
|
||||
launchPrivacyPolicyURL();
|
||||
},
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'Lee nuestras políticas de privacidad',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
decoration: TextDecoration.underline,
|
||||
fontSize: 16.0,
|
||||
fontSize: getResponsiveFontSize(context, 16.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
ElevatedButton(
|
||||
onPressed: mostrarAvisoLegal,
|
||||
child: Text(
|
||||
'Aviso Legal',
|
||||
style: TextStyle(
|
||||
fontSize: getResponsiveFontSize(context, 16.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -163,8 +280,7 @@ class MyHomePage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar:
|
||||
const CustomBottomBar(), //Barra inferior personalizada
|
||||
bottomNavigationBar: const CustomBottomBar(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:crcivan/bars/app_bar';
|
||||
import 'package:crcivan/bars/bottom_bar';
|
||||
import 'package:html/parser.dart' as htmlParser;
|
||||
import 'package:crcivan/widgets/background_widget.dart';
|
||||
import 'package:crcivan/pages/utils.dart';
|
||||
|
||||
class NoticiasPage extends StatefulWidget {
|
||||
const NoticiasPage({Key? key}) : super(key: key);
|
||||
@ -90,17 +91,21 @@ class _NoticiasPageState extends State<NoticiasPage> {
|
||||
child: ExpansionTile(
|
||||
title: Text(
|
||||
titulo!,
|
||||
style: TextStyle(fontWeight: FontWeight.bold), // Establecer negrita para el título
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, // Establecer negrita para el título
|
||||
fontSize: getResponsiveFontSize(context, 18.0),
|
||||
),
|
||||
),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
contenido!,
|
||||
style: TextStyle(fontSize: 16.0), // Mantener el texto del contenido en estilo regular
|
||||
style: TextStyle(
|
||||
fontSize: getResponsiveFontSize(context, 16.0), // Mantener el texto del contenido en estilo regular
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -5,7 +5,7 @@ import 'package:html/dom.dart' as htmlDom;
|
||||
import 'package:crcivan/bars/app_bar';
|
||||
import 'package:crcivan/bars/bottom_bar';
|
||||
import 'package:crcivan/widgets/background_widget.dart';
|
||||
|
||||
import 'package:crcivan/pages/utils.dart';
|
||||
|
||||
class Pregon extends StatefulWidget {
|
||||
const Pregon({Key? key}) : super(key: key);
|
||||
@ -82,7 +82,8 @@ class _PregonState extends State<Pregon> {
|
||||
datos[index],
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: hasMes ? Color.fromARGB(255, 0, 0, 0) : Color.fromARGB(255, 0, 0, 0), fontSize : 22.0
|
||||
color: hasMes ? Color.fromARGB(255, 0, 0, 0) : Color.fromARGB(255, 0, 0, 0),
|
||||
fontSize: getResponsiveFontSize(context, 22.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
133
lib/pages/secciones
Normal file
133
lib/pages/secciones
Normal file
@ -0,0 +1,133 @@
|
||||
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:html/parser.dart' as htmlParser;
|
||||
import 'package:html/dom.dart' as htmlDom;
|
||||
import 'package:crcivan/bars/app_bar';
|
||||
import 'package:crcivan/bars/bottom_bar';
|
||||
import 'package:crcivan/widgets/background_widget.dart';
|
||||
import 'package:crcivan/pages/utils.dart';
|
||||
|
||||
class SeccionesPage extends StatefulWidget {
|
||||
const SeccionesPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SeccionesPageState createState() => _SeccionesPageState();
|
||||
}
|
||||
|
||||
class _SeccionesPageState extends State<SeccionesPage> {
|
||||
final DataService dataService = DataService();
|
||||
String communicationDate = '';
|
||||
List<Map<String, dynamic>> seccionesData = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
obtenerDatosSecciones();
|
||||
}
|
||||
|
||||
Future<void> obtenerDatosSecciones() async {
|
||||
try {
|
||||
final data = await dataService.obtenerDatosSecciones();
|
||||
setState(() {
|
||||
communicationDate = data['communicationDate'];
|
||||
seccionesData = data['seccionesData'];
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: const CustomAppBar(),
|
||||
body: BackgroundWidget(
|
||||
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: seccionesData.length,
|
||||
itemBuilder: (context, index) {
|
||||
final seccion = seccionesData[index];
|
||||
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(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'ÚLTIMO RIEGO',
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8.0),
|
||||
Text(
|
||||
seccion['section'],
|
||||
style: TextStyle(
|
||||
fontSize: getResponsiveFontSize(context, 20.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (seccion['guardInfo'] != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Text(
|
||||
seccion['guardInfo'],
|
||||
style: TextStyle(
|
||||
fontSize: getResponsiveFontSize(context, 20.0),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
),
|
||||
...seccion['data'].map<Widget>((data) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
|
||||
child: Text(
|
||||
'${data['date']}: ${data['location']}',
|
||||
style: TextStyle(
|
||||
fontSize: getResponsiveFontSize(context, 16.0),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: const CustomBottomBar(),
|
||||
);
|
||||
}
|
||||
}
|
||||
11
lib/pages/utils.dart
Normal file
11
lib/pages/utils.dart
Normal file
@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
double getResponsiveFontSize(BuildContext context, double baseFontSize) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
// Ajustar el tamaño del texto en función del ancho de la pantalla
|
||||
if (screenWidth > 600) {
|
||||
return baseFontSize * 1.6; // Aumentar el tamaño del texto en tablets
|
||||
} else {
|
||||
return baseFontSize; // Mantener el tamaño del texto en teléfonos
|
||||
}
|
||||
}
|
||||
@ -5,8 +5,10 @@
|
||||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import shared_preferences_foundation
|
||||
import url_launcher_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
}
|
||||
|
||||
104
pubspec.lock
104
pubspec.lock
@ -129,6 +129,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@ -296,6 +304,30 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -304,6 +336,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.2"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.6"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -328,6 +368,62 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.2"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: shared_preferences
|
||||
sha256: "846849e3e9b68f3ef4b60c60cf4b3e02e9321bc7f4d8c4692cf87ffa82fc8a3a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.2"
|
||||
shared_preferences_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_android
|
||||
sha256: a768fc8ede5f0c8e6150476e14f38e2417c0864ca36bb4582be8e21925a03c22
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.6"
|
||||
shared_preferences_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_foundation
|
||||
sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.4"
|
||||
shared_preferences_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_linux
|
||||
sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
shared_preferences_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_platform_interface
|
||||
sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
shared_preferences_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_web
|
||||
sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.3"
|
||||
shared_preferences_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_windows
|
||||
sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@ -501,6 +597,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -33,6 +33,7 @@ dependencies:
|
||||
url_launcher: ^6.0.12
|
||||
flutter_bloc: ^8.1.5
|
||||
flutter_svg: ^2.0.10+1
|
||||
shared_preferences: ^2.2.0
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user