Cambios para pwa
This commit is contained in:
BIN
web/icons/iconoCuadrado.png
Normal file
BIN
web/icons/iconoCuadrado.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
BIN
web/icons/screenshot1.png
Normal file
BIN
web/icons/screenshot1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 325 KiB |
BIN
web/icons/screenshot2.png
Normal file
BIN
web/icons/screenshot2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 565 KiB |
115
web/index.html
115
web/index.html
@ -1,59 +1,122 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
If you are serving your web app in a path other than the root, change the
|
||||
href value below to reflect the base path you are serving from.
|
||||
|
||||
The path provided below has to start and end with a slash "/" in order for
|
||||
it to work correctly.
|
||||
|
||||
For more details:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
||||
|
||||
This is a placeholder for base href that will be replaced by the value of
|
||||
the `--base-href` argument provided to `flutter build`.
|
||||
-->
|
||||
<base href="$FLUTTER_BASE_HREF">
|
||||
<base href="/pwa/">
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
<meta name="description" content="A new Flutter project.">
|
||||
|
||||
<!-- iOS meta tags & icons -->
|
||||
<meta name="description" content="Comunidad de Regantes de Civán">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
|
||||
<!-- Forzar renderizador HTML -->
|
||||
<meta name="flutter-web-renderer" content="html">
|
||||
|
||||
<!-- PWA y iOS meta tags -->
|
||||
<meta name="theme-color" content="#000000">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="flutter_project">
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||
<meta name="apple-mobile-web-app-title" content="CR-Civán">
|
||||
<link rel="apple-touch-icon" href="icons/iconoCuadrado.png">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
<link rel="icon" type="image/png" href="icons/iconoCuadrado.png"/>
|
||||
|
||||
<title>flutter_project</title>
|
||||
<title>CR-Civán</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
|
||||
|
||||
<!-- Prevenir flash de fondo blanco con CSS -->
|
||||
<style>
|
||||
body {
|
||||
background-color: #000000;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.initial-loader {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
background-color: #000000;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
transition: opacity 0.5s ease-out;
|
||||
}
|
||||
|
||||
.initial-loader img {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// The value below is injected by flutter build, do not touch.
|
||||
const serviceWorkerVersion = null;
|
||||
// Definir la variable que falta
|
||||
var serviceWorkerVersion = null;
|
||||
|
||||
window.flutterWebRenderer = 'html';
|
||||
|
||||
// Configuración específica para PWA
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('flutter_service_worker.js')
|
||||
.then(function(reg) {
|
||||
console.log('Service worker registered successfully');
|
||||
})
|
||||
.catch(function(e) {
|
||||
console.error('Error during service worker registration:', e);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Verificar si la app está instalada
|
||||
function isAppInstalled() {
|
||||
// Verificar si se está ejecutando como PWA
|
||||
return window.matchMedia('(display-mode: standalone)').matches ||
|
||||
window.navigator.standalone ||
|
||||
document.referrer.includes('android-app://');
|
||||
}
|
||||
</script>
|
||||
<!-- This script adds the flutter initialization JS code -->
|
||||
|
||||
<script src="flutter.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Pantalla de carga inicial para evitar parpadeo -->
|
||||
<div id="initial-loader" class="initial-loader">
|
||||
<img src="icons/iconoCuadrado.png" alt="Cargando...">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.addEventListener('load', function(ev) {
|
||||
// Ocultar el loader cuando Flutter esté listo
|
||||
var initialLoader = document.getElementById('initial-loader');
|
||||
|
||||
// Download main.dart.js
|
||||
_flutter.loader.loadEntrypoint({
|
||||
serviceWorker: {
|
||||
serviceWorkerVersion: serviceWorkerVersion,
|
||||
serviceWorkerVersion: null,
|
||||
},
|
||||
onEntrypointLoaded: function(engineInitializer) {
|
||||
engineInitializer.initializeEngine().then(function(appRunner) {
|
||||
// Agregar un breve retraso antes de ocultar el loader
|
||||
setTimeout(function() {
|
||||
initialLoader.style.opacity = '0';
|
||||
setTimeout(function() {
|
||||
initialLoader.style.display = 'none';
|
||||
}, 500);
|
||||
}, 300);
|
||||
appRunner.runApp();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="main.dart.js" type="application/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,35 +1,40 @@
|
||||
{
|
||||
"name": "flutter_project",
|
||||
"short_name": "flutter_project",
|
||||
"name": "CR-Civán",
|
||||
"short_name": "CR-Civán",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#0175C2",
|
||||
"theme_color": "#0175C2",
|
||||
"description": "A new Flutter project.",
|
||||
"background_color": "#000000",
|
||||
"theme_color": "#000000",
|
||||
"description": "Comunidad de Regantes de Civán",
|
||||
"orientation": "portrait-primary",
|
||||
"prefer_related_applications": false,
|
||||
"icons": [
|
||||
{
|
||||
"src": "icons/Icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"src": "icons/iconoCuadrado.png",
|
||||
"sizes": "654x654",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-512.png",
|
||||
"sizes": "512x512",
|
||||
"src": "icons/iconoCuadrado.png",
|
||||
"sizes": "654x654",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"screenshots": [
|
||||
{
|
||||
"src": "icons/screenshot1.png",
|
||||
"sizes": "1344x2992",
|
||||
"type": "image/png",
|
||||
"form_factor": "wide",
|
||||
"label": "Wonder Widgets"
|
||||
},
|
||||
{
|
||||
"src": "icons/screenshot2.png",
|
||||
"sizes": "1344x2992",
|
||||
"type": "image/png",
|
||||
"form_factor": "narrow",
|
||||
"label": "Wonder Widgets"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user