Ultima version para Google Play, cambios en politicas y colores. Nuevo aviso legal

This commit is contained in:
2025-03-12 09:54:39 +01:00
parent 0d61ca6d01
commit 6c062682f6
13 changed files with 624 additions and 125 deletions

View File

@ -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(),
);
}
}