Commit b5598dab authored by Ester Alfonzo's avatar Ester Alfonzo

la aplicacion movil funcional

parent 44a78de5
favicon.png,1679924901810,85143c1f138d3c120e66e75d32dc16cee244f4ad49c05cceb692f489dcb9cf8f
404.html,1679924812520,b7bab6b83fa074653ff28c8d2a64135d3434575f70a12ab3d3ba8080461b9537
index.html,1679924901810,b18d11fbea6ef27e475558d562cb4b631938864857db08ba128b18c522ebbd8f
flutter_service_worker.js,1679924902326,358de7936cf091d555214591456ecf5eb5210cebc880b92b5992699ec1c621f9
version.json,1679924901518,5f5b75bfabb6574ab1710e8d4ac87b98b7e824ef2f722fe814c496217b9a54dc
manifest.json,1679924901638,50d775d035db6ab0f84548ea5ec03f35ec020f4654c1ffa254b75be55fede1a9
assets/AssetManifest.json,1679924901630,a12757f84f925a136d3db02dc2af2a3aef6a88025ad2f02887cdc9a1f6366d6f
assets/FontManifest.json,1679924901630,2e577238aa37b66dce45953302454e5cb5815118874d0936475541ee4bc549d1
assets/packages/fluttertoast/assets/toastify.css,1679924901610,b3106479402ae9cdfaebc5e46d5b8f807692c6fff685bd43b29ef265fe1f59de
flutter.js,1679920646518,97ed2f98cb0c00158de183673e81b516e92e0b04e5b2a9b34b5c424627e8aa48
assets/packages/fluttertoast/assets/toastify.js,1679924901614,af7cc93040f6a408fc5081768148326a2d6fa411d38e24c6adfa5dc067f8a1cd
splash/splash.js,1679924901806,390064bc34b70131c9ef52749b48d1ad5eb8da5b330755aa9edf11b2f7a03704
splash/style.css,1679924901806,6bc1f1e841486df72b800736fc3f81ac053b78c4ebfa2ad8ee1f0643878dcb30
splash/img/dark-1x.png,1679924901638,70521923b12d65e1779e7375055c4db663cdfad4814f99c9945113eb85e15571
splash/img/light-1x.png,1679924901802,70521923b12d65e1779e7375055c4db663cdfad4814f99c9945113eb85e15571
assets/packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf,1679924901614,0e556debdc639be357c09908bc9f3681127aba88ad920a794e178d39da0bf252
splash/img/dark-2x.png,1679924901802,c23fdeab107570d9c46f8196832fc91dc438ddab44d1d58960bd5c7aa14c8c33
splash/img/light-2x.png,1679924901638,c23fdeab107570d9c46f8196832fc91dc438ddab44d1d58960bd5c7aa14c8c33
icons/Icon-192.png,1679924901634,0cc2c871b8552f8d243c25baa8226fd98a0db8815f6456774f7b11cf7793fc09
icons/Icon-maskable-192.png,1679924901634,0cc2c871b8552f8d243c25baa8226fd98a0db8815f6456774f7b11cf7793fc09
splash/img/dark-3x.png,1679924901638,f2fe240cc6f4fc0ac96e79495e1599dbbf3d9e7520010ef13b02171a67aa513b
assets/assets/UNA_logo.png,1679924901610,68984bbfbb32ed151488d40c79ec350a6dfc54e57babe9eb6c3836c98c4fd22f
splash/img/light-3x.png,1679924901638,f2fe240cc6f4fc0ac96e79495e1599dbbf3d9e7520010ef13b02171a67aa513b
canvaskit/canvaskit.js,1679920646334,862fbc90b0cdab302519d536322dddbcf3c9d519db25260ff9c3d04932747002
splash/img/dark-4x.png,1679924901638,e0de666a05e47e77e1e3927006d5989e0a42e5515afaf3e5d159e2b6b5c1a5cf
splash/img/light-4x.png,1679924901802,e0de666a05e47e77e1e3927006d5989e0a42e5515afaf3e5d159e2b6b5c1a5cf
canvaskit/profiling/canvaskit.js,1679920646518,5e094643fdde460eef4aefb7fac175854a74ba1ecb1c8652c24145d23122b58f
assets/packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf,1679924901614,caf68fabc3db88132f4f4126f25681286fa2924ff1349ccaf2a3748c5f7eb571
icons/Icon-512.png,1679924901634,9fce85e33f4e44d68cf6ca51b23e0b012be871350cb9e4c339ffcd4aef700ea5
icons/Icon-maskable-512.png,1679924901634,9fce85e33f4e44d68cf6ca51b23e0b012be871350cb9e4c339ffcd4aef700ea5
assets/NOTICES,1679924901630,2156299f48e62b6df2b80be103686ab1d8c106ea1794ea9a921e1f6421e1c482
assets/packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf,1679924901614,11b3a031a495d8a9f099ff65c5488ad17e2897e1bbc7c18a396d8a624ea3f626
assets/fonts/MaterialIcons-Regular.otf,1679924901614,01e1893e23bcf2e77aa3229c67ae0f47bca9354102373c6363dea40d78fb848c
main.dart.js,1679924901514,5942cf160610d39e0e85e467a073ad7795961c403ae6182b2a6bb2f2bd867c5d
canvaskit/canvaskit.wasm,1679920646150,c113b3200832c9cd19033de4cc79770e0bbc8cbd3d09df1a3dec9a513eda0577
canvaskit/profiling/canvaskit.wasm,1679920646442,4102b5e3159b137ccc8d739bce1796d9dc795c604e400ae060f30207a01ebe9a
{
"projects": {
"default": "proyectocenmu"
}
}
......@@ -33,4 +33,6 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
......@@ -10,6 +10,7 @@ import '../services/authService.dart';
Widget AppBarCommon(BuildContext context, action2) {
return Container(
height: 25.h,
width: kIsWeb ? 70.w : 100.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(50),
......@@ -28,9 +29,7 @@ Widget AppBarCommon(BuildContext context, action2) {
title: Text(
'CENMU',
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
fontSize: kIsWeb ? 13.sp : 16.sp, fontWeight: FontWeight.bold),
),
centerTitle: kIsWeb ? false : true,
actions: [
......@@ -259,66 +258,19 @@ Widget customErrorBuilder(BuildContext context, String? search, dynamic error) {
);
}
Widget commonText(BuildContext context, String text, String num) {
Widget commonText(BuildContext context, String text) {
return Container(
padding: const EdgeInsets.only(bottom: 12, top: 12),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
border: Border(
top: BorderSide(color: Theme.of(context).colorScheme.secondary),
bottom: BorderSide(color: Theme.of(context).colorScheme.secondary),
left: BorderSide(color: Theme.of(context).colorScheme.secondary),
right: BorderSide(color: Theme.of(context).colorScheme.secondary),
),
),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
width: 10,
),
Icon(
FontAwesomeIcons.clock,
size: 30,
color: Theme.of(context).colorScheme.secondary,
),
const SizedBox(
width: 8,
),
Text(
num,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontSize: 24,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
],
),
Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.only(left: 10, top: 4),
child: Text(
text,
textAlign: TextAlign.left,
style: const TextStyle(
fontSize: 10,
color: Colors.black,
style: TextStyle(
fontSize: 10.sp,
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.w500,
),
),
),
]),
);
}
......
......@@ -6,7 +6,7 @@ class AppTheme {
AppTheme._();
static const Color _lightPrimaryColor = Color(0xFFFF1493);
static const Color _lightSecondaryColor = Color(0xFF5A78C8);
static const Color _lightSecondaryColor = Color(0xFFE8C39E);
static const Color _lightOnPrimaryColor = Colors.white;
static const Color _lightOnSecondaryColor = Colors.white;
static const Color _lightTextInputColor = Colors.white;
......
......@@ -45,7 +45,7 @@ class MyApp extends StatelessWidget {
}
String getInitialRoute() {
print("kIsWeb $kIsWeb");
//print("kIsWeb $kIsWeb");
if (kIsWeb) {
if (sharedPrefs.containsKey('login') == true) {
if (sharedPrefs.read("login") == 'yes') {
......
import 'package:CENMU/services/fileDownloadService.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart';
class ActividadesPrevistasScreen extends StatefulWidget {
const ActividadesPrevistasScreen({Key? key}) : super(key: key);
@override
State<ActividadesPrevistasScreen> createState() =>
_ActividadesPrevistasScreenState();
}
class _ActividadesPrevistasScreenState
extends State<ActividadesPrevistasScreen> {
List<List<dynamic>> listA = [];
@override
void initState() {
super.initState();
getListActividades();
}
@override
void dispose() {
super.dispose();
}
getListActividades() async {
List<Map<String, dynamic>> l1 = [];
var bd = FirebaseFirestore.instance;
final docRef = bd.collection("actividades_previstas");
print(docRef);
var i = await docRef.snapshots().forEach((element) {
l1.clear();
element.docs.forEach((element2) {
element2.data()["lista"];
print("ele ${element2.data()['lista']}");
setState(() {
listA.add(element2.data()["lista"]);
});
});
print(listA);
});
}
@override
Widget build(BuildContext context) {
//print('build ActividadesRecientesCREEN');
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
body: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15), topRight: Radius.circular(15))),
child: ListView.builder(
itemCount: listA.length,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Container(
alignment: Alignment.center,
padding: EdgeInsets.only(left: 10, right: 10),
child: Text(
listA[index].first["fecha"].toString(),
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
),
),
Flexible(
child: ListView.separated(
shrinkWrap: true,
separatorBuilder: (context, int y) =>
Divider(color: Colors.black.withOpacity(0.5)),
itemCount: listA[index].length,
itemBuilder: (BuildContext context, i) => ListTile(
leading: Image.asset(
'assets/pdf.png',
scale: 1,
height: 8.h,
),
title: Text(
listA[index][i]["titulo"],
style: TextStyle(
fontSize: 15.sp,
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.secondary,
),
),
subtitle: Text(listA[index][i]["descripcion"]),
trailing: GestureDetector(
onTap: () =>
downloadPdfPrevista(context, listA[index][i]),
child: Icon(
Icons.download,
color: Theme.of(context).colorScheme.primary,
size: 4.h,
),
),
),
),
),
],
);
},
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:CENMU/services/fileDownloadService.dart';
class ActividadesRecientesScreen extends StatefulWidget {
const ActividadesRecientesScreen({Key? key}) : super(key: key);
@override
State<ActividadesRecientesScreen> createState() =>
_ActividadesRecientesScreenState();
}
class _ActividadesRecientesScreenState
extends State<ActividadesRecientesScreen> {
List<List<dynamic>> listA = [];
@override
void initState() {
super.initState();
getListActividades();
}
@override
void dispose() {
super.dispose();
}
getListActividades() async {
List<Map<String, dynamic>> l1 = [];
var bd = FirebaseFirestore.instance;
final docRef = bd.collection("actividades_recientes");
print(docRef);
var i = await docRef.snapshots().forEach((element) {
l1.clear();
element.docs.forEach((element2) {
element2.data()["lista"];
print("ele ${element2.data()['lista']}");
setState(() {
listA.add(element2.data()["lista"]);
});
});
print(listA);
});
}
@override
Widget build(BuildContext context) {
//print('build ActividadesRecientesCREEN');
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
body: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15), topRight: Radius.circular(15))),
child: ListView.builder(
itemCount: listA.length,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Container(
alignment: Alignment.center,
padding: EdgeInsets.only(left: 10, right: 10),
child: Text(
listA[index].first["fecha"].toString(),
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
),
),
Flexible(
child: ListView.separated(
shrinkWrap: true,
separatorBuilder: (context, int y) =>
Divider(color: Colors.black.withOpacity(0.5)),
itemCount: listA[index].length,
itemBuilder: (BuildContext context, i) => ListTile(
leading: Image.asset(
'assets/pdf.png',
scale: 1,
height: 8.h,
),
title: Text(
listA[index][i]["titulo"],
style: TextStyle(
fontSize: 15.sp,
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.secondary,
),
),
subtitle: Text(listA[index][i]["descripcion"]),
trailing: GestureDetector(
onTap: () =>
downloadPdfReciente(context, listA[index][i]),
child: Icon(
Icons.download,
color: Theme.of(context).colorScheme.primary,
size: 4.h,
),
),
),
),
),
],
);
},
),
),
);
}
}
import 'package:CENMU/screens/ActividadesPrevistasScreen.dart';
import 'package:CENMU/screens/ActividadesRecientesScreen.dart';
import 'package:CENMU/screens/NuevaActividadScreen.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../common_widgets/CustomBottonBar.dart';
......@@ -42,15 +45,19 @@ class _HomeScreenState extends State<HomeScreen> {
? Expanded(
child: IndexedStack(
index: _selectedIndex,
children: [Center(), Center(), Center()],
children: [
ActividadesPrevistasScreen(),
ActividadesRecientesScreen(),
NuevaActividadScreen()
],
),
)
: Expanded(
child: IndexedStack(
index: _selectedIndex,
children: [
Center(),
Center(),
ActividadesPrevistasScreen(),
ActividadesRecientesScreen(),
],
),
),
......@@ -67,28 +74,28 @@ class _HomeScreenState extends State<HomeScreen> {
items: kIsWeb
? [
BottomNavyBarItem(
icon: const Icon(Icons.file_present),
title: const Text(
'Realizadas',
'Actividades Previstas',
style: TextStyle(fontSize: 14),
),
icon:
const Icon(IconData(0xf045, fontFamily: 'MaterialIcons')),
activeColor: Colors.white,
inactiveColor: Colors.white,
textAlign: TextAlign.center,
),
BottomNavyBarItem(
icon: const Icon(Icons.savings_outlined),
title: const Text(
'Previstas',
'Actividades Realizadas',
style: TextStyle(fontSize: 14),
),
icon:
const Icon(IconData(0xf045, fontFamily: 'MaterialIcons')),
activeColor: Colors.white,
inactiveColor: Colors.white,
textAlign: TextAlign.center,
),
BottomNavyBarItem(
icon: const Icon(Icons.savings_outlined),
icon: const Icon(Icons.add_comment),
title: const Text(
'Nueva Actividad',
style: TextStyle(fontSize: 14),
......@@ -100,22 +107,22 @@ class _HomeScreenState extends State<HomeScreen> {
]
: [
BottomNavyBarItem(
icon: const Icon(Icons.savings_outlined),
title: const Text(
'Realizadas',
'Actividades Previstas',
style: TextStyle(fontSize: 14),
),
icon:
const Icon(IconData(0xf045, fontFamily: 'MaterialIcons')),
activeColor: Colors.white,
inactiveColor: Colors.white,
textAlign: TextAlign.center,
),
BottomNavyBarItem(
icon: const Icon(Icons.savings_outlined),
title: const Text(
'Previstas',
'Actividades Realizadas',
style: TextStyle(fontSize: 14),
),
icon:
const Icon(IconData(0xf045, fontFamily: 'MaterialIcons')),
activeColor: Colors.white,
inactiveColor: Colors.white,
textAlign: TextAlign.center,
......
......@@ -3,7 +3,7 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import '../common_widgets/RecuperarPassword.dart';
import '../data/SharedPref.dart';
import '../services/ConectionApi.dart';
import '../services/authService.dart';
import '../services/loadingService.dart';
import '../services/toastService.dart';
......
import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:sizer/sizer.dart';
import '../common_styles.dart';
import '../common_widgets/Widgets.dart';
class NuevaActividadScreen extends StatefulWidget {
const NuevaActividadScreen({Key? key}) : super(key: key);
@override
State<NuevaActividadScreen> createState() => _NuevaActividadScreenState();
}
class _NuevaActividadScreenState extends State<NuevaActividadScreen> {
final GlobalKey<FormState> _form = GlobalKey<FormState>();
final TextEditingController descripcionController = TextEditingController();
final TextEditingController tituloController = TextEditingController();
final TextEditingController fechaController = TextEditingController();
String dropdownvaluePublicar = 'SI';
String dropdownvalueActi = 'PREVISTA';
List<dynamic> documents = [];
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
elegirArchivo() async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['pdf'],
);
print('result $result');
if (result != null) {
setState(() {
documents.add({
'nombre': result.files.single.name,
'posicion': result.files.single.path
});
});
print(documents);
File file = File(result.files.single.path.toString());
} else {
// User canceled the picker
}
}
@override
Widget build(BuildContext context) {
//print('build NuevaActividadCREEN');
return Scaffold(
body: Container(
margin: EdgeInsets.all(15),
child: Form(
key: _form,
autovalidateMode: AutovalidateMode.onUserInteraction,
child: ListView(children: <Widget>[
Center(
child: Container(
width: MediaQuery.of(context).size.width * 0.95,
margin: const EdgeInsets.only(bottom: 15),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(5.0),
),
child: Container(
padding: const EdgeInsets.only(
top: 10.0, bottom: 5.0, left: 15.0, right: 15.0),
child: Column(
children: <Widget>[
commonText(context, 'Titulo*'),
TextFormField(
validator: (value) {
if (value!.isEmpty) {
return 'Requerido';
}
return null;
},
controller: tituloController,
keyboardType: TextInputType.text,
decoration:
inputDecorationCrearTramiteStyle('Titulo*', true),
),
commonText(context, 'Descripcion*'),
TextFormField(
validator: (value) {
if (value!.isEmpty) {
return 'Requerido';
}
return null;
},
controller: descripcionController,
keyboardType: TextInputType.emailAddress,
decoration:
inputDecorationCrearTramiteStyle('Nombre*', true),
),
commonText(context, 'Fecha*'),
TextFormField(
validator: (value) {
if (value!.isEmpty) {
return 'Requerido';
}
return null;
},
controller: fechaController,
keyboardType: TextInputType.emailAddress,
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,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: commonText(context, 'Tipo de Actividad*'),
),
Flexible(
child: DropdownButton<String>(
// Initial Value
value: dropdownvalueActi,
// Down Arrow Icon
icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items:
["RECIENTE", "PREVISTA"].map((String items) {
return DropdownMenuItem(
value: items,
child: Text(items),
);
}).toList(),
onChanged: (String? newValue) {
setState(() {
dropdownvalueActi = newValue!;
});
},
),
),
],
),
///////////////////
///Archivos
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: 10.sp,
fontWeight: FontWeight.bold),
),
),
),
),
]),
if (documents.isNotEmpty) ...[
Swiper(
pagination: const SwiperPagination(),
scrollDirection: Axis.horizontal,
itemCount: documents.length,
layout: SwiperLayout.DEFAULT,
itemHeight: MediaQuery.of(context).size.height * 0.30,
itemWidth: MediaQuery.of(context).size.width * 0.98,
itemBuilder: (BuildContext context, int indexSwip) {
return Container(
alignment: Alignment.center,
padding:
const EdgeInsets.only(left: 22, right: 22),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(0.5),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Text(
documents[indexSwip]['titulo'],
style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context)
.colorScheme
.primary,
),
),
),
],
),
);
},
),
]
/////////////////////////////////////////////////
],
),
),
),
),
]),
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_pdfview/flutter_pdfview.dart';
import '../services/fileDownloadService.dart';
class PdfViewScreen extends StatefulWidget {
String fileName;
PdfViewScreen({
Key? key,
required this.fileName,
}) : super(key: key);
@override
_PdfViewScreenState createState() => _PdfViewScreenState();
}
class _PdfViewScreenState extends State<PdfViewScreen> {
bool _isLoading = true;
//pdfData document;
String savePath = "";
@override
void initState() {
super.initState();
loadDocument();
}
loadDocument() async {
savePath = await getSavePath(context) + "/" + widget.fileName;
//document = await File(this.savePath);
setState(() => _isLoading = false);
}
changePDF() async {
setState(() => _isLoading = true);
//document = await File(savePath);
setState(() => _isLoading = false);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: _isLoading
? Center(
child: CircularProgressIndicator(
backgroundColor: Theme.of(context).colorScheme.primary,
valueColor: AlwaysStoppedAnimation<Color>(
Theme.of(context).colorScheme.primary),
))
: PDFView(
filePath: savePath,
),
),
),
);
}
}
import 'dart:convert';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:crypto/crypto.dart';
import '../data/SharedPref.dart';
import '../screens/LoginScreen.dart';
......
import 'dart:io';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import '../screens/PdfViewScreen.dart';
import 'fileStorageService.dart';
import 'loadingService.dart';
Future<void> downloadPdfReciente(BuildContext context, dynamic pd) async {
print(pd);
final storage =
FirebaseStorage.instanceFor(bucket: "gs://proyectocenmu.appspot.com");
final storageRef = storage.ref();
final pathReference = storageRef.child("recientes/${pd['url']}");
var directorio = await getSavePath(context);
final filePath = "${directorio}/${pd['url']}";
print(filePath);
final file = File(filePath);
final downloadTask = pathReference.writeToFile(file);
downloadTask.snapshotEvents.listen((taskSnapshot) async {
print(taskSnapshot.state);
switch (taskSnapshot.state) {
case TaskState.running:
await showPresent("Descargando");
break;
case TaskState.paused:
await dismissPresent();
break;
case TaskState.success:
await dismissPresent();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PdfViewScreen(
fileName: "${pd['url']}",
),
),
);
break;
case TaskState.canceled:
await dismissPresent();
break;
case TaskState.error:
await dismissPresent();
break;
}
});
}
Future<void> downloadPdfPrevista(BuildContext context, dynamic pd) async {
final storage =
FirebaseStorage.instanceFor(bucket: "gs://proyectocenmu.appspot.com");
final storageRef = storage.ref();
final pathReference = storageRef.child("previstas/${pd['url']}");
var directorio = await getSavePath(context);
final filePath = "${directorio}/${pd['url']}";
final file = File(filePath);
final downloadTask = pathReference.writeToFile(file);
downloadTask.snapshotEvents.listen((taskSnapshot) async {
print(taskSnapshot.state);
switch (taskSnapshot.state) {
case TaskState.running:
await showPresent("Descargando");
break;
case TaskState.paused:
// TODO: Handle this case.
break;
case TaskState.success:
await dismissPresent();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PdfViewScreen(
fileName: "${pd['url']}",
),
),
);
break;
case TaskState.canceled:
// TODO: Handle this case.
break;
case TaskState.error:
await dismissPresent();
break;
}
});
}
Future<String> getSavePath(BuildContext context) async {
var directorio = Platform.isIOS
? await requestAppDocumentsDirectory(context)
: await requestExternalStorageDirectory(context);
String path = directorio;
print("directorio, $directorio");
return path;
}
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'toastService.dart';
//for ios
Future<String> requestAppDocumentsDirectory(BuildContext context) async {
await getPermision(context);
var appDocumentsDirectory = await getApplicationDocumentsDirectory();
return appDocumentsDirectory.path;
}
//for android
Future<String> requestExternalStorageDirectory(BuildContext context) async {
await getPermision(context);
/*var externalDocumentsDirectory = ExtStorage.getExternalStoragePublicDirectory(
ExtStorage.DIRECTORY_DOWNLOADS);*/
var externalDocumentsDirectory = Directory('/storage/emulated/0/Download');
//await getExternalStorageDirectories(type: StorageDirectory.downloads);
print("Lista de directorios $externalDocumentsDirectory");
return externalDocumentsDirectory.path;
}
getPermision(BuildContext context) async {
var status = await Permission.storage.status;
print("statussss $status");
if (status.isGranted) {
return;
} else {
if (status.isLimited) {
await requestPermision(context);
} else {
await requestPermision(context);
}
}
}
requestPermision(BuildContext context) async {
var request = await Permission.storage.request();
if (request.isGranted) {
return;
} else {
if (request.isDenied || request.isPermanentlyDenied) {
showToastSuccess("Debe permitir que se acceda al almacenamiento interno");
} else {
return;
}
}
}
......@@ -7,10 +7,14 @@ import Foundation
import cloud_firestore
import firebase_core
import firebase_storage
import path_provider_foundation
import shared_preferences_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
}
......@@ -154,13 +154,21 @@ packages:
source: hosted
version: "2.0.1"
file:
dependency: transitive
dependency: "direct main"
description:
name: file
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
url: "https://pub.dev"
source: hosted
version: "6.1.4"
file_picker:
dependency: "direct main"
description:
name: file_picker
sha256: d8e9ca7e5d1983365c277f12c21b4362df6cf659c99af146ad4d04eb33033013
url: "https://pub.dev"
source: hosted
version: "5.2.6"
firebase_core:
dependency: "direct main"
description:
......@@ -185,6 +193,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.2"
firebase_storage:
dependency: "direct main"
description:
name: firebase_storage
sha256: "0a49413725587aa3ceaaa6233fdb2e32687e4972f13cd7277526219cd5acb398"
url: "https://pub.dev"
source: hosted
version: "11.0.16"
firebase_storage_platform_interface:
dependency: transitive
description:
name: firebase_storage_platform_interface
sha256: "951871b91ffdc49ead69daa03e58606f29b9b541056258ef805bbb7128f54afc"
url: "https://pub.dev"
source: hosted
version: "4.1.32"
firebase_storage_web:
dependency: transitive
description:
name: firebase_storage_web
sha256: d77573712c9fa5e05c7f1e23c77db0757b0b0718136a550d4d9823c92eeca8c8
url: "https://pub.dev"
source: hosted
version: "3.3.25"
flutter:
dependency: "direct main"
description: flutter
......@@ -222,6 +254,38 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.19"
flutter_page_indicator:
dependency: transitive
description:
name: flutter_page_indicator
sha256: a5b2992228c2827b69faed3977681a3f5c313c7f13d72272decbb2923d1d7176
url: "https://pub.dev"
source: hosted
version: "0.0.3"
flutter_pdfview:
dependency: "direct main"
description:
name: flutter_pdfview
sha256: "1a0e065689f2e0f4a795aef8ddfc3bb40387f24333290b62b4d3f1dfd6bef5fa"
url: "https://pub.dev"
source: hosted
version: "1.2.9"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: c224ac897bed083dabf11f238dd11a239809b446740be0c2044608c50029ffdf
url: "https://pub.dev"
source: hosted
version: "2.0.9"
flutter_screenutil:
dependency: "direct main"
description:
name: flutter_screenutil
sha256: "0a122936b450324cbdfd51be0819cc6fcebb093eb65585e9cd92263f7a1a8a39"
url: "https://pub.dev"
source: hosted
version: "5.7.0"
flutter_spinkit:
dependency: transitive
description:
......@@ -230,6 +294,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.1.0"
flutter_swiper:
dependency: "direct main"
description:
name: flutter_swiper
sha256: e52a0e894abfa4099a5d4e5098a00597f3b55e25617cdd19e6fe6be5d24858c7
url: "https://pub.dev"
source: hosted
version: "1.1.6"
flutter_test:
dependency: "direct dev"
description: flutter
......@@ -264,6 +336,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.15.2"
http:
dependency: transitive
description:
name: http
sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482"
url: "https://pub.dev"
source: hosted
version: "0.13.5"
http_parser:
dependency: transitive
description:
......@@ -344,6 +424,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.2"
path_provider:
dependency: "direct main"
description:
name: path_provider
sha256: c7edf82217d4b2952b2129a61d3ad60f1075b9299e629e149a8d2e39c2e6aad4
url: "https://pub.dev"
source: hosted
version: "2.0.14"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: "019f18c9c10ae370b08dce1f3e3b73bc9f58e7f087bb5e921f06529438ac0ae7"
url: "https://pub.dev"
source: hosted
version: "2.0.24"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "12eee51abdf4d34c590f043f45073adbb45514a108bd9db4491547a2fd891059"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
path_provider_linux:
dependency: transitive
description:
......@@ -368,6 +472,46 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
sha256: "33c6a1253d1f95fd06fa74b65b7ba907ae9811f9d5c1d3150e51417d04b8d6a8"
url: "https://pub.dev"
source: hosted
version: "10.2.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
sha256: "8028362b40c4a45298f1cbfccd227c8dd6caf0e27088a69f2ba2ab15464159e2"
url: "https://pub.dev"
source: hosted
version: "10.2.0"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
sha256: ee96ac32f5a8e6f80756e25b25b9f8e535816c8e6665a96b6d70681f8c4f7e85
url: "https://pub.dev"
source: hosted
version: "9.0.8"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
sha256: "68abbc472002b5e6dfce47fe9898c6b7d8328d58b5d2524f75e277c07a97eb84"
url: "https://pub.dev"
source: hosted
version: "3.9.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
sha256: f67cab14b4328574938ecea2db3475dad7af7ead6afab6338772c5f88963e38b
url: "https://pub.dev"
source: hosted
version: "0.1.2"
petitparser:
dependency: transitive
description:
......@@ -408,6 +552,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.2.4"
responsive_framework:
dependency: "direct main"
description:
name: responsive_framework
sha256: e7f61cac1a6928a19881d1a96eb2ded2c009884f2e8329f1fae1f5b4d27caaea
url: "https://pub.dev"
source: hosted
version: "0.1.9"
shared_preferences:
dependency: "direct main"
description:
......@@ -525,6 +677,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.4.16"
transformer_page_view:
dependency: transitive
description:
name: transformer_page_view
sha256: "2210531bc4148831061c575070173f32693415be8bbbf5bd2159a38f2adff61c"
url: "https://pub.dev"
source: hosted
version: "0.1.6"
typed_data:
dependency: transitive
description:
......
......@@ -42,6 +42,15 @@ dependencies:
crypto: ^3.0.2
flutter_native_splash: ^2.2.19
sizer: ^2.0.15
responsive_framework: ^0.1.5
flutter_screenutil: ^5.0.1
flutter_pdfview: ^1.2.9
path_provider: ^2.0.14
permission_handler: ^10.2.0
flutter_swiper: ^1.1.6
file_picker: ^5.2.6
file: ^6.1.4
firebase_storage: ^11.0.16
dev_dependencies:
flutter_test:
......
......@@ -6,6 +6,9 @@
#include "generated_plugin_registrant.h"
#include <permission_handler_windows/permission_handler_windows_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
}
......@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
permission_handler_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
......
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