Commit b08ae14f authored by Ester Alfonzo's avatar Ester Alfonzo

nuevas funcionalidades

parent b5598dab
favicon.png,1679924901810,85143c1f138d3c120e66e75d32dc16cee244f4ad49c05cceb692f489dcb9cf8f
404.html,1679924812520,b7bab6b83fa074653ff28c8d2a64135d3434575f70a12ab3d3ba8080461b9537 404.html,1679924812520,b7bab6b83fa074653ff28c8d2a64135d3434575f70a12ab3d3ba8080461b9537
index.html,1679924901810,b18d11fbea6ef27e475558d562cb4b631938864857db08ba128b18c522ebbd8f flutter.js,1680012197873,97ed2f98cb0c00158de183673e81b516e92e0b04e5b2a9b34b5c424627e8aa48
flutter_service_worker.js,1679924902326,358de7936cf091d555214591456ecf5eb5210cebc880b92b5992699ec1c621f9 canvaskit/canvaskit.js,1680012197537,862fbc90b0cdab302519d536322dddbcf3c9d519db25260ff9c3d04932747002
version.json,1679924901518,5f5b75bfabb6574ab1710e8d4ac87b98b7e824ef2f722fe814c496217b9a54dc canvaskit/canvaskit.wasm,1680012197341,c113b3200832c9cd19033de4cc79770e0bbc8cbd3d09df1a3dec9a513eda0577
manifest.json,1679924901638,50d775d035db6ab0f84548ea5ec03f35ec020f4654c1ffa254b75be55fede1a9 canvaskit/profiling/canvaskit.js,1680012197709,5e094643fdde460eef4aefb7fac175854a74ba1ecb1c8652c24145d23122b58f
assets/AssetManifest.json,1679924901630,a12757f84f925a136d3db02dc2af2a3aef6a88025ad2f02887cdc9a1f6366d6f canvaskit/profiling/canvaskit.wasm,1680012197549,4102b5e3159b137ccc8d739bce1796d9dc795c604e400ae060f30207a01ebe9a
assets/FontManifest.json,1679924901630,2e577238aa37b66dce45953302454e5cb5815118874d0936475541ee4bc549d1 favicon.png,1680016094068,85143c1f138d3c120e66e75d32dc16cee244f4ad49c05cceb692f489dcb9cf8f
assets/packages/fluttertoast/assets/toastify.css,1679924901610,b3106479402ae9cdfaebc5e46d5b8f807692c6fff685bd43b29ef265fe1f59de manifest.json,1680016094060,50d775d035db6ab0f84548ea5ec03f35ec020f4654c1ffa254b75be55fede1a9
flutter.js,1679920646518,97ed2f98cb0c00158de183673e81b516e92e0b04e5b2a9b34b5c424627e8aa48 index.html,1680016094068,f10de1f3049235aba4cb460d5ab83879971a6a8d52f1480a7fdc19e1b448cde9
assets/packages/fluttertoast/assets/toastify.js,1679924901614,af7cc93040f6a408fc5081768148326a2d6fa411d38e24c6adfa5dc067f8a1cd version.json,1680016093960,5f5b75bfabb6574ab1710e8d4ac87b98b7e824ef2f722fe814c496217b9a54dc
splash/splash.js,1679924901806,390064bc34b70131c9ef52749b48d1ad5eb8da5b330755aa9edf11b2f7a03704 assets/AssetManifest.json,1680016094056,b80daad7c243bd3162041484d3509faa4474f1bbb45d8bdb142c73daa6e1e1ee
splash/style.css,1679924901806,6bc1f1e841486df72b800736fc3f81ac053b78c4ebfa2ad8ee1f0643878dcb30 assets/FontManifest.json,1680016094056,2e577238aa37b66dce45953302454e5cb5815118874d0936475541ee4bc549d1
splash/img/dark-1x.png,1679924901638,70521923b12d65e1779e7375055c4db663cdfad4814f99c9945113eb85e15571 flutter_service_worker.js,1680016094500,c7179c8966a69c8a82c3b65c753b120a287065d743894a8bbe39b4e0b74245f2
splash/img/light-1x.png,1679924901802,70521923b12d65e1779e7375055c4db663cdfad4814f99c9945113eb85e15571 assets/packages/fluttertoast/assets/toastify.css,1680016094052,b3106479402ae9cdfaebc5e46d5b8f807692c6fff685bd43b29ef265fe1f59de
assets/packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf,1679924901614,0e556debdc639be357c09908bc9f3681127aba88ad920a794e178d39da0bf252 assets/assets/pdf.png,1680016094052,1896db7c09b8d87cfa800a6f54bcefc378ead10f157a718811d8dbc6f39358ab
splash/img/dark-2x.png,1679924901802,c23fdeab107570d9c46f8196832fc91dc438ddab44d1d58960bd5c7aa14c8c33 assets/packages/fluttertoast/assets/toastify.js,1680016094052,af7cc93040f6a408fc5081768148326a2d6fa411d38e24c6adfa5dc067f8a1cd
splash/img/light-2x.png,1679924901638,c23fdeab107570d9c46f8196832fc91dc438ddab44d1d58960bd5c7aa14c8c33 splash/splash.js,1680016094064,390064bc34b70131c9ef52749b48d1ad5eb8da5b330755aa9edf11b2f7a03704
icons/Icon-192.png,1679924901634,0cc2c871b8552f8d243c25baa8226fd98a0db8815f6456774f7b11cf7793fc09 splash/style.css,1680016094064,6bc1f1e841486df72b800736fc3f81ac053b78c4ebfa2ad8ee1f0643878dcb30
icons/Icon-maskable-192.png,1679924901634,0cc2c871b8552f8d243c25baa8226fd98a0db8815f6456774f7b11cf7793fc09 splash/img/dark-1x.png,1680016094060,70521923b12d65e1779e7375055c4db663cdfad4814f99c9945113eb85e15571
splash/img/dark-3x.png,1679924901638,f2fe240cc6f4fc0ac96e79495e1599dbbf3d9e7520010ef13b02171a67aa513b splash/img/light-1x.png,1680016094064,70521923b12d65e1779e7375055c4db663cdfad4814f99c9945113eb85e15571
assets/assets/UNA_logo.png,1679924901610,68984bbfbb32ed151488d40c79ec350a6dfc54e57babe9eb6c3836c98c4fd22f assets/packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf,1680016094052,0e556debdc639be357c09908bc9f3681127aba88ad920a794e178d39da0bf252
splash/img/light-3x.png,1679924901638,f2fe240cc6f4fc0ac96e79495e1599dbbf3d9e7520010ef13b02171a67aa513b splash/img/dark-2x.png,1680016094060,c23fdeab107570d9c46f8196832fc91dc438ddab44d1d58960bd5c7aa14c8c33
canvaskit/canvaskit.js,1679920646334,862fbc90b0cdab302519d536322dddbcf3c9d519db25260ff9c3d04932747002 splash/img/light-2x.png,1680016094060,c23fdeab107570d9c46f8196832fc91dc438ddab44d1d58960bd5c7aa14c8c33
splash/img/dark-4x.png,1679924901638,e0de666a05e47e77e1e3927006d5989e0a42e5515afaf3e5d159e2b6b5c1a5cf icons/Icon-192.png,1680016094060,0cc2c871b8552f8d243c25baa8226fd98a0db8815f6456774f7b11cf7793fc09
splash/img/light-4x.png,1679924901802,e0de666a05e47e77e1e3927006d5989e0a42e5515afaf3e5d159e2b6b5c1a5cf icons/Icon-maskable-192.png,1680016094060,0cc2c871b8552f8d243c25baa8226fd98a0db8815f6456774f7b11cf7793fc09
canvaskit/profiling/canvaskit.js,1679920646518,5e094643fdde460eef4aefb7fac175854a74ba1ecb1c8652c24145d23122b58f splash/img/dark-3x.png,1680016094060,f2fe240cc6f4fc0ac96e79495e1599dbbf3d9e7520010ef13b02171a67aa513b
assets/packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf,1679924901614,caf68fabc3db88132f4f4126f25681286fa2924ff1349ccaf2a3748c5f7eb571 splash/img/light-3x.png,1680016094060,f2fe240cc6f4fc0ac96e79495e1599dbbf3d9e7520010ef13b02171a67aa513b
icons/Icon-512.png,1679924901634,9fce85e33f4e44d68cf6ca51b23e0b012be871350cb9e4c339ffcd4aef700ea5 assets/assets/UNA_logo.png,1680016094052,68984bbfbb32ed151488d40c79ec350a6dfc54e57babe9eb6c3836c98c4fd22f
icons/Icon-maskable-512.png,1679924901634,9fce85e33f4e44d68cf6ca51b23e0b012be871350cb9e4c339ffcd4aef700ea5 splash/img/dark-4x.png,1680016094060,e0de666a05e47e77e1e3927006d5989e0a42e5515afaf3e5d159e2b6b5c1a5cf
assets/NOTICES,1679924901630,2156299f48e62b6df2b80be103686ab1d8c106ea1794ea9a921e1f6421e1c482 splash/img/light-4x.png,1680016094064,e0de666a05e47e77e1e3927006d5989e0a42e5515afaf3e5d159e2b6b5c1a5cf
assets/packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf,1679924901614,11b3a031a495d8a9f099ff65c5488ad17e2897e1bbc7c18a396d8a624ea3f626 assets/packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf,1680016094052,caf68fabc3db88132f4f4126f25681286fa2924ff1349ccaf2a3748c5f7eb571
assets/fonts/MaterialIcons-Regular.otf,1679924901614,01e1893e23bcf2e77aa3229c67ae0f47bca9354102373c6363dea40d78fb848c icons/Icon-maskable-512.png,1680016094060,9fce85e33f4e44d68cf6ca51b23e0b012be871350cb9e4c339ffcd4aef700ea5
main.dart.js,1679924901514,5942cf160610d39e0e85e467a073ad7795961c403ae6182b2a6bb2f2bd867c5d icons/Icon-512.png,1680016094060,9fce85e33f4e44d68cf6ca51b23e0b012be871350cb9e4c339ffcd4aef700ea5
canvaskit/canvaskit.wasm,1679920646150,c113b3200832c9cd19033de4cc79770e0bbc8cbd3d09df1a3dec9a513eda0577 assets/NOTICES,1680016094056,2a45dff10b3d78315f3b43b534509461320a902d9dda6676d589e19ecb7a6a13
canvaskit/profiling/canvaskit.wasm,1679920646442,4102b5e3159b137ccc8d739bce1796d9dc795c604e400ae060f30207a01ebe9a assets/packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf,1680016094052,11b3a031a495d8a9f099ff65c5488ad17e2897e1bbc7c18a396d8a624ea3f626
assets/fonts/MaterialIcons-Regular.otf,1680016094056,01e1893e23bcf2e77aa3229c67ae0f47bca9354102373c6363dea40d78fb848c
main.dart.js,1680016093956,8a842e77ac3bd464e03fcc40c9bbaae15abd16b5e6b6ad958400f8191c75c37d
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart';
class CustomAnimatedBottomBar extends StatelessWidget { class CustomAnimatedBottomBar extends StatelessWidget {
CustomAnimatedBottomBar({ CustomAnimatedBottomBar({
...@@ -52,6 +54,7 @@ class CustomAnimatedBottomBar extends StatelessWidget { ...@@ -52,6 +54,7 @@ class CustomAnimatedBottomBar extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment, mainAxisAlignment: mainAxisAlignment,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: items.map((item) { children: items.map((item) {
var index = items.indexOf(item); var index = items.indexOf(item);
return Expanded( return Expanded(
......
...@@ -10,43 +10,81 @@ import '../services/authService.dart'; ...@@ -10,43 +10,81 @@ import '../services/authService.dart';
Widget AppBarCommon(BuildContext context, action2) { Widget AppBarCommon(BuildContext context, action2) {
return Container( return Container(
height: 25.h, height: 25.h,
width: kIsWeb ? 70.w : 100.w, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(50), bottomLeft: Radius.circular(50),
bottomRight: Radius.circular(50), bottomRight: Radius.circular(50),
), ),
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
child: AppBar( child: Column(children: [
elevation: 0, AppBar(
leading: Image.asset( elevation: 0,
'assets/UNA_logo.png', leading: Image.asset(
scale: 1, 'assets/UNA_logo.png',
height: 12.h, scale: 1,
width: 15.w, height: 12.h,
width: 15.w,
),
title: Text(
'CENMU',
style: TextStyle(
fontSize: kIsWeb ? 10.sp : 16.sp, fontWeight: FontWeight.bold),
),
centerTitle: kIsWeb ? false : true,
actions: [
kIsWeb
? GestureDetector(
onTap: () {
logout(context);
},
child: Container(
padding: EdgeInsets.all(3),
margin: EdgeInsets.all(3),
height: 4.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(50)),
color: Theme.of(context).colorScheme.secondary,
),
child: Row(
children: [
/*Text(
"Cerrar Sesión",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 5.sp,
),
),
SizedBox(
width: 1.w,
),*/
Icon(
FontAwesomeIcons.rightFromBracket,
size: 2.8.h,
),
],
),
),
)
: const SizedBox.shrink(),
action2
],
),
SizedBox(
height: 5.h,
), ),
title: Text( Text(
'CENMU', "Comisión de Estudio de Nuevo Modelo de Universidad",
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: kIsWeb ? 13.sp : 16.sp, fontWeight: FontWeight.bold), fontSize: kIsWeb ? 8.sp : 12.sp,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
color: Colors.white,
),
), ),
centerTitle: kIsWeb ? false : true, ]),
actions: [
kIsWeb
? IconButton(
icon: const Icon(
FontAwesomeIcons.rightFromBracket,
size: 23,
),
onPressed: () {
logout(context);
},
)
: const SizedBox.shrink(),
action2
],
),
); );
} }
...@@ -266,7 +304,7 @@ Widget commonText(BuildContext context, String text) { ...@@ -266,7 +304,7 @@ Widget commonText(BuildContext context, String text) {
text, text,
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: kIsWeb ? 6.sp : 10.sp,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
......
import 'package:CENMU/services/fileDownloadService.dart'; import 'package:CENMU/services/fileDownloadService.dart';
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart'; import 'package:sizer/sizer.dart';
...@@ -48,9 +49,8 @@ class _ActividadesPrevistasScreenState ...@@ -48,9 +49,8 @@ class _ActividadesPrevistasScreenState
Widget build(BuildContext context) { Widget build(BuildContext context) {
//print('build ActividadesRecientesCREEN'); //print('build ActividadesRecientesCREEN');
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
body: Container( body: Container(
decoration: BoxDecoration( decoration: const BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(15), topRight: Radius.circular(15))), topLeft: Radius.circular(15), topRight: Radius.circular(15))),
child: ListView.builder( child: ListView.builder(
...@@ -67,39 +67,43 @@ class _ActividadesPrevistasScreenState ...@@ -67,39 +67,43 @@ class _ActividadesPrevistasScreenState
child: Text( child: Text(
listA[index].first["fecha"].toString(), listA[index].first["fecha"].toString(),
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: kIsWeb ? 8.sp : 16.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), ),
Flexible( Flexible(
child: ListView.separated( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
separatorBuilder: (context, int y) =>
Divider(color: Colors.black.withOpacity(0.5)),
itemCount: listA[index].length, itemCount: listA[index].length,
itemBuilder: (BuildContext context, i) => ListTile( itemBuilder: (BuildContext context, i) => ListTile(
leading: Image.asset( leading: Image.asset(
'assets/pdf.png', 'assets/pdf.png',
scale: 1, scale: 1,
height: 8.h, height: kIsWeb ? 6.h : 4.h,
), ),
title: Text( title: Text(
listA[index][i]["titulo"], listA[index][i]["titulo"],
style: TextStyle( style: TextStyle(
fontSize: 15.sp, fontSize: kIsWeb ? 7.sp : 15.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
), ),
), ),
subtitle: Text(listA[index][i]["descripcion"]), subtitle: Text(
listA[index][i]["descripcion"],
style: TextStyle(
fontSize: kIsWeb ? 5.sp : 15.sp,
fontWeight: FontWeight.bold,
),
),
trailing: GestureDetector( trailing: GestureDetector(
onTap: () => onTap: () =>
downloadPdfPrevista(context, listA[index][i]), downloadPdfPrevista(context, listA[index][i]),
child: Icon( child: Icon(
Icons.download, Icons.download,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
size: 4.h, size: kIsWeb ? 6.w : 4.h,
), ),
), ),
), ),
......
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart'; import 'package:sizer/sizer.dart';
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart';
...@@ -48,9 +49,8 @@ class _ActividadesRecientesScreenState ...@@ -48,9 +49,8 @@ class _ActividadesRecientesScreenState
Widget build(BuildContext context) { Widget build(BuildContext context) {
//print('build ActividadesRecientesCREEN'); //print('build ActividadesRecientesCREEN');
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
body: Container( body: Container(
decoration: BoxDecoration( decoration: const BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(15), topRight: Radius.circular(15))), topLeft: Radius.circular(15), topRight: Radius.circular(15))),
child: ListView.builder( child: ListView.builder(
...@@ -67,39 +67,43 @@ class _ActividadesRecientesScreenState ...@@ -67,39 +67,43 @@ class _ActividadesRecientesScreenState
child: Text( child: Text(
listA[index].first["fecha"].toString(), listA[index].first["fecha"].toString(),
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: kIsWeb ? 8.sp : 16.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), ),
Flexible( Flexible(
child: ListView.separated( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
separatorBuilder: (context, int y) =>
Divider(color: Colors.black.withOpacity(0.5)),
itemCount: listA[index].length, itemCount: listA[index].length,
itemBuilder: (BuildContext context, i) => ListTile( itemBuilder: (BuildContext context, i) => ListTile(
leading: Image.asset( leading: Image.asset(
'assets/pdf.png', 'assets/pdf.png',
scale: 1, scale: 1,
height: 8.h, height: kIsWeb ? 6.h : 4.h,
), ),
title: Text( title: Text(
listA[index][i]["titulo"], listA[index][i]["titulo"],
style: TextStyle( style: TextStyle(
fontSize: 15.sp, fontSize: kIsWeb ? 7.sp : 15.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
), ),
), ),
subtitle: Text(listA[index][i]["descripcion"]), subtitle: Text(
listA[index][i]["descripcion"],
style: TextStyle(
fontSize: kIsWeb ? 5.sp : 15.sp,
fontWeight: FontWeight.bold,
),
),
trailing: GestureDetector( trailing: GestureDetector(
onTap: () => onTap: () =>
downloadPdfReciente(context, listA[index][i]), downloadPdfPrevista(context, listA[index][i]),
child: Icon( child: Icon(
Icons.download, Icons.download,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
size: 4.h, size: kIsWeb ? 6.h : 4.h,
), ),
), ),
), ),
......
...@@ -3,6 +3,7 @@ import 'package:CENMU/screens/ActividadesRecientesScreen.dart'; ...@@ -3,6 +3,7 @@ import 'package:CENMU/screens/ActividadesRecientesScreen.dart';
import 'package:CENMU/screens/NuevaActividadScreen.dart'; import 'package:CENMU/screens/NuevaActividadScreen.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart';
import '../common_widgets/CustomBottonBar.dart'; import '../common_widgets/CustomBottonBar.dart';
import '../common_widgets/Widgets.dart'; import '../common_widgets/Widgets.dart';
...@@ -35,9 +36,7 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -35,9 +36,7 @@ class _HomeScreenState extends State<HomeScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
//print('build HomeCREEN');
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
AppBarCommon(context, const SizedBox.shrink()), AppBarCommon(context, const SizedBox.shrink()),
...@@ -107,7 +106,7 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -107,7 +106,7 @@ class _HomeScreenState extends State<HomeScreen> {
] ]
: [ : [
BottomNavyBarItem( BottomNavyBarItem(
icon: const Icon(Icons.savings_outlined), icon: const Icon(Icons.file_present),
title: const Text( title: const Text(
'Actividades Previstas', 'Actividades Previstas',
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
......
import 'dart:io'; import 'dart:io';
import 'package:CENMU/services/loadingService.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:sizer/sizer.dart'; import 'package:sizer/sizer.dart';
import '../common_styles.dart'; import '../common_styles.dart';
import '../common_widgets/Widgets.dart'; import '../common_widgets/Widgets.dart';
import '../services/toastService.dart';
class NuevaActividadScreen extends StatefulWidget { class NuevaActividadScreen extends StatefulWidget {
const NuevaActividadScreen({Key? key}) : super(key: key); const NuevaActividadScreen({Key? key}) : super(key: key);
...@@ -14,7 +19,6 @@ class NuevaActividadScreen extends StatefulWidget { ...@@ -14,7 +19,6 @@ class NuevaActividadScreen extends StatefulWidget {
} }
class _NuevaActividadScreenState extends State<NuevaActividadScreen> { class _NuevaActividadScreenState extends State<NuevaActividadScreen> {
final GlobalKey<FormState> _form = GlobalKey<FormState>();
final TextEditingController descripcionController = TextEditingController(); final TextEditingController descripcionController = TextEditingController();
final TextEditingController tituloController = TextEditingController(); final TextEditingController tituloController = TextEditingController();
final TextEditingController fechaController = TextEditingController(); final TextEditingController fechaController = TextEditingController();
...@@ -40,128 +44,126 @@ class _NuevaActividadScreenState extends State<NuevaActividadScreen> { ...@@ -40,128 +44,126 @@ class _NuevaActividadScreenState extends State<NuevaActividadScreen> {
if (result != null) { if (result != null) {
setState(() { setState(() {
documents.add({ documents.add({
'nombre': result.files.single.name, 'nombre': result.files.first.name,
'posicion': result.files.single.path 'position': result.files.first.bytes
}); });
}); });
print(documents); //print(documents);
File file = File(result.files.single.path.toString()); //File file = File(result.files.single.path.toString());
} else { } else {
// User canceled the picker // User canceled the picker
} }
} }
guardarTodo(Map<String, dynamic> json) async {
List<dynamic> l = [];
for (int i = 0; i < documents.length; i++) {
json['url'] = documents[i]['nombre'];
json['time'] = DateTime.now().microsecondsSinceEpoch;
if (dropdownvalueActi == 'PREVISTA') {
await FirebaseStorage.instance
.ref('previstas/${documents[i]['nombre']}')
.putData(documents[i]['position']);
} else {
await FirebaseStorage.instance
.ref('recientes/${documents[i]['nombre']}')
.putData(documents[i]['position']);
}
l.add(json);
}
final bd = FirebaseFirestore.instance;
var acti;
if (dropdownvalueActi == 'PREVISTA') {
acti = bd.collection("actividades_previstas");
} else {
acti = bd.collection("actividades_recientes");
}
acti
.doc(DateTime.now().microsecondsSinceEpoch.toString())
.set({"lista": l});
await dismissPresent();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
//print('build NuevaActividadCREEN'); //print('build NuevaActividadCREEN');
return Scaffold( return Scaffold(
body: Container( body: Container(
margin: EdgeInsets.all(15), margin: const EdgeInsets.all(15),
child: Form( child: ListView(children: <Widget>[
key: _form, Center(
autovalidateMode: AutovalidateMode.onUserInteraction, child: Container(
child: ListView(children: <Widget>[ width: MediaQuery.of(context).size.width * 0.95,
Center( margin: const EdgeInsets.only(bottom: 15),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(5.0),
),
child: Container( child: Container(
width: MediaQuery.of(context).size.width * 0.95, padding: const EdgeInsets.only(
margin: const EdgeInsets.only(bottom: 15), top: 10.0, bottom: 5.0, left: 15.0, right: 15.0),
decoration: BoxDecoration( child: Column(
color: Theme.of(context).cardColor, children: <Widget>[
borderRadius: BorderRadius.circular(5.0), commonText(context, 'Titulo*'),
), TextFormField(
child: Container( validator: (value) {
padding: const EdgeInsets.only( if (value!.isEmpty) {
top: 10.0, bottom: 5.0, left: 15.0, right: 15.0), return 'Requerido';
child: Column( }
children: <Widget>[ return null;
commonText(context, 'Titulo*'), },
TextFormField( controller: tituloController,
validator: (value) { keyboardType: TextInputType.text,
if (value!.isEmpty) { decoration:
return 'Requerido'; inputDecorationCrearTramiteStyle('Titulo*', true),
} ),
return null; commonText(context, 'Descripcion*'),
}, TextFormField(
controller: tituloController, validator: (value) {
keyboardType: TextInputType.text, if (value!.isEmpty) {
decoration: return 'Requerido';
inputDecorationCrearTramiteStyle('Titulo*', true), }
), return null;
commonText(context, 'Descripcion*'), },
TextFormField( controller: descripcionController,
validator: (value) { keyboardType: TextInputType.emailAddress,
if (value!.isEmpty) { decoration:
return 'Requerido'; inputDecorationCrearTramiteStyle('Nombre*', true),
} ),
return null; commonText(context, 'Fecha*'),
}, TextFormField(
controller: descripcionController, validator: (value) {
keyboardType: TextInputType.emailAddress, if (value!.isEmpty) {
decoration: return 'Requerido';
inputDecorationCrearTramiteStyle('Nombre*', true), }
), return null;
commonText(context, 'Fecha*'), },
TextFormField( controller: fechaController,
validator: (value) { keyboardType: TextInputType.emailAddress,
if (value!.isEmpty) { decoration:
return 'Requerido'; inputDecorationCrearTramiteStyle('Fecha*', true),
} ),
return null; const SizedBox(
}, height: 10,
controller: fechaController, ),
keyboardType: TextInputType.emailAddress, Row(
decoration:
inputDecorationCrearTramiteStyle('Fecha*', true),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: commonText(context, 'Publicar*'),
),
Flexible(
child: DropdownButton<String>(
// Initial Value
value: dropdownvaluePublicar,
// Down Arrow Icon
icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: ["SI", "NO"].map((String items) {
return DropdownMenuItem(
value: items,
child: Text(items),
);
}).toList(),
onChanged: (String? newValue) {
setState(() {
dropdownvaluePublicar = newValue!;
});
},
),
),
]),
Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Flexible( Flexible(
child: commonText(context, 'Tipo de Actividad*'), child: commonText(context, 'Publicar*'),
), ),
Flexible( Flexible(
child: DropdownButton<String>( child: DropdownButton<String>(
// Initial Value // Initial Value
value: dropdownvalueActi, value: dropdownvaluePublicar,
// Down Arrow Icon // Down Arrow Icon
icon: const Icon(Icons.keyboard_arrow_down), icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items // Array list of items
items: items: ["SI", "NO"].map((String items) {
["RECIENTE", "PREVISTA"].map((String items) {
return DropdownMenuItem( return DropdownMenuItem(
value: items, value: items,
child: Text(items), child: Text(items),
...@@ -170,49 +172,92 @@ class _NuevaActividadScreenState extends State<NuevaActividadScreen> { ...@@ -170,49 +172,92 @@ class _NuevaActividadScreenState extends State<NuevaActividadScreen> {
onChanged: (String? newValue) { onChanged: (String? newValue) {
setState(() { setState(() {
dropdownvalueActi = newValue!; dropdownvaluePublicar = newValue!;
}); });
}, },
), ),
), ),
], ]),
), SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: commonText(context, 'Tipo de Actividad*'),
),
Flexible(
child: DropdownButton<String>(
// Initial Value
value: dropdownvalueActi,
/////////////////// // Down Arrow Icon
///Archivos icon: const Icon(Icons.keyboard_arrow_down),
Row(
mainAxisAlignment: MainAxisAlignment.start, // Array list of items
crossAxisAlignment: CrossAxisAlignment.start, items: ["RECIENTE", "PREVISTA"].map((String items) {
children: [ return DropdownMenuItem(
Flexible( value: items,
child: commonText(context, 'Archivos*'), child: Text(items),
), );
Flexible( }).toList(),
child: Container(
alignment: Alignment.topLeft, onChanged: (String? newValue) {
child: ElevatedButton( setState(() {
onPressed: () => elegirArchivo(), dropdownvalueActi = newValue!;
style: ElevatedButton.styleFrom( });
minimumSize: Size.zero, // Set this },
), ),
child: Text( ),
'ADJUNTAR', ],
style: TextStyle( ),
fontSize: 10.sp,
fontWeight: FontWeight.bold), ///////////////////
///Archivos
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: commonText(context, 'Archivos*'),
),
Flexible(
child: Container(
alignment: Alignment.topLeft,
child: ElevatedButton(
onPressed: () => elegirArchivo(),
style: ElevatedButton.styleFrom(
minimumSize: Size.zero, // Set this
),
child: Text(
'ADJUNTAR',
style: TextStyle(
fontSize: kIsWeb ? 8.sp : 10.sp,
fontWeight: FontWeight.bold,
), ),
), ),
), ),
), ),
]), ),
if (documents.isNotEmpty) ...[ ]),
Swiper( if (documents.isNotEmpty) ...[
Container(
padding: const EdgeInsets.only(top: 15, bottom: 15),
margin: const EdgeInsets.only(top: 15, bottom: 15),
height: 35.h,
width: 100.w,
child: Swiper(
pagination: const SwiperPagination(), pagination: const SwiperPagination(),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: documents.length, itemCount: documents.length,
layout: SwiperLayout.DEFAULT, layout: SwiperLayout.DEFAULT,
itemHeight: MediaQuery.of(context).size.height * 0.30, itemHeight: 25.h,
itemWidth: MediaQuery.of(context).size.width * 0.98, itemWidth: 98.w,
itemBuilder: (BuildContext context, int indexSwip) { itemBuilder: (BuildContext context, int indexSwip) {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
...@@ -223,36 +268,82 @@ class _NuevaActividadScreenState extends State<NuevaActividadScreen> { ...@@ -223,36 +268,82 @@ class _NuevaActividadScreenState extends State<NuevaActividadScreen> {
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.secondary .secondary
.withOpacity(0.5), .withOpacity(0.2),
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Center( Image.asset(
child: Text( 'assets/pdf.png',
documents[indexSwip]['titulo'], scale: 1,
style: TextStyle( height: 10.h,
fontWeight: FontWeight.bold, width: 10.w,
color: Theme.of(context) ),
.colorScheme Center(
.primary, child: Text(
documents[indexSwip]['nombre'],
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 10.sp,
color: Theme.of(context)
.colorScheme
.primary,
),
), ),
), ),
), ]),
],
),
); );
}, },
), ),
] ),
/////////////////////////////////////////////////
], ],
),
/////////////////////////////////////////////////
const SizedBox(
height: 15,
),
ElevatedButton(
child: Text(
'GUARDAR',
style: TextStyle(
fontSize: kIsWeb ? 8.sp : 10.sp,
fontWeight: FontWeight.bold,
),
),
style: ElevatedButton.styleFrom(
padding: EdgeInsets.all(8),
minimumSize: Size.zero, // Set this
),
onPressed: () async {
if (tituloController.text != '' &&
descripcionController.text != '' &&
fechaController.text != '') {
await showPresent("Guardando...");
var json = {
'titulo': tituloController.text,
'descripcion': descripcionController.text,
'publicar':
dropdownvaluePublicar == 'SI' ? true : false,
'fecha': fechaController.text,
'url': "",
"time": "",
"archivo": "PDF"
};
guardarTodo(json);
} else {
showToastError('Complete todos los campos');
}
},
),
const SizedBox(
height: 10,
),
],
), ),
), ),
), ),
]), ),
), ]),
), ),
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment