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(),
|
||||
|
||||
@ -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
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -110,4 +115,4 @@ class _NoticiasPageState extends State<NoticiasPage> {
|
||||
bottomNavigationBar: const CustomBottomBar(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user