import 'package:flutter/material.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/widgets/background_widget.dart'; import 'package:url_launcher/url_launcher.dart'; class MyHomePage extends StatelessWidget { const MyHomePage({super.key, required this.title}); final String title; @override Widget build(BuildContext context) { return Scaffold( appBar: const CustomAppBar(), //Barra superior personalizada body: BackgroundWidget( //Widget fondo del fichero BackgroundWidget child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const NoticiasPage()), ); }, 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), borderRadius: BorderRadius.circular(7.0), ), child: const Text( 'Noticias', textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 32.0, fontWeight: FontWeight.bold, ), ), ), ), ), ), InkWell( onTap: () { Navigator.push( context, MaterialPageRoute(builder: (context) => const Pregon()), ); }, 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), borderRadius: BorderRadius.circular(7.0), ), child: const Text( 'Pregón', textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 32.0, fontWeight: FontWeight.bold, ), ), ), ), ), ), InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const EmbalsesPage()), ); }, 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), borderRadius: BorderRadius.circular(7.0), ), child: const Text( 'Embalses', textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 32.0, fontWeight: FontWeight.bold, ), ), ), ), ), ), InkWell( onTap: () { launchAemetURL(); //Función a link externo }, 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), borderRadius: BorderRadius.circular(7.0), ), child: const Text( 'Tiempo', textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 32.0, fontWeight: FontWeight.bold, ), ), ), ), ), ), SizedBox(height: 20), InkWell( onTap: () { launchPrivacyPolicyURL(); }, child: const Text( 'Lee nuestras políticas de privacidad', style: TextStyle( color: Colors.blue, decoration: TextDecoration.underline, fontSize: 16.0, ), ), ), ], ), ), ), bottomNavigationBar: const CustomBottomBar(), //Barra inferior personalizada ); } }