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

@ -20,12 +20,12 @@ if (localPropertiesFile.exists()) {
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
flutterVersionCode = '1' flutterVersionCode = '2'
} }
def flutterVersionName = localProperties.getProperty('flutter.versionName') def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) { if (flutterVersionName == null) {
flutterVersionName = '1.0' flutterVersionName = '1.1'
} }
android { android {
@ -67,8 +67,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode 8
versionName flutterVersionName versionName "2.1"
} }
} }

View File

@ -28,4 +28,76 @@ class DataService {
throw Exception('Error al obtener datos'); 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');
}
}
}

View File

@ -1,14 +1,26 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:crcivan/pages/utils.dart'; // Importar la función global
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
const CustomAppBar({Key? key}) : super(key: key); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double iconSize = _getIconSize(context);
return AppBar( return AppBar(
title: const Text(''), title: const Text(''),
centerTitle: true, 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( flexibleSpace: Container(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Center(
@ -16,8 +28,8 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
padding: const EdgeInsets.only(top: 10.0), padding: const EdgeInsets.only(top: 10.0),
child: Image.asset( child: Image.asset(
'assets/logo-civan.png', 'assets/logo-civan.png',
height: 200, height: getResponsiveFontSize(context, 200.0), // Ajustar la altura de la imagen
width: 200, width: getResponsiveFontSize(context, 200.0), // Ajustar el ancho de la imagen
), ),
), ),
), ),
@ -26,5 +38,5 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
} }
@override @override
Size get preferredSize => const Size.fromHeight(kToolbarHeight); Size get preferredSize => const Size.fromHeight(kToolbarHeight); // Tamaño fijo para el AppBar
} }

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:crcivan/pages/utils.dart'; // Importar la función global
class CustomBottomBar extends StatelessWidget { class CustomBottomBar extends StatelessWidget {
const CustomBottomBar({Key? key}) : super(key: key); const CustomBottomBar({Key? key}) : super(key: key);
@ -15,29 +16,42 @@ class CustomBottomBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BottomNavigationBar( return BottomAppBar(
items: const [ child: Container(
BottomNavigationBarItem( height: getResponsiveFontSize(context, 80.0), // Ajustar la altura del BottomAppBar
icon: Icon(Icons.call), child: Row(
label: 'Llamar', 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');
},
), ),
BottomNavigationBarItem( Expanded(
icon: Icon(Icons.email), child: Text(
label: 'Correo', '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');
},
), ),
], ],
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');
}
},
); );
} }
} }

View File

@ -1,11 +1,13 @@
import 'package:flutter/material.dart'; 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:http/http.dart' as http;
import 'package:crcivan/BloC/DataService.dart';
import 'package:html/parser.dart' as htmlParser; 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/bars/app_bar';
import 'package:crcivan/widgets/background_widget.dart';
import 'package:crcivan/bars/bottom_bar'; import 'package:crcivan/bars/bottom_bar';
import 'package:crcivan/widgets/background_widget.dart';
import 'package:crcivan/pages/utils.dart';
class EmbalsesPage extends StatefulWidget { class EmbalsesPage extends StatefulWidget {
const EmbalsesPage({Key? key}) : super(key: key); const EmbalsesPage({Key? key}) : super(key: key);
@ -16,6 +18,7 @@ class EmbalsesPage extends StatefulWidget {
class _EmbalsesPageState extends State<EmbalsesPage> { class _EmbalsesPageState extends State<EmbalsesPage> {
final DataService dataService = DataService(); final DataService dataService = DataService();
String communicationDate = '';
List<Map<String, dynamic>> embalsesData = []; List<Map<String, dynamic>> embalsesData = [];
List<String> descripciones = ['Cota (m)', 'Volumen (Hm3)', 'Entrada (l/s)', 'Salida (l/s)']; List<String> descripciones = ['Cota (m)', 'Volumen (Hm3)', 'Entrada (l/s)', 'Salida (l/s)'];
@ -23,6 +26,7 @@ class _EmbalsesPageState extends State<EmbalsesPage> {
void initState() { void initState() {
super.initState(); super.initState();
obtenerDatos(); obtenerDatos();
obtenerFechaComunicacion();
} }
Future<void> obtenerDatos() async { Future<void> obtenerDatos() async {
@ -36,13 +40,35 @@ class _EmbalsesPageState extends State<EmbalsesPage> {
} }
} }
Future<void> obtenerFechaComunicacion() async {
try {
final date = await dataService.obtenerFechaComunicacionEmbalses();
setState(() {
communicationDate = date;
});
} catch (e) {
print('Error: $e');
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: const CustomAppBar(), appBar: const CustomAppBar(),
body: BackgroundWidget( body: BackgroundWidget(
child: Padding( child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text(
communicationDate,
style: TextStyle(
fontSize: getResponsiveFontSize(context, 18.0),
fontWeight: FontWeight.bold,
),
),
),
Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: embalsesData.length, itemCount: embalsesData.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -66,8 +92,8 @@ class _EmbalsesPageState extends State<EmbalsesPage> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
nombreEmbalse!, nombreEmbalse!,
style: const TextStyle( style: TextStyle(
fontSize: 25.0, fontSize: getResponsiveFontSize(context, 25.0),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -86,9 +112,9 @@ class _EmbalsesPageState extends State<EmbalsesPage> {
listaElementos.length, listaElementos.length,
(index) => Text( (index) => Text(
'${descripciones[index]}: ${listaElementos[index]}', '${descripciones[index]}: ${listaElementos[index]}',
style: const TextStyle( style: TextStyle(
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 20.0, fontSize: getResponsiveFontSize(context, 20.0),
), ),
), ),
), ),
@ -104,6 +130,8 @@ class _EmbalsesPageState extends State<EmbalsesPage> {
}, },
), ),
), ),
],
),
), ),
bottomNavigationBar: const CustomBottomBar(), bottomNavigationBar: const CustomBottomBar(),
); );

View File

@ -1,23 +1,103 @@
import 'package:crcivan/BloC/contenedores_event.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:crcivan/bars/app_bar'; import 'package:crcivan/bars/app_bar';
import 'package:crcivan/bars/bottom_bar'; import 'package:crcivan/bars/bottom_bar';
import 'package:crcivan/BloC/contenedores_event.dart';
import 'package:crcivan/pages/noticias'; import 'package:crcivan/pages/noticias';
import 'package:crcivan/pages/pregon'; import 'package:crcivan/pages/pregon';
import 'package:crcivan/pages/embalses'; import 'package:crcivan/pages/embalses';
import 'package:crcivan/pages/secciones';
import 'package:crcivan/widgets/background_widget.dart'; import 'package:crcivan/widgets/background_widget.dart';
import 'package:url_launcher/url_launcher.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}); const MyHomePage({super.key, required this.title});
final String 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: const CustomAppBar(), //Barra superior personalizada appBar: const CustomAppBar(),
body: BackgroundWidget( body: BackgroundWidget(
//Widget fondo del fichero BackgroundWidget
child: Center( child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -31,22 +111,21 @@ class MyHomePage extends StatelessWidget {
); );
}, },
child: SizedBox( child: SizedBox(
//Botón Noticias
width: 300.0, width: 300.0,
child: Padding( child: Padding(
padding: const EdgeInsets.only(bottom: 20.0), padding: const EdgeInsets.only(bottom: 20.0),
child: Container( child: Container(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromARGB(255, 78, 169, 6), color: const Color.fromARGB(255, 240, 35, 35),
borderRadius: BorderRadius.circular(7.0), borderRadius: BorderRadius.circular(7.0),
), ),
child: const Text( child: Text(
'Noticias', 'Avisos',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 32.0, fontSize: getResponsiveFontSize(context, 32.0),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -62,22 +141,21 @@ class MyHomePage extends StatelessWidget {
); );
}, },
child: SizedBox( child: SizedBox(
//Botón Pregón
width: 300.0, width: 300.0,
child: Padding( child: Padding(
padding: const EdgeInsets.only(bottom: 20.0), padding: const EdgeInsets.only(bottom: 20.0),
child: Container( child: Container(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromARGB(255, 78, 169, 6), color: const Color.fromARGB(255, 230, 226, 0),
borderRadius: BorderRadius.circular(7.0), borderRadius: BorderRadius.circular(7.0),
), ),
child: const Text( child: Text(
'Pregón', 'Pregón',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 32.0, fontSize: getResponsiveFontSize(context, 32.0),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -94,22 +172,21 @@ class MyHomePage extends StatelessWidget {
); );
}, },
child: SizedBox( child: SizedBox(
//Botón Embalses
width: 300.0, width: 300.0,
child: Padding( child: Padding(
padding: const EdgeInsets.only(bottom: 20.0), padding: const EdgeInsets.only(bottom: 20.0),
child: Container( child: Container(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromARGB(255, 78, 169, 6), color: const Color.fromARGB(255, 6, 71, 169),
borderRadius: BorderRadius.circular(7.0), borderRadius: BorderRadius.circular(7.0),
), ),
child: const Text( child: Text(
'Embalses', 'Embalses',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 32.0, fontSize: getResponsiveFontSize(context, 32.0),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -119,25 +196,55 @@ class MyHomePage extends StatelessWidget {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
launchAemetURL(); //Función a link externo Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SeccionesPage()),
);
}, },
child: SizedBox( child: SizedBox(
//Botón Tiempo
width: 300.0, width: 300.0,
child: Padding( child: Padding(
padding: const EdgeInsets.only(bottom: 20.0), padding: const EdgeInsets.only(bottom: 20.0),
child: Container( child: Container(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromARGB(255, 78, 169, 6), color: const Color.fromARGB(255, 97, 97, 97),
borderRadius: BorderRadius.circular(7.0), borderRadius: BorderRadius.circular(7.0),
), ),
child: const Text( child: Text(
'Tiempo', 'Secciones',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Colors.white, 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, fontWeight: FontWeight.bold,
), ),
), ),
@ -150,12 +257,22 @@ class MyHomePage extends StatelessWidget {
onTap: () { onTap: () {
launchPrivacyPolicyURL(); launchPrivacyPolicyURL();
}, },
child: const Text( child: Text(
'Lee nuestras políticas de privacidad', 'Lee nuestras políticas de privacidad',
style: TextStyle( style: TextStyle(
color: Colors.blue, color: Colors.blue,
decoration: TextDecoration.underline, 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: bottomNavigationBar: const CustomBottomBar(),
const CustomBottomBar(), //Barra inferior personalizada
); );
} }
} }

View File

@ -4,6 +4,7 @@ import 'package:crcivan/bars/app_bar';
import 'package:crcivan/bars/bottom_bar'; import 'package:crcivan/bars/bottom_bar';
import 'package:html/parser.dart' as htmlParser; import 'package:html/parser.dart' as htmlParser;
import 'package:crcivan/widgets/background_widget.dart'; import 'package:crcivan/widgets/background_widget.dart';
import 'package:crcivan/pages/utils.dart';
class NoticiasPage extends StatefulWidget { class NoticiasPage extends StatefulWidget {
const NoticiasPage({Key? key}) : super(key: key); const NoticiasPage({Key? key}) : super(key: key);
@ -90,17 +91,21 @@ class _NoticiasPageState extends State<NoticiasPage> {
child: ExpansionTile( child: ExpansionTile(
title: Text( title: Text(
titulo!, 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: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
contenido!, 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
),
), ),
), ),
], ],
), ),
); );

View File

@ -5,7 +5,7 @@ import 'package:html/dom.dart' as htmlDom;
import 'package:crcivan/bars/app_bar'; import 'package:crcivan/bars/app_bar';
import 'package:crcivan/bars/bottom_bar'; import 'package:crcivan/bars/bottom_bar';
import 'package:crcivan/widgets/background_widget.dart'; import 'package:crcivan/widgets/background_widget.dart';
import 'package:crcivan/pages/utils.dart';
class Pregon extends StatefulWidget { class Pregon extends StatefulWidget {
const Pregon({Key? key}) : super(key: key); const Pregon({Key? key}) : super(key: key);
@ -82,7 +82,8 @@ class _PregonState extends State<Pregon> {
datos[index], datos[index],
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( 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
View 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
View 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
}
}

View File

@ -5,8 +5,10 @@
import FlutterMacOS import FlutterMacOS
import Foundation import Foundation
import shared_preferences_foundation
import url_launcher_macos import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
} }

View File

@ -129,6 +129,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
file:
dependency: transitive
description:
name: file
sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4
url: "https://pub.dev"
source: hosted
version: "7.0.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -296,6 +304,30 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" 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: petitparser:
dependency: transitive dependency: transitive
description: description:
@ -304,6 +336,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.0.2" 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: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -328,6 +368,62 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.1.2" 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: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -501,6 +597,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" 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: xml:
dependency: transitive dependency: transitive
description: description:

View File

@ -33,6 +33,7 @@ dependencies:
url_launcher: ^6.0.12 url_launcher: ^6.0.12
flutter_bloc: ^8.1.5 flutter_bloc: ^8.1.5
flutter_svg: ^2.0.10+1 flutter_svg: ^2.0.10+1
shared_preferences: ^2.2.0