Compare commits
59 Commits
master
...
Fort-Artic
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fadf3943f | |||
| a3a62d1903 | |||
| 6429ea0ad8 | |||
|
|
407fe28ead | ||
|
|
ac91f114b2 | ||
|
|
d3f60bcbe6 | ||
| 15f18f9a5a | |||
| fb4f5e504d | |||
| 11f5e2860f | |||
| 2056fc23fb | |||
| 246cb0739a | |||
| fb5973d016 | |||
| 144722feea | |||
| 3186a0dd8e | |||
| 163ce71e38 | |||
|
|
32fc0593bb | ||
|
|
798d3ca451 | ||
| c68488ad8d | |||
| 89502ce5d1 | |||
| 397e4fb6f2 | |||
| 1cbf67d94b | |||
|
|
e72434ab95 | ||
|
|
687c979efd | ||
| 8e8be6726b | |||
| 4dbbd2a335 | |||
| 9fb7250678 | |||
| 21b38052cc | |||
| 509d7b6adf | |||
| ed9c4bfc15 | |||
| 294a1a3b40 | |||
| 99aaad3f50 | |||
| d185c2c1e4 | |||
| d6b2c5791c | |||
| 412746e39a | |||
| eddc4005ae | |||
| ddda68c911 | |||
| 0f4fd94735 | |||
| e6e20d1a0e | |||
| 42c442b145 | |||
| 375e874c0b | |||
| 7306373277 | |||
| 164f904f13 | |||
| 24ab7796e2 | |||
| b6dd44cf9f | |||
| 4e7fcd8d51 | |||
| 617f324341 | |||
| 7450e1762f | |||
| d30223eb1f | |||
| 5b0f9cc954 | |||
| 85db23ee76 | |||
| 7c594bc82d | |||
| e64977f95e | |||
| 025338ae9f | |||
| e3beb6c7f8 | |||
| 98e066c712 | |||
| 11766b2fac | |||
| 7195ebb64f | |||
| aa59561dc1 | |||
| 2b145f757c |
1
.gitignore
vendored
@ -32,7 +32,6 @@
|
|||||||
/build/
|
/build/
|
||||||
|
|
||||||
# Web related
|
# Web related
|
||||||
lib/generated_plugin_registrant.dart
|
|
||||||
|
|
||||||
# Symbolication related
|
# Symbolication related
|
||||||
app.*.symbols
|
app.*.symbols
|
||||||
|
|||||||
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#Stage 1 - Install dependencies and build the app in a build environment
|
||||||
|
FROM debian:latest AS build-env
|
||||||
|
# Install flutter dependencies
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3 sed
|
||||||
|
RUN apt-get clean
|
||||||
|
# Clone the flutter repo
|
||||||
|
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
|
||||||
|
# Set flutter path
|
||||||
|
ENV PATH="${PATH}:/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin"
|
||||||
|
# Run flutter doctor
|
||||||
|
RUN flutter doctor -v
|
||||||
|
RUN flutter channel master
|
||||||
|
RUN flutter upgrade
|
||||||
|
# Copy files to container and build
|
||||||
|
RUN mkdir /app/
|
||||||
|
COPY . /app/
|
||||||
|
WORKDIR /app/
|
||||||
|
RUN flutter build web
|
||||||
|
#--no-sound-null-safety
|
||||||
|
# Stage 2 - Create the run-time image
|
||||||
|
FROM nginx:1.21.1-alpine
|
||||||
|
COPY --from=build-env /app/build/web /usr/share/nginx/html
|
||||||
14
README.md
@ -15,14 +15,24 @@ For help getting started with Flutter, view our
|
|||||||
[online documentation](https://flutter.dev/docs), which offers tutorials,
|
[online documentation](https://flutter.dev/docs), which offers tutorials,
|
||||||
samples, guidance on mobile development, and a full API reference.
|
samples, guidance on mobile development, and a full API reference.
|
||||||
|
|
||||||
# Model generation via command line
|
# Ancienne version de generation = Model generation via command line
|
||||||
|
|
||||||
java -cp openapi-generator-cli-5.1.0.jar org.openapitools.codegen.OpenAPIGenerator generate -i swagger.yaml --additional-properties pubName=managerapi -g dart --enable-post-process-file
|
java -cp openapi-generator-cli-5.1.0.jar org.openapitools.codegen.OpenAPIGenerator generate -i swagger.yaml --additional-properties pubName=managerapi -g dart --enable-post-process-file
|
||||||
|
|
||||||
=> Faudrait mettre à jour le projet avec les nouvelles versions plugins
|
# OPENAPI Generation cmd
|
||||||
|
|
||||||
|
flutter clean
|
||||||
|
|
||||||
|
flutter pub get
|
||||||
|
|
||||||
|
flutter pub run build_runner build --delete-conflicting-outputs
|
||||||
|
|
||||||
|
Le fichier est dans le projet.
|
||||||
|
|
||||||
# Publication sur docker
|
# Publication sur docker
|
||||||
|
|
||||||
|
Avant de build en docker, il faut build en web => flutter build web
|
||||||
|
|
||||||
docker build -t flutter-web .
|
docker build -t flutter-web .
|
||||||
|
|
||||||
Pour tester en local :
|
Pour tester en local :
|
||||||
|
|||||||
1
RELEASE/Version1_3/Changelog - Copy.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Ajout du Module quizz
|
||||||
26
RELEASE/Version1_3/How to deploy - Copy.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
- Create BAK folder !!
|
||||||
|
- FTP fichiers vers rpi (home/Manager_app)
|
||||||
|
- puis mv -v /home/ubuntu/Manager_app/* /var/www/html/manager/
|
||||||
|
- Changer nginx : etc/nginx/sites-enabled
|
||||||
|
- Changer le port du service vers le 5002
|
||||||
|
- Ajouter ou décommenter (check addresse ip):
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 8080;
|
||||||
|
listen [::]:8080;
|
||||||
|
|
||||||
|
server_name 192.168.31.96;
|
||||||
|
|
||||||
|
root /var/www/html/manager;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- Tester nginx : sudo nginx -t
|
||||||
|
- Reload nginx : sudo systemctl reload nginx
|
||||||
|
|
||||||
|
Connect manager via http://192.168.1.19:8089 => Si pas ça, peut aller changer dans le main.dart.js puis faire un CTRL MAJ R
|
||||||
1
RELEASE/Version1_3/WEB - Copy/.last_build_id
Normal file
@ -0,0 +1 @@
|
|||||||
|
2850532bac056cc3a4316af3c232a077
|
||||||
1
RELEASE/Version1_3/WEB - Copy/assets/AssetManifest.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"assets/animations/MDLF_animation.flr":["assets/animations/MDLF_animation.flr"],"assets/files/session.json":["assets/files/session.json"],"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"]}
|
||||||
1
RELEASE/Version1_3/WEB - Copy/assets/FontManifest.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.otf"}]},{"family":"packages/cupertino_icons/CupertinoIcons","fonts":[{"asset":"packages/cupertino_icons/assets/CupertinoIcons.ttf"}]}]
|
||||||
16755
RELEASE/Version1_3/WEB - Copy/assets/NOTICES
Normal file
BIN
RELEASE/Version1_3/WEB - Copy/favicon.png
Normal file
|
After Width: | Height: | Size: 917 B |
219
RELEASE/Version1_3/WEB - Copy/flutter_service_worker.js
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
'use strict';
|
||||||
|
const MANIFEST = 'flutter-app-manifest';
|
||||||
|
const TEMP = 'flutter-temp-cache';
|
||||||
|
const CACHE_NAME = 'flutter-app-cache';
|
||||||
|
const RESOURCES = {
|
||||||
|
"assets/AssetManifest.json": "7ceda6dd13738309d0b4d4d2702b3010",
|
||||||
|
"assets/assets/animations/MDLF_animation.flr": "5151e91ce20a70dbc097f01a7ec97497",
|
||||||
|
"assets/assets/files/session.json": "d41d8cd98f00b204e9800998ecf8427e",
|
||||||
|
"assets/FontManifest.json": "dc3d03800ccca4601324923c0b1d6d57",
|
||||||
|
"assets/fonts/MaterialIcons-Regular.otf": "4e6447691c9509f7acdbf8a931a85ca1",
|
||||||
|
"assets/NOTICES": "838205c3fa2fbd0319ce48d7c8347af6",
|
||||||
|
"assets/packages/cupertino_icons/assets/CupertinoIcons.ttf": "6d342eb68f170c97609e9da345464e5e",
|
||||||
|
"favicon.png": "5dcef449791fa27946b3d35ad8803796",
|
||||||
|
"icons/android-icon-144x144.png": "25849c1de85e1ac87dfde295a6c97dfe",
|
||||||
|
"icons/android-icon-192x192.png": "2f38b513d97a00ddf494059260c193b5",
|
||||||
|
"icons/android-icon-36x36.png": "5317b23569b5976037738ae5dec04859",
|
||||||
|
"icons/android-icon-48x48.png": "1f7a48a32ed8b3d4c1e6fa7734534fc7",
|
||||||
|
"icons/android-icon-72x72.png": "6db0636ec0c228480197e362f3f32fe5",
|
||||||
|
"icons/android-icon-96x96.png": "d925090c0a2f6b1a24078a8640fb18e4",
|
||||||
|
"icons/apple-icon-114x114.png": "ddd67f65d43fb30b64ebf7b3ff702427",
|
||||||
|
"icons/apple-icon-120x120.png": "b6bee39cb32e80068c5e1e87c600ffbc",
|
||||||
|
"icons/apple-icon-144x144.png": "25849c1de85e1ac87dfde295a6c97dfe",
|
||||||
|
"icons/apple-icon-152x152.png": "42b1ae2dedce452961803388468d6eae",
|
||||||
|
"icons/apple-icon-180x180.png": "17655db1c0eaff334ff6208d302a576a",
|
||||||
|
"icons/apple-icon-57x57.png": "ffd9c2b4dfe93b5874edbef7a3829495",
|
||||||
|
"icons/apple-icon-60x60.png": "5984c1c3aca2b357f604855446cf30f5",
|
||||||
|
"icons/apple-icon-72x72.png": "6db0636ec0c228480197e362f3f32fe5",
|
||||||
|
"icons/apple-icon-76x76.png": "45bb7aabc4d7211f0ee13c77e6300ec4",
|
||||||
|
"icons/apple-icon-precomposed.png": "9cd7f52d632b4bb32f3b701eed4ec663",
|
||||||
|
"icons/apple-icon.png": "9cd7f52d632b4bb32f3b701eed4ec663",
|
||||||
|
"icons/browserconfig.xml": "653d077300a12f09a69caeea7a8947f8",
|
||||||
|
"icons/favicon-16x16.png": "4fca1fd9f6c90305df787a99fe7abf62",
|
||||||
|
"icons/favicon-32x32.png": "e78cf52bb5861c5829d6f2b63e0f703e",
|
||||||
|
"icons/favicon-96x96.png": "91b367951bf21712259a3aa598456d29",
|
||||||
|
"icons/favicon.ico": "941f61fe5dd76ff538f9fd9456705d7a",
|
||||||
|
"icons/Icon-192.png": "ac9a721a12bbc803b44f645561ecb1e1",
|
||||||
|
"icons/Icon-512.png": "96e752610906ba2a93c65f8abe1645f1",
|
||||||
|
"icons/manifest.json": "b58fcfa7628c9205cb11a1b2c3e8f99a",
|
||||||
|
"icons/ms-icon-144x144.png": "7f185a22f8c85fb7ccd97cd7711214e5",
|
||||||
|
"icons/ms-icon-150x150.png": "5e33aababf68472e0bcc89c752e33fec",
|
||||||
|
"icons/ms-icon-310x310.png": "9eace62e32aec3853604ae2919eca0ea",
|
||||||
|
"icons/ms-icon-70x70.png": "6720855c40d6a5ba6cd4a384605fc270",
|
||||||
|
"index.html": "b934f3f00758439d39e79bff55598ca7",
|
||||||
|
"/": "b934f3f00758439d39e79bff55598ca7",
|
||||||
|
"main.dart.js": "d92d406acbbcdeb9b4675562b75a0cd3",
|
||||||
|
"manifest.json": "2ea69ab3cf494be775c9c65d32512a45",
|
||||||
|
"version.json": "c659aa18797537bf2ce076aa3126b86e"
|
||||||
|
};
|
||||||
|
|
||||||
|
// The application shell files that are downloaded before a service worker can
|
||||||
|
// start.
|
||||||
|
const CORE = [
|
||||||
|
"/",
|
||||||
|
"main.dart.js",
|
||||||
|
"index.html",
|
||||||
|
"assets/NOTICES",
|
||||||
|
"assets/AssetManifest.json",
|
||||||
|
"assets/FontManifest.json"];
|
||||||
|
// During install, the TEMP cache is populated with the application shell files.
|
||||||
|
self.addEventListener("install", (event) => {
|
||||||
|
self.skipWaiting();
|
||||||
|
return event.waitUntil(
|
||||||
|
caches.open(TEMP).then((cache) => {
|
||||||
|
return cache.addAll(
|
||||||
|
CORE.map((value) => new Request(value, {'cache': 'reload'})));
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// During activate, the cache is populated with the temp files downloaded in
|
||||||
|
// install. If this service worker is upgrading from one with a saved
|
||||||
|
// MANIFEST, then use this to retain unchanged resource files.
|
||||||
|
self.addEventListener("activate", function(event) {
|
||||||
|
return event.waitUntil(async function() {
|
||||||
|
try {
|
||||||
|
var contentCache = await caches.open(CACHE_NAME);
|
||||||
|
var tempCache = await caches.open(TEMP);
|
||||||
|
var manifestCache = await caches.open(MANIFEST);
|
||||||
|
var manifest = await manifestCache.match('manifest');
|
||||||
|
// When there is no prior manifest, clear the entire cache.
|
||||||
|
if (!manifest) {
|
||||||
|
await caches.delete(CACHE_NAME);
|
||||||
|
contentCache = await caches.open(CACHE_NAME);
|
||||||
|
for (var request of await tempCache.keys()) {
|
||||||
|
var response = await tempCache.match(request);
|
||||||
|
await contentCache.put(request, response);
|
||||||
|
}
|
||||||
|
await caches.delete(TEMP);
|
||||||
|
// Save the manifest to make future upgrades efficient.
|
||||||
|
await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var oldManifest = await manifest.json();
|
||||||
|
var origin = self.location.origin;
|
||||||
|
for (var request of await contentCache.keys()) {
|
||||||
|
var key = request.url.substring(origin.length + 1);
|
||||||
|
if (key == "") {
|
||||||
|
key = "/";
|
||||||
|
}
|
||||||
|
// If a resource from the old manifest is not in the new cache, or if
|
||||||
|
// the MD5 sum has changed, delete it. Otherwise the resource is left
|
||||||
|
// in the cache and can be reused by the new service worker.
|
||||||
|
if (!RESOURCES[key] || RESOURCES[key] != oldManifest[key]) {
|
||||||
|
await contentCache.delete(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Populate the cache with the app shell TEMP files, potentially overwriting
|
||||||
|
// cache files preserved above.
|
||||||
|
for (var request of await tempCache.keys()) {
|
||||||
|
var response = await tempCache.match(request);
|
||||||
|
await contentCache.put(request, response);
|
||||||
|
}
|
||||||
|
await caches.delete(TEMP);
|
||||||
|
// Save the manifest to make future upgrades efficient.
|
||||||
|
await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES)));
|
||||||
|
return;
|
||||||
|
} catch (err) {
|
||||||
|
// On an unhandled exception the state of the cache cannot be guaranteed.
|
||||||
|
console.error('Failed to upgrade service worker: ' + err);
|
||||||
|
await caches.delete(CACHE_NAME);
|
||||||
|
await caches.delete(TEMP);
|
||||||
|
await caches.delete(MANIFEST);
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
});
|
||||||
|
|
||||||
|
// The fetch handler redirects requests for RESOURCE files to the service
|
||||||
|
// worker cache.
|
||||||
|
self.addEventListener("fetch", (event) => {
|
||||||
|
if (event.request.method !== 'GET') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var origin = self.location.origin;
|
||||||
|
var key = event.request.url.substring(origin.length + 1);
|
||||||
|
// Redirect URLs to the index.html
|
||||||
|
if (key.indexOf('?v=') != -1) {
|
||||||
|
key = key.split('?v=')[0];
|
||||||
|
}
|
||||||
|
if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '') {
|
||||||
|
key = '/';
|
||||||
|
}
|
||||||
|
// If the URL is not the RESOURCE list then return to signal that the
|
||||||
|
// browser should take over.
|
||||||
|
if (!RESOURCES[key]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If the URL is the index.html, perform an online-first request.
|
||||||
|
if (key == '/') {
|
||||||
|
return onlineFirst(event);
|
||||||
|
}
|
||||||
|
event.respondWith(caches.open(CACHE_NAME)
|
||||||
|
.then((cache) => {
|
||||||
|
return cache.match(event.request).then((response) => {
|
||||||
|
// Either respond with the cached resource, or perform a fetch and
|
||||||
|
// lazily populate the cache.
|
||||||
|
return response || fetch(event.request).then((response) => {
|
||||||
|
cache.put(event.request, response.clone());
|
||||||
|
return response;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('message', (event) => {
|
||||||
|
// SkipWaiting can be used to immediately activate a waiting service worker.
|
||||||
|
// This will also require a page refresh triggered by the main worker.
|
||||||
|
if (event.data === 'skipWaiting') {
|
||||||
|
self.skipWaiting();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.data === 'downloadOffline') {
|
||||||
|
downloadOffline();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Download offline will check the RESOURCES for all files not in the cache
|
||||||
|
// and populate them.
|
||||||
|
async function downloadOffline() {
|
||||||
|
var resources = [];
|
||||||
|
var contentCache = await caches.open(CACHE_NAME);
|
||||||
|
var currentContent = {};
|
||||||
|
for (var request of await contentCache.keys()) {
|
||||||
|
var key = request.url.substring(origin.length + 1);
|
||||||
|
if (key == "") {
|
||||||
|
key = "/";
|
||||||
|
}
|
||||||
|
currentContent[key] = true;
|
||||||
|
}
|
||||||
|
for (var resourceKey of Object.keys(RESOURCES)) {
|
||||||
|
if (!currentContent[resourceKey]) {
|
||||||
|
resources.push(resourceKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return contentCache.addAll(resources);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to download the resource online before falling back to
|
||||||
|
// the offline cache.
|
||||||
|
function onlineFirst(event) {
|
||||||
|
return event.respondWith(
|
||||||
|
fetch(event.request).then((response) => {
|
||||||
|
return caches.open(CACHE_NAME).then((cache) => {
|
||||||
|
cache.put(event.request, response.clone());
|
||||||
|
return response;
|
||||||
|
});
|
||||||
|
}).catch((error) => {
|
||||||
|
return caches.open(CACHE_NAME).then((cache) => {
|
||||||
|
return cache.match(event.request).then((response) => {
|
||||||
|
if (response != null) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/android-icon-144x144.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/android-icon-192x192.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/android-icon-36x36.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/android-icon-48x48.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/android-icon-72x72.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/android-icon-96x96.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-114x114.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-120x120.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-144x144.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-152x152.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-180x180.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-57x57.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-60x60.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-72x72.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-76x76.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon-precomposed.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/apple-icon.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
2
RELEASE/Version1_3/WEB - Copy/icons/browserconfig.xml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig>
|
||||||
BIN
RELEASE/Version1_3/WEB - Copy/icons/favicon-16x16.png
Normal file
|
After Width: | Height: | Size: 826 B |
BIN
RELEASE/Version1_3/WEB - Copy/icons/favicon-32x32.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/favicon-96x96.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/favicon.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
41
RELEASE/Version1_3/WEB - Copy/icons/manifest.json
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"name": "App",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "\/android-icon-36x36.png",
|
||||||
|
"sizes": "36x36",
|
||||||
|
"type": "image\/png",
|
||||||
|
"density": "0.75"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "\/android-icon-48x48.png",
|
||||||
|
"sizes": "48x48",
|
||||||
|
"type": "image\/png",
|
||||||
|
"density": "1.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "\/android-icon-72x72.png",
|
||||||
|
"sizes": "72x72",
|
||||||
|
"type": "image\/png",
|
||||||
|
"density": "1.5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "\/android-icon-96x96.png",
|
||||||
|
"sizes": "96x96",
|
||||||
|
"type": "image\/png",
|
||||||
|
"density": "2.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "\/android-icon-144x144.png",
|
||||||
|
"sizes": "144x144",
|
||||||
|
"type": "image\/png",
|
||||||
|
"density": "3.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "\/android-icon-192x192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image\/png",
|
||||||
|
"density": "4.0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
BIN
RELEASE/Version1_3/WEB - Copy/icons/ms-icon-144x144.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/ms-icon-150x150.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/ms-icon-310x310.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
RELEASE/Version1_3/WEB - Copy/icons/ms-icon-70x70.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
115
RELEASE/Version1_3/WEB - Copy/index.html
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<!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
|
||||||
|
-->
|
||||||
|
<base href="/">
|
||||||
|
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||||
|
<meta name="description" content="A new Flutter application.">
|
||||||
|
|
||||||
|
<!-- iOS meta tags & icons -->
|
||||||
|
<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="manager_app">
|
||||||
|
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="57x57" href="icons/apple-icon-57x57.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="60x60" href="icons/apple-icon-60x60.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="72x72" href="icons/apple-icon-72x72.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="76x76" href="icons/apple-icon-76x76.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="114x114" href="icons/apple-icon-114x114.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="120x120" href="icons/apple-icon-120x120.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="144x144" href="icons/apple-icon-144x144.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="152x152" href="icons/apple-icon-152x152.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="icons/apple-icon-180x180.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="192x192" href="icons/android-icon-192x192.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/manifest.json">
|
||||||
|
<meta name="msapplication-TileColor" content="#ffffff">
|
||||||
|
<meta name="msapplication-TileImage" content="icons/ms-icon-144x144.png">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
|
||||||
|
<title>manager_app</title>
|
||||||
|
<link rel="manifest" href="manifest.json">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- This script installs service_worker.js to provide PWA functionality to
|
||||||
|
application. For more information, see:
|
||||||
|
https://developers.google.com/web/fundamentals/primers/service-workers -->
|
||||||
|
<script>
|
||||||
|
var serviceWorkerVersion = '3552968134';
|
||||||
|
var scriptLoaded = false;
|
||||||
|
function loadMainDartJs() {
|
||||||
|
if (scriptLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
scriptLoaded = true;
|
||||||
|
var scriptTag = document.createElement('script');
|
||||||
|
scriptTag.src = 'main.dart.js';
|
||||||
|
scriptTag.type = 'application/javascript';
|
||||||
|
document.body.append(scriptTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
// Service workers are supported. Use them.
|
||||||
|
window.addEventListener('load', function () {
|
||||||
|
// Wait for registration to finish before dropping the <script> tag.
|
||||||
|
// Otherwise, the browser will load the script multiple times,
|
||||||
|
// potentially different versions.
|
||||||
|
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
|
||||||
|
navigator.serviceWorker.register(serviceWorkerUrl)
|
||||||
|
.then((reg) => {
|
||||||
|
function waitForActivation(serviceWorker) {
|
||||||
|
serviceWorker.addEventListener('statechange', () => {
|
||||||
|
if (serviceWorker.state == 'activated') {
|
||||||
|
console.log('Installed new service worker.');
|
||||||
|
loadMainDartJs();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!reg.active && (reg.installing || reg.waiting)) {
|
||||||
|
// No active web worker and we have installed or are installing
|
||||||
|
// one for the first time. Simply wait for it to activate.
|
||||||
|
waitForActivation(reg.installing ?? reg.waiting);
|
||||||
|
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
|
||||||
|
// When the app updates the serviceWorkerVersion changes, so we
|
||||||
|
// need to ask the service worker to update.
|
||||||
|
console.log('New service worker available.');
|
||||||
|
reg.update();
|
||||||
|
waitForActivation(reg.installing);
|
||||||
|
} else {
|
||||||
|
// Existing service worker is still good.
|
||||||
|
console.log('Loading app from service worker.');
|
||||||
|
loadMainDartJs();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If service worker doesn't succeed in a reasonable amount of time,
|
||||||
|
// fallback to plaint <script> tag.
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!scriptLoaded) {
|
||||||
|
console.warn(
|
||||||
|
'Failed to load app from service worker. Falling back to plain <script> tag.',
|
||||||
|
);
|
||||||
|
loadMainDartJs();
|
||||||
|
}
|
||||||
|
}, 4000);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Service workers not supported. Just drop the <script> tag.
|
||||||
|
loadMainDartJs();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
101782
RELEASE/Version1_3/WEB - Copy/main.dart.js
Normal file
59
RELEASE/Version1_3/WEB - Copy/manifest.json
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"name": "Manager app",
|
||||||
|
"short_name": "Manager_app",
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"background_color": "#0175C2",
|
||||||
|
"theme_color": "#0175C2",
|
||||||
|
"description": "Manager application for MDLF",
|
||||||
|
"orientation": "portrait-primary",
|
||||||
|
"prefer_related_applications": false,
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "icons/android-icon-36x36.png",
|
||||||
|
"sizes": "36x36",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "0.75"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/android-icon-48x48.png",
|
||||||
|
"sizes": "48x48",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "1.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/android-icon-72x72.png",
|
||||||
|
"sizes": "72x72",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "1.5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/android-icon-96x96.png",
|
||||||
|
"sizes": "96x96",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "2.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/android-icon-144x144.png",
|
||||||
|
"sizes": "144x144",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "3.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/android-icon-192x192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png",
|
||||||
|
"density": "4.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/Icon-192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/Icon-512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
1
RELEASE/Version1_3/WEB - Copy/version.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"app_name":"manager_app","version":"1.0.0","build_number":"1","package_name":"manager_app"}
|
||||||
111
assets/files/policy_page.html
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<h1>Privacy Policy</h1>
|
||||||
|
<p>Effective date: 2023-02-20</p>
|
||||||
|
<p>Updated on: 2023-02-20</p>
|
||||||
|
<p>
|
||||||
|
This Privacy Policy explains the policies of UNOV on the collection
|
||||||
|
and use of the information we collect when you access https://fortsaintheribert.mymuseum.be/ (the “Service”). This Privacy Policy describes your
|
||||||
|
privacy rights and how you are protected under privacy laws.</p>
|
||||||
|
<p>
|
||||||
|
By using our Service, you are consenting to the collection and use of your information in accordance
|
||||||
|
with this Privacy Policy. Please do not access or use our Service if you do not consent to the collection
|
||||||
|
and use of your information as outlined in this Privacy Policy. This Privacy Policy has been created with
|
||||||
|
the help of <a target="_blank" href="https://cookie-script.com/privacy-policy-generator">CookieScript Privacy Policy Generator</a>.</p>
|
||||||
|
<p>UNOV is authorized to modify this Privacy Policy at any time.
|
||||||
|
This may occur without prior notice.</p>
|
||||||
|
<p>
|
||||||
|
UNOV will post the revised Privacy Policy on the https://fortsaintheribert.mymuseum.be/ website</p>
|
||||||
|
|
||||||
|
<h3>Collection and Use of Your Personal Information</h3>
|
||||||
|
<h4>Information We Collect</h4>
|
||||||
|
<p>
|
||||||
|
When using our Service, you will be prompted to provide us with personal information used to
|
||||||
|
contact or identify you. https://fortsaintheribert.mymuseum.be/ collects the following information: </p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Usage Data</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>Usage Data includes the following:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Internet Protocol (IP) address of computers accessing the site</li>
|
||||||
|
<li>Web page requests</li>
|
||||||
|
<li>Referring web pages</li>
|
||||||
|
<li>Browser used to access site</li>
|
||||||
|
<li>Time and date of access</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4>How We Collect Information</h4>
|
||||||
|
<p>
|
||||||
|
https://fortsaintheribert.mymuseum.be/ collects and receives information from you in the following manner: </p>
|
||||||
|
<ul>
|
||||||
|
<li>When you fill a registration form or otherwise submit your personal information.</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
Your information will be stored for up to 1 days after it is
|
||||||
|
no longer required to provide you the services. Your information may be retained for longer periods for
|
||||||
|
reporting or record- keeping in accordance with applicable laws. Information which does not identify you
|
||||||
|
personally may be stored indefinitely. </p>
|
||||||
|
|
||||||
|
<h4>How We Use Your Information</h4>
|
||||||
|
<p>
|
||||||
|
https://fortsaintheribert.mymuseum.be/ may use your information for the following purposes: </p>
|
||||||
|
<ul>
|
||||||
|
<li><b>Providing and maintaining our Service,</b> as well as monitoring the usage of our Service.</li>
|
||||||
|
<li><b>For other purposes.</b> UNOV will use your information for data analysis to identify usage
|
||||||
|
trends or determine the effective of our marketing campaigns when reasonable. We will use
|
||||||
|
your information to evaluate and improve our Service, products, services, and marketing efforts.</li>
|
||||||
|
<li>Show content based on location</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4>How We Share Your Information</h4>
|
||||||
|
<p>
|
||||||
|
UNOV will share your information, when applicable, in the following situations: </p>
|
||||||
|
<ul>
|
||||||
|
<li><b>With your consent.</b> UNOV will share your information for any purpose with your explicit
|
||||||
|
consent.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4>Third-party Sharing</h4>
|
||||||
|
|
||||||
|
<p>Your information may be disclosed for additional reasons, including:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Complying with applicable laws, regulations, or court orders.</li>
|
||||||
|
<li>Responding to claims that your use of our Service violates third-party rights.</li>
|
||||||
|
<li>Enforcing agreements you make with us, including this Privacy Policy.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4>Cookies</h4>
|
||||||
|
<p>
|
||||||
|
Cookies are small text files that are placed on your computer by websites that you visit. Websites use
|
||||||
|
cookies to help users navigate efficiently and perform certain functions. Cookies that are required for
|
||||||
|
the website to operate properly are allowed to be set without your permission. All other cookies need
|
||||||
|
to be approved before they can be set in the browser. </p>
|
||||||
|
<ul>
|
||||||
|
<li><b>Strictly necessary cookies.</b> Strictly necessary cookies allow core website functionality such as
|
||||||
|
user login and account management. The website cannot be used properly without strictly necessary cookies.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<h4>Security</h4>
|
||||||
|
<p>
|
||||||
|
Your information’s security is important to us. https://fortsaintheribert.mymuseum.be/
|
||||||
|
utilizes a range of security measures to prevent the misuse, loss, or alteration of the information you have given us.
|
||||||
|
However, because we cannot guarantee the security of the information you provide us, you must access our service at your
|
||||||
|
own risk. </p>
|
||||||
|
<p>
|
||||||
|
UNOV is not responsible for the performance of websites
|
||||||
|
operated by third parties or your interactions with them. When you leave this website, we recommend you review the
|
||||||
|
privacy practices of other websites you interact with and determine the adequacy of those practices. </p>
|
||||||
|
|
||||||
|
<h4>Contact Us</h4>
|
||||||
|
<p>For any questions, please contact us through the following methods:</p>
|
||||||
|
<p>Name: UNOV</p>
|
||||||
|
<p>Address: Rue Mazy 72</p>
|
||||||
|
<p>Email: contact@unov.be</p>
|
||||||
|
<p>Website: https://fortsaintheribert.mymuseum.be/</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
For any queries or concerns you have related to the processing of your information,
|
||||||
|
you may contact our Privacy Officer at Fransolet Thomas, contact@unov.be. </p>
|
||||||
|
|
||||||
100
assets/files/policy_text.text
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
PRIVACY POLICY
|
||||||
|
|
||||||
|
Effective date: 2023-02-20
|
||||||
|
|
||||||
|
Updated on: 2023-02-20
|
||||||
|
|
||||||
|
This Privacy Policy explains the policies of UNOV on the collection and use of the information we collect when you use the mobile app "Fort de Saint-Héribert". This Privacy Policy describes your privacy rights and how you are protected under privacy laws.
|
||||||
|
|
||||||
|
By using our Service, you are consenting to the collection and use of your information in accordance with this Privacy Policy. Please do not access or use our
|
||||||
|
Service if you do not consent to the collection and use of your information as outlined in this Privacy Policy. This Privacy Policy has been created with the
|
||||||
|
help of CookieScript Privacy Policy Generator.
|
||||||
|
|
||||||
|
UNOV is authorized to modify this Privacy Policy at any time. This may occur without prior notice.
|
||||||
|
|
||||||
|
UNOV will post the revised Privacy Policy on the https://fortsaintheribert.mymuseum.be/ website
|
||||||
|
|
||||||
|
|
||||||
|
COLLECTION AND USE OF YOUR PERSONAL INFORMATION
|
||||||
|
|
||||||
|
INFORMATION WE COLLECT
|
||||||
|
|
||||||
|
When using our Service, you will be prompted to provide us with personal information used to contact or identify you. The mobile app "Fort de Saint-Héribert" collects the following information:
|
||||||
|
|
||||||
|
* Usage Data
|
||||||
|
* User location but briefly and only to show content in app. This location data is not store or send to other services. The collection of location data also occurs in background.
|
||||||
|
|
||||||
|
|
||||||
|
Usage Data includes the following:
|
||||||
|
|
||||||
|
* Internet Protocol (IP) address of computers accessing the site
|
||||||
|
* Web page requests
|
||||||
|
* Referring web pages
|
||||||
|
* Browser used to access site
|
||||||
|
* Time and date of access
|
||||||
|
|
||||||
|
HOW WE COLLECT INFORMATION
|
||||||
|
|
||||||
|
The mobile app "Fort de Saint-Héribert" collects and receives information from you in the following manner:
|
||||||
|
|
||||||
|
* When you fill a registration form or otherwise submit your personal information.
|
||||||
|
|
||||||
|
Your information will be stored for up to 1 days after it is no longer required to provide you the services. Your information may be retained for longer periods
|
||||||
|
for reporting or record- keeping in accordance with applicable laws. Information which does not identify you personally may be stored indefinitely.
|
||||||
|
|
||||||
|
HOW WE USE YOUR INFORMATION
|
||||||
|
|
||||||
|
The mobile app "Fort de Saint-Héribert" may use your information for the following purposes:
|
||||||
|
|
||||||
|
* Providing and maintaining our Service, as well as monitoring the usage of our Service.
|
||||||
|
* For other purposes. UNOV will use your information for data analysis to identify usage trends or determine the effective of our marketing campaigns when
|
||||||
|
reasonable. We will use your information to evaluate and improve our Service, products, services, and marketing efforts.
|
||||||
|
* As explained before, only to show content based on location (The collection of location data also occurs in background)
|
||||||
|
|
||||||
|
HOW WE SHARE YOUR INFORMATION
|
||||||
|
|
||||||
|
UNOV will share your information, when applicable, in the following situations:
|
||||||
|
|
||||||
|
* With your consent. UNOV will share your information for any purpose with your explicit consent.
|
||||||
|
|
||||||
|
THIRD-PARTY SHARING
|
||||||
|
|
||||||
|
Your information may be disclosed for additional reasons, including:
|
||||||
|
|
||||||
|
* Complying with applicable laws, regulations, or court orders.
|
||||||
|
* Responding to claims that your use of our Service violates third-party rights.
|
||||||
|
* Enforcing agreements you make with us, including this Privacy Policy.
|
||||||
|
|
||||||
|
COOKIES
|
||||||
|
|
||||||
|
Cookies are small text files that are placed on your computer by websites that you visit. Websites use cookies to help users navigate efficiently and perform
|
||||||
|
certain functions. Cookies that are required for the website to operate properly are allowed to be set without your permission. All other cookies need to be
|
||||||
|
approved before they can be set in the browser.
|
||||||
|
|
||||||
|
* Strictly necessary cookies. Strictly necessary cookies allow core website functionality such as user login and account management. The website cannot be used
|
||||||
|
properly without strictly necessary cookies.
|
||||||
|
|
||||||
|
SECURITY
|
||||||
|
|
||||||
|
Your information’s security is important to us. The mobile app "Fort de Saint-Héribert" utilizes a range of security measures to prevent the misuse, loss, or
|
||||||
|
alteration of the information you have given us. However, because we cannot guarantee the security of the information you provide us, you must access our
|
||||||
|
service at your own risk.
|
||||||
|
|
||||||
|
UNOV is not responsible for the performance of websites operated by third parties or your interactions with them. When you leave this website, we recommend you
|
||||||
|
review the privacy practices of other websites you interact with and determine the adequacy of those practices.
|
||||||
|
|
||||||
|
CONTACT US
|
||||||
|
|
||||||
|
For any questions, please contact us through the following methods:
|
||||||
|
|
||||||
|
Name: UNOV
|
||||||
|
|
||||||
|
Address: Rue Mazy 72
|
||||||
|
|
||||||
|
Email: contact@unov.be
|
||||||
|
|
||||||
|
Website: https://fortsaintheribert.mymuseum.be/
|
||||||
|
|
||||||
|
Mobile Application : "Fort de Saint-Héribert"
|
||||||
|
|
||||||
|
For any queries or concerns you have related to the processing of your information, you may contact our Privacy Officer at Fransolet Thomas, contact@unov.be.
|
||||||
BIN
assets/fonts/OpenSans-Medium.ttf
Normal file
167
lib/Components/audio_input_container.dart
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/Components/loading_common.dart';
|
||||||
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
|
import 'package:manager_app/app_context.dart';
|
||||||
|
import 'package:manager_app/constants.dart';
|
||||||
|
import 'package:manager_app/Screens/Resources/select_resource_modal.dart';
|
||||||
|
import 'package:manager_api_new/api.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class AudioInputContainer extends StatefulWidget {
|
||||||
|
final Color color;
|
||||||
|
final String label;
|
||||||
|
final String? initialValue;
|
||||||
|
final ValueChanged<ResourceDTO> onChanged;
|
||||||
|
final BoxFit imageFit;
|
||||||
|
final bool isSmall;
|
||||||
|
final double fontSize;
|
||||||
|
const AudioInputContainer({
|
||||||
|
Key? key,
|
||||||
|
this.color = kSecond,
|
||||||
|
required this.label,
|
||||||
|
this.initialValue,
|
||||||
|
required this.onChanged,
|
||||||
|
this.imageFit = BoxFit.cover,
|
||||||
|
this.isSmall = false,
|
||||||
|
this.fontSize = 20
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AudioInputContainerState createState() => _AudioInputContainerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AudioInputContainerState extends State<AudioInputContainer> {
|
||||||
|
String? resourceIdToShow;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
resourceIdToShow = widget.initialValue;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
return Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: AlignmentDirectional.centerStart,
|
||||||
|
child: AutoSizeText(
|
||||||
|
widget.label!,
|
||||||
|
style: TextStyle(fontSize: widget.fontSize, fontWeight: FontWeight.w300),
|
||||||
|
maxLines: 2,
|
||||||
|
maxFontSize: widget.fontSize,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
//color: widget.isSmall ? Colors.cyanAccent: Colors.red,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(left: widget.isSmall ? 5 : 10, top: 10, bottom: 10),
|
||||||
|
child: Container(
|
||||||
|
width: size.width *0.08,
|
||||||
|
height: size.width *0.08,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
ResourceDTO? result = await showSelectResourceModal(
|
||||||
|
"Sélectionner une ressource",
|
||||||
|
1,
|
||||||
|
[ResourceType.Audio],
|
||||||
|
context
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
setState(() {
|
||||||
|
resourceIdToShow = result.id != null ? result.id : null;
|
||||||
|
});
|
||||||
|
widget.onChanged(result);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: getElement(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getElement(BuildContext context) {
|
||||||
|
if (resourceIdToShow != null) {
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
final appContext = Provider.of<AppContext>(context);
|
||||||
|
return FutureBuilder(
|
||||||
|
future: getResource(resourceIdToShow!, appContext),
|
||||||
|
builder: (context, AsyncSnapshot<ResourceDTO?> snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
if (snapshot.data != null) {
|
||||||
|
return Container(
|
||||||
|
decoration: boxDecoration(snapshot.data!, appContext),
|
||||||
|
child: Center(child: AutoSizeText(snapshot.data!.label!, textAlign: TextAlign.center)),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Text("No data");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
|
return Text("No data");
|
||||||
|
} else {
|
||||||
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
height: size.height * 0.1,
|
||||||
|
child: LoadingCommon()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: widget.color,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
|
||||||
|
child: Center(
|
||||||
|
child: AutoSizeText(
|
||||||
|
"Choisir un fichier audio",
|
||||||
|
style: TextStyle(color: kWhite),
|
||||||
|
maxLines: 1,
|
||||||
|
)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<ResourceDTO?> getResource(String resourceIdToShow, dynamic appContext) async {
|
||||||
|
// Just in resource tab detail not here
|
||||||
|
ResourceDTO? resource = await (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.resourceGetDetail(resourceIdToShow);
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
boxDecoration(ResourceDTO resourceDTO, appContext) {
|
||||||
|
return BoxDecoration(
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
color: kWhite,
|
||||||
|
borderRadius: BorderRadius.circular(30.0),
|
||||||
|
/*image: new DecorationImage(
|
||||||
|
fit: widget.imageFit,
|
||||||
|
image: resourceDTO.type != null ? new NetworkImage(
|
||||||
|
resourceDTO.type == ResourceType.image ? appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDTO.id : resourceDTO.data,
|
||||||
|
) : null,
|
||||||
|
),*/
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
spreadRadius: 0.5,
|
||||||
|
blurRadius: 1,
|
||||||
|
offset: Offset(0, 1.5), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
242
lib/Components/audio_player.dart
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
//import 'package:audioplayers/audioplayers.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/app_context.dart';
|
||||||
|
import 'package:manager_app/constants.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'package:just_audio/just_audio.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class AudioPlayerFloatingContainer extends StatefulWidget {
|
||||||
|
const AudioPlayerFloatingContainer({Key? key, required this.audioBytes, required this.isAuto}) : super(key: key);
|
||||||
|
|
||||||
|
final Uint8List audioBytes;
|
||||||
|
final bool isAuto;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AudioPlayerFloatingContainer> createState() => _AudioPlayerFloatingContainerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AudioPlayerFloatingContainerState extends State<AudioPlayerFloatingContainer> {
|
||||||
|
AudioPlayer player = AudioPlayer();
|
||||||
|
late Uint8List audiobytes;
|
||||||
|
bool isplaying = false;
|
||||||
|
bool audioplayed = false;
|
||||||
|
int currentpos = 0;
|
||||||
|
int maxduration = 100;
|
||||||
|
Duration? durationAudio;
|
||||||
|
String currentpostlabel = "00:00";
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
Future.delayed(Duration.zero, () async {
|
||||||
|
|
||||||
|
audiobytes = widget.audioBytes;
|
||||||
|
player.durationStream.listen((Duration? d) { //get the duration of audio
|
||||||
|
if(d != null) {
|
||||||
|
maxduration = d.inSeconds;
|
||||||
|
durationAudio = d;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//player.bufferedPositionStream
|
||||||
|
|
||||||
|
player.positionStream.listen((event) {
|
||||||
|
if(durationAudio != null) {
|
||||||
|
|
||||||
|
currentpos = event.inMilliseconds; //get the current position of playing audio
|
||||||
|
|
||||||
|
//generating the duration label
|
||||||
|
int shours = Duration(milliseconds:durationAudio!.inMilliseconds - currentpos).inHours;
|
||||||
|
int sminutes = Duration(milliseconds:durationAudio!.inMilliseconds - currentpos).inMinutes;
|
||||||
|
int sseconds = Duration(milliseconds:durationAudio!.inMilliseconds - currentpos).inSeconds;
|
||||||
|
|
||||||
|
int rminutes = sminutes - (shours * 60);
|
||||||
|
int rseconds = sseconds - (sminutes * 60 + shours * 60 * 60);
|
||||||
|
|
||||||
|
String minutesToShow = rminutes < 10 ? '0$rminutes': rminutes.toString();
|
||||||
|
String secondsToShow = rseconds < 10 ? '0$rseconds': rseconds.toString();
|
||||||
|
|
||||||
|
currentpostlabel = "$minutesToShow:$secondsToShow";
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
//refresh the UI
|
||||||
|
if(currentpos > player.duration!.inMilliseconds) {
|
||||||
|
print("RESET ALL");
|
||||||
|
player.stop();
|
||||||
|
player.seek(const Duration(seconds: 0));
|
||||||
|
isplaying = false;
|
||||||
|
audioplayed = false;
|
||||||
|
currentpostlabel = "00:00";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*player.onPositionChanged.listen((Duration p){
|
||||||
|
currentpos = p.inMilliseconds; //get the current position of playing audio
|
||||||
|
|
||||||
|
//generating the duration label
|
||||||
|
int shours = Duration(milliseconds:currentpos).inHours;
|
||||||
|
int sminutes = Duration(milliseconds:currentpos).inMinutes;
|
||||||
|
int sseconds = Duration(milliseconds:currentpos).inSeconds;
|
||||||
|
|
||||||
|
int rminutes = sminutes - (shours * 60);
|
||||||
|
int rseconds = sseconds - (sminutes * 60 + shours * 60 * 60);
|
||||||
|
|
||||||
|
String minutesToShow = rminutes < 10 ? '0$rminutes': rminutes.toString();
|
||||||
|
String secondsToShow = rseconds < 10 ? '0$rseconds': rseconds.toString();
|
||||||
|
|
||||||
|
currentpostlabel = "$minutesToShow:$secondsToShow";
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
//refresh the UI
|
||||||
|
});
|
||||||
|
});*/
|
||||||
|
|
||||||
|
if(widget.isAuto) {
|
||||||
|
//player.play(BytesSource(audiobytes));
|
||||||
|
await player.setAudioSource(LoadedSource(audiobytes));
|
||||||
|
player.play();
|
||||||
|
setState(() {
|
||||||
|
isplaying = true;
|
||||||
|
audioplayed = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
player.stop();
|
||||||
|
player.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final appContext = Provider.of<AppContext>(context);
|
||||||
|
|
||||||
|
return FloatingActionButton(
|
||||||
|
backgroundColor: kPrimaryColor.withOpacity(0.7),
|
||||||
|
onPressed: () async {
|
||||||
|
if(!isplaying && !audioplayed){
|
||||||
|
//player.play(BytesSource(audiobytes));
|
||||||
|
await player.setAudioSource(LoadedSource(audiobytes));
|
||||||
|
player.play();
|
||||||
|
setState(() {
|
||||||
|
isplaying = true;
|
||||||
|
audioplayed = true;
|
||||||
|
});
|
||||||
|
}else if(audioplayed && !isplaying){
|
||||||
|
//player.resume();
|
||||||
|
player.play();
|
||||||
|
setState(() {
|
||||||
|
isplaying = true;
|
||||||
|
audioplayed = true;
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
player.pause();
|
||||||
|
setState(() {
|
||||||
|
isplaying = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: isplaying ? Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.pause),
|
||||||
|
Text(currentpostlabel),
|
||||||
|
],
|
||||||
|
) : audioplayed ? Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.play_arrow),
|
||||||
|
Text(currentpostlabel),
|
||||||
|
],
|
||||||
|
): const Icon(Icons.play_arrow),
|
||||||
|
|
||||||
|
/*Column(
|
||||||
|
children: [
|
||||||
|
//Text(currentpostlabel, style: const TextStyle(fontSize: 25)),
|
||||||
|
Wrap(
|
||||||
|
spacing: 10,
|
||||||
|
children: [
|
||||||
|
ElevatedButton.icon(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: kSecondColor, // Background color
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
if(!isplaying && !audioplayed){
|
||||||
|
//player.play(BytesSource(audiobytes));
|
||||||
|
await player.setAudioSource(LoadedSource(audiobytes));
|
||||||
|
player.play();
|
||||||
|
setState(() {
|
||||||
|
isplaying = true;
|
||||||
|
audioplayed = true;
|
||||||
|
});
|
||||||
|
}else if(audioplayed && !isplaying){
|
||||||
|
//player.resume();
|
||||||
|
player.play();
|
||||||
|
setState(() {
|
||||||
|
isplaying = true;
|
||||||
|
audioplayed = true;
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
player.pause();
|
||||||
|
setState(() {
|
||||||
|
isplaying = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: Icon(isplaying?Icons.pause:Icons.play_arrow),
|
||||||
|
//label:Text(isplaying?TranslationHelper.getFromLocale("pause", appContext.getContext()):TranslationHelper.getFromLocale("play", appContext.getContext()))
|
||||||
|
),
|
||||||
|
|
||||||
|
/*ElevatedButton.icon(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: kSecondColor, // Background color
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
player.stop();
|
||||||
|
player.seek(const Duration(seconds: 0));
|
||||||
|
setState(() {
|
||||||
|
isplaying = false;
|
||||||
|
audioplayed = false;
|
||||||
|
currentpostlabel = "00:00";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.stop),
|
||||||
|
//label: Text(TranslationHelper.getFromLocale("stop", appContext.getContext()))
|
||||||
|
),*/
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),*/
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Feed your own stream of bytes into the player
|
||||||
|
class LoadedSource extends StreamAudioSource {
|
||||||
|
final List<int> bytes;
|
||||||
|
LoadedSource(this.bytes);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<StreamAudioResponse> request([int? start, int? end]) async {
|
||||||
|
start ??= 0;
|
||||||
|
end ??= bytes.length;
|
||||||
|
return StreamAudioResponse(
|
||||||
|
sourceLength: bytes.length,
|
||||||
|
contentLength: end - start,
|
||||||
|
offset: start,
|
||||||
|
stream: Stream.value(bytes.sublist(start, end)),
|
||||||
|
contentType: 'audio/mpeg',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
88
lib/Components/check_input_container.dart
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../constants.dart';
|
||||||
|
|
||||||
|
class CheckInputContainer extends StatefulWidget {
|
||||||
|
final bool? isChecked;
|
||||||
|
final IconData? icon;
|
||||||
|
final String label;
|
||||||
|
final ValueChanged<bool> onChanged;
|
||||||
|
final double fontSize;
|
||||||
|
const CheckInputContainer({
|
||||||
|
Key? key,
|
||||||
|
this.isChecked,
|
||||||
|
this.icon,
|
||||||
|
required this.label,
|
||||||
|
required this.onChanged,
|
||||||
|
this.fontSize = 20
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_CheckInputContainerState createState() => _CheckInputContainerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CheckInputContainerState extends State<CheckInputContainer> {
|
||||||
|
bool? isChecked;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
setState(() {
|
||||||
|
isChecked = widget.isChecked;
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: AlignmentDirectional.centerStart,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
if(widget.icon != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
|
child: Icon(
|
||||||
|
widget.icon,
|
||||||
|
color: kPrimaryColor,
|
||||||
|
size: 25.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if(widget.label != null)
|
||||||
|
AutoSizeText(
|
||||||
|
widget.label,
|
||||||
|
style: new TextStyle(fontSize: widget.fontSize, fontWeight: FontWeight.w300),
|
||||||
|
maxLines: 2,
|
||||||
|
maxFontSize: widget.fontSize,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: Container(
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: Checkbox(
|
||||||
|
shape: CircleBorder(),
|
||||||
|
value: isChecked,
|
||||||
|
checkColor: Colors.white,
|
||||||
|
activeColor: kPrimaryColor,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
isChecked = value;
|
||||||
|
});
|
||||||
|
widget.onChanged(value!);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,16 +1,18 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/color_picker.dart';
|
import 'package:manager_app/Components/color_picker.dart';
|
||||||
|
|
||||||
class ColorPickerInputContainer extends StatefulWidget {
|
class ColorPickerInputContainer extends StatefulWidget {
|
||||||
final String color;
|
final String? color;
|
||||||
final String label;
|
final String label;
|
||||||
|
final double fontSize;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
const ColorPickerInputContainer({
|
const ColorPickerInputContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.color,
|
this.color,
|
||||||
this.label,
|
required this.label,
|
||||||
this.onChanged,
|
this.fontSize = 25,
|
||||||
|
required this.onChanged,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -18,12 +20,12 @@ class ColorPickerInputContainer extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ColorPickerInputContainerState extends State<ColorPickerInputContainer> {
|
class _ColorPickerInputContainerState extends State<ColorPickerInputContainer> {
|
||||||
Color colorVar;
|
Color? colorVar;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
setState(() {
|
setState(() {
|
||||||
colorVar = widget.color == null ? new Color(0x12345678) : new Color(int.parse(widget.color.split('(0x')[1].split(')')[0], radix: 16));
|
colorVar = widget.color == null ? new Color(0x12345678) : new Color(int.parse(widget.color!.split('(0x')[1].split(')')[0], radix: 16));
|
||||||
});
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
@ -35,14 +37,20 @@ class _ColorPickerInputContainerState extends State<ColorPickerInputContainer> {
|
|||||||
children: [
|
children: [
|
||||||
Align(
|
Align(
|
||||||
alignment: AlignmentDirectional.centerStart,
|
alignment: AlignmentDirectional.centerStart,
|
||||||
child: Text(widget.label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300))
|
child: AutoSizeText(
|
||||||
|
widget.label,
|
||||||
|
style: TextStyle(fontSize: widget.fontSize, fontWeight: FontWeight.w300),
|
||||||
|
maxLines: 2,
|
||||||
|
maxFontSize: widget.fontSize,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showColorPicker(
|
showColorPicker(
|
||||||
colorVar,
|
colorVar!,
|
||||||
(Color color) {
|
(Color color) {
|
||||||
setState(() {
|
setState(() {
|
||||||
colorVar = color;
|
colorVar = color;
|
||||||
|
|||||||
@ -1,18 +1,21 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
IconData getResourceIcon(elementType) {
|
IconData getResourceIcon(elementType) {
|
||||||
switch(elementType) {
|
switch(elementType) {
|
||||||
case ResourceType.image:
|
case ResourceType.Image:
|
||||||
return Icons.image;
|
return Icons.image;
|
||||||
break;
|
break;
|
||||||
case ResourceType.imageUrl:
|
case ResourceType.ImageUrl:
|
||||||
return Icons.image_search; // art_track
|
return Icons.image_search; // art_track
|
||||||
break;
|
break;
|
||||||
case ResourceType.video:
|
case ResourceType.Audio:
|
||||||
|
return Icons.audiotrack; // art_track
|
||||||
|
break;
|
||||||
|
case ResourceType.Video:
|
||||||
return Icons.slow_motion_video;
|
return Icons.slow_motion_video;
|
||||||
break;
|
break;
|
||||||
case ResourceType.videoUrl:
|
case ResourceType.VideoUrl:
|
||||||
return Icons.ondemand_video_sharp;
|
return Icons.ondemand_video_sharp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,26 +1,29 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
IconData getSectionIcon(elementType) {
|
IconData getSectionIcon(elementType) {
|
||||||
switch(elementType) {
|
switch(elementType) {
|
||||||
case SectionType.map:
|
case SectionType.Map:
|
||||||
return Icons.location_on;
|
return Icons.location_on;
|
||||||
break;
|
break;
|
||||||
case SectionType.slider:
|
case SectionType.Slider:
|
||||||
return Icons.collections; // art_track
|
return Icons.collections; // art_track
|
||||||
break;
|
break;
|
||||||
case SectionType.video:
|
case SectionType.Video:
|
||||||
return Icons.ondemand_video_rounded;
|
return Icons.ondemand_video_rounded;
|
||||||
break;
|
break;
|
||||||
case SectionType.web:
|
case SectionType.Web:
|
||||||
return Icons.web;
|
return Icons.web;
|
||||||
break;
|
break;
|
||||||
case SectionType.menu:
|
case SectionType.Menu:
|
||||||
return Icons.apps_sharp;
|
return Icons.apps_sharp;
|
||||||
break;
|
break;
|
||||||
case SectionType.quizz:
|
case SectionType.Quizz:
|
||||||
return Icons.question_answer;
|
return Icons.question_answer;
|
||||||
break;
|
break;
|
||||||
|
case SectionType.Article:
|
||||||
|
return Icons.article_outlined;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return Icons.menu;
|
return Icons.menu;
|
||||||
}
|
}
|
||||||
@ -1,27 +1,30 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/loading.dart';
|
import 'package:manager_app/Components/loading_common.dart';
|
||||||
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:manager_app/Screens/Resources/select_resource_modal.dart';
|
import 'package:manager_app/Screens/Resources/select_resource_modal.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ImageInputContainer extends StatefulWidget {
|
class ImageInputContainer extends StatefulWidget {
|
||||||
final Color color;
|
final Color color;
|
||||||
final String label;
|
final String label;
|
||||||
final String initialValue;
|
final String? initialValue;
|
||||||
final ValueChanged<ResourceDTO> onChanged;
|
final ValueChanged<ResourceDTO> onChanged;
|
||||||
final BoxFit imageFit;
|
final BoxFit imageFit;
|
||||||
final bool isSmall;
|
final bool isSmall;
|
||||||
|
final double fontSize;
|
||||||
const ImageInputContainer({
|
const ImageInputContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.color = kSecond,
|
this.color = kSecond,
|
||||||
this.label,
|
required this.label,
|
||||||
this.initialValue,
|
this.initialValue,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
this.imageFit = BoxFit.cover,
|
this.imageFit = BoxFit.cover,
|
||||||
this.isSmall = false,
|
this.isSmall = false,
|
||||||
|
this.fontSize = 25
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -29,7 +32,7 @@ class ImageInputContainer extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ImageInputContainerState extends State<ImageInputContainer> {
|
class _ImageInputContainerState extends State<ImageInputContainer> {
|
||||||
String resourceIdToShow;
|
String? resourceIdToShow;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -45,29 +48,39 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
|
|||||||
children: [
|
children: [
|
||||||
Align(
|
Align(
|
||||||
alignment: AlignmentDirectional.centerStart,
|
alignment: AlignmentDirectional.centerStart,
|
||||||
child: Text(widget.label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300))
|
child: AutoSizeText(
|
||||||
|
widget.label,
|
||||||
|
style: TextStyle(fontSize: widget.fontSize, fontWeight: FontWeight.w300),
|
||||||
|
maxLines: 2,
|
||||||
|
maxFontSize: widget.fontSize,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Padding(
|
Container(
|
||||||
padding: EdgeInsets.only(left: widget.isSmall ? 15 : 70, top: 10, bottom: 10),
|
//color: widget.isSmall ? Colors.cyanAccent: Colors.red,
|
||||||
child: Container(
|
child: Padding(
|
||||||
width: size.width *0.08,
|
padding: EdgeInsets.only(left: widget.isSmall ? 5 : 10, top: 10, bottom: 10),
|
||||||
child: InkWell(
|
child: Container(
|
||||||
onTap: () async {
|
width: size.width *0.08,
|
||||||
var result = await showSelectResourceModal(
|
height: size.width *0.08,
|
||||||
"Sélectionner une ressource",
|
child: InkWell(
|
||||||
1,
|
onTap: () async {
|
||||||
true,
|
ResourceDTO? result = await showSelectResourceModal(
|
||||||
context
|
"Sélectionner une ressource",
|
||||||
);
|
1,
|
||||||
|
[ResourceType.Image, ResourceType.ImageUrl],
|
||||||
|
context
|
||||||
|
);
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
resourceIdToShow = result.id;
|
resourceIdToShow = result.id != null ? result.id : null;
|
||||||
});
|
});
|
||||||
widget.onChanged(result);
|
widget.onChanged(result);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: getElement(widget.initialValue, context, widget.isSmall),
|
child: getElement(widget.initialValue, context, widget.isSmall),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -76,26 +89,28 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getElement(String initialValue, BuildContext context, bool isSmall) {
|
getElement(String? initialValue, BuildContext context, bool isSmall) {
|
||||||
if (resourceIdToShow != null) {
|
if (resourceIdToShow != null) {
|
||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
final appContext = Provider.of<AppContext>(context);
|
final appContext = Provider.of<AppContext>(context);
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: getResource(resourceIdToShow, appContext),
|
future: getResource(resourceIdToShow!, appContext),
|
||||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
if (snapshot.data != null) {
|
if (snapshot.data != null) {
|
||||||
return Transform.scale(
|
return Container(
|
||||||
scale: isSmall ? size.aspectRatio * 0.5: size.aspectRatio * 0.9,
|
decoration: boxDecoration(snapshot.data, appContext),
|
||||||
child: AspectRatio(
|
|
||||||
aspectRatio: 4/4,
|
|
||||||
child: Container(
|
|
||||||
decoration: boxDecoration(snapshot.data, appContext),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Text("No data");
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
decoration: boxDecoration(null, appContext),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text("Aucune image"),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
@ -104,7 +119,7 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
|
|||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: size.height * 0.1,
|
height: size.height * 0.1,
|
||||||
child: Loading()
|
child: LoadingCommon()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -114,7 +129,7 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
|
|||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: widget.color,
|
color: widget.color,
|
||||||
borderRadius: BorderRadius.circular(50),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
|
padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
|
||||||
@ -130,22 +145,22 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ResourceDTO> getResource(String resourceIdToShow, dynamic appContext) async {
|
Future<ResourceDTO?> getResource(String resourceIdToShow, dynamic appContext) async {
|
||||||
ResourceDTO resource = await appContext.getContext().clientAPI.resourceApi.resourceGetDetail(resourceIdToShow);
|
ResourceDTO? resource = await (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.resourceGetDetail(resourceIdToShow);
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
boxDecoration(ResourceDTO resourceDTO, appContext) {
|
boxDecoration(ResourceDTO? resourceDTO, AppContext appContext) {
|
||||||
return BoxDecoration(
|
return BoxDecoration(
|
||||||
shape: BoxShape.rectangle,
|
shape: BoxShape.rectangle,
|
||||||
color: kWhite,
|
color: kWhite,
|
||||||
borderRadius: BorderRadius.circular(30.0),
|
borderRadius: BorderRadius.circular(30.0),
|
||||||
image: new DecorationImage(
|
image: resourceDTO != null ? resourceDTO.type != null ? new DecorationImage(
|
||||||
fit: widget.imageFit,
|
fit: widget.imageFit,
|
||||||
image: resourceDTO.type != null ? new NetworkImage(
|
image: new NetworkImage(
|
||||||
resourceDTO.type == ResourceType.image ? appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDTO.id : resourceDTO.data,
|
resourceDTO.type! == ResourceType.Image ? (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.apiClient.basePath+"/api/Resource/"+ resourceDTO.id! : resourceDTO.data!,
|
||||||
) : null,
|
),
|
||||||
),
|
) : null : null,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
spreadRadius: 0.5,
|
spreadRadius: 0.5,
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import 'package:flare_flutter/flare_actor.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class Loading extends StatelessWidget {
|
class Loading extends StatelessWidget {
|
||||||
Loading({Key key}) : super(key: key);
|
Loading({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|||||||
50
lib/Components/loading_common.dart
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/constants.dart';
|
||||||
|
|
||||||
|
class LoadingCommon extends StatefulWidget {
|
||||||
|
const LoadingCommon({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LoadingCommon> createState() => _LoadingCommonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LoadingCommonState extends State<LoadingCommon> with TickerProviderStateMixin {
|
||||||
|
AnimationController? _controller;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_controller = AnimationController(
|
||||||
|
duration: const Duration(milliseconds: 5000),
|
||||||
|
vsync: this,
|
||||||
|
)..repeat();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_controller!.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
_controller!.forward(from: 0.0);
|
||||||
|
_controller!.addListener(() {
|
||||||
|
if (_controller!.isCompleted) {
|
||||||
|
_controller!.reverse();
|
||||||
|
}
|
||||||
|
if(_controller!.isDismissed){
|
||||||
|
_controller!.forward();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return Center(
|
||||||
|
child: RotationTransition(
|
||||||
|
turns: Tween(begin: 0.0, end: 3.0).animate(_controller!),
|
||||||
|
child: Icon(Icons.museum_outlined, color: kPrimaryColor, size: size.height*0.1),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
showNotification (Color backgroundColor, Color textColor, String text, BuildContext context, int duration) {
|
showNotification (Color backgroundColor, Color textColor, String text, BuildContext context, int? duration) {
|
||||||
final snackBar = SnackBar(
|
final snackBar = SnackBar(
|
||||||
behavior: SnackBarBehavior.floating,
|
behavior: SnackBarBehavior.floating,
|
||||||
duration: duration == null ? Duration(milliseconds: 1500) : Duration(milliseconds: duration),
|
duration: duration == null ? Duration(milliseconds: 1500) : Duration(milliseconds: duration),
|
||||||
|
|||||||
@ -1,15 +1,21 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/rounded_button.dart';
|
import 'package:manager_app/Components/rounded_button.dart';
|
||||||
import 'package:manager_app/Components/text_form_input_container.dart';
|
import 'package:manager_app/Components/text_form_input_container.dart';
|
||||||
import 'package:manager_app/Models/managerContext.dart';
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
|
import 'package:manager_app/Screens/Resources/select_resource_modal.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
showMultiStringInput (String label, String modalLabel, List<TranslationDTO> values, List<TranslationDTO> newValues, Function onGetResult, int maxLines, BuildContext context) { /*Function onSelect,*/
|
import 'audio_input_container.dart';
|
||||||
|
|
||||||
|
|
||||||
|
showMultiStringInput (String label, String modalLabel, bool isTitle, List<TranslationDTO> values, List<TranslationDTO> newValues, Function onGetResult, int maxLines, bool isAudio, BuildContext context) { /*Function onSelect,*/
|
||||||
showDialog(
|
showDialog(
|
||||||
builder: (BuildContext context) => AlertDialog(
|
builder: (BuildContext context) => AlertDialog(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@ -23,7 +29,7 @@ showMultiStringInput (String label, String modalLabel, List<TranslationDTO> valu
|
|||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: getTranslations(context, Provider.of<AppContext>(context), label, newValues),
|
children: getTranslations(context, Provider.of<AppContext>(context), label, isTitle, isAudio, newValues),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -84,10 +90,10 @@ showMultiStringInput (String label, String modalLabel, List<TranslationDTO> valu
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTranslations(BuildContext context, AppContext appContext, String label, List<TranslationDTO> newValues) {
|
getTranslations(BuildContext context, AppContext appContext, String label, bool isTitle, bool isAudio, List<TranslationDTO> newValues) {
|
||||||
List<Widget> translations = <Widget>[];
|
List<Widget> translations = <Widget>[];
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
for(var language in managerAppContext.selectedConfiguration.languages) {
|
for(var language in managerAppContext.selectedConfiguration!.languages!) {
|
||||||
translations.add(
|
translations.add(
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -111,14 +117,27 @@ getTranslations(BuildContext context, AppContext appContext, String label, List<
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
!isAudio ?
|
||||||
TextFormInputContainer(
|
TextFormInputContainer(
|
||||||
label: label,
|
label: label,
|
||||||
color: kWhite,
|
color: kWhite,
|
||||||
isTitle: true,
|
isTitle: isTitle,
|
||||||
initialValue: newValues.where((element) => element.language == language).first.value,
|
initialValue: newValues.where((element) => element.language == language).first.value!,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
newValues.where((element) => element.language == language).first.value = value;
|
newValues.where((element) => element.language == language).first.value = value;
|
||||||
},
|
},
|
||||||
|
) :
|
||||||
|
Container(
|
||||||
|
width: 250,
|
||||||
|
height: 120,
|
||||||
|
child: AudioInputContainer(
|
||||||
|
label: "Audio :",
|
||||||
|
initialValue: newValues.where((element) => element.language == language).first.value,
|
||||||
|
color: kPrimaryColor,
|
||||||
|
onChanged: (ResourceDTO resource) {
|
||||||
|
newValues.where((element) => element.language == language).first.value = resource.id;
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -147,5 +166,3 @@ showValues(List<TranslationDTO> newValues) {
|
|||||||
});
|
});
|
||||||
return valuesToShow;
|
return valuesToShow;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -12,14 +12,14 @@ class MultiSelectContainer extends StatelessWidget {
|
|||||||
final bool isAtLeastOne;
|
final bool isAtLeastOne;
|
||||||
final ValueChanged<List<dynamic>> onChanged;
|
final ValueChanged<List<dynamic>> onChanged;
|
||||||
const MultiSelectContainer({
|
const MultiSelectContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.color = kSecond,
|
this.color = kSecond,
|
||||||
this.label,
|
required this.label,
|
||||||
this.values,
|
required this.values,
|
||||||
this.initialValue,
|
required this.initialValue,
|
||||||
this.isMultiple,
|
required this.isMultiple,
|
||||||
this.isAtLeastOne = false,
|
this.isAtLeastOne = false,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -64,14 +64,14 @@ class MultiSelectChip extends StatefulWidget {
|
|||||||
this.selectedValues,
|
this.selectedValues,
|
||||||
this.isMultiple,
|
this.isMultiple,
|
||||||
this.isAtLeastOne,
|
this.isAtLeastOne,
|
||||||
{this.onSelectionChanged} // +added
|
{required this.onSelectionChanged} // +added
|
||||||
);
|
);
|
||||||
@override
|
@override
|
||||||
_MultiSelectChipState createState() => _MultiSelectChipState();
|
_MultiSelectChipState createState() => _MultiSelectChipState();
|
||||||
}
|
}
|
||||||
class _MultiSelectChipState extends State<MultiSelectChip> {
|
class _MultiSelectChipState extends State<MultiSelectChip> {
|
||||||
_buildChoiceList() {
|
_buildChoiceList() {
|
||||||
List<Widget> choices = List();
|
List<Widget> choices = [];
|
||||||
widget.values.forEach((item) {
|
widget.values.forEach((item) {
|
||||||
choices.add(Container(
|
choices.add(Container(
|
||||||
padding: const EdgeInsets.all(2.0),
|
padding: const EdgeInsets.all(2.0),
|
||||||
|
|||||||
78
lib/Components/multi_select_dropdown_container.dart
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/constants.dart';
|
||||||
|
import 'package:multi_select_flutter/chip_display/multi_select_chip_display.dart';
|
||||||
|
import 'package:multi_select_flutter/dialog/multi_select_dialog_field.dart';
|
||||||
|
import 'package:multi_select_flutter/util/multi_select_item.dart';
|
||||||
|
import 'package:multi_select_flutter/util/multi_select_list_type.dart';
|
||||||
|
|
||||||
|
class MultiSelectDropdownContainer extends StatelessWidget {
|
||||||
|
final Color color;
|
||||||
|
final String label;
|
||||||
|
final List<String> values;
|
||||||
|
final List<String> initialValue;
|
||||||
|
final bool isMultiple;
|
||||||
|
final bool isAtLeastOne;
|
||||||
|
final double fontSize;
|
||||||
|
final ValueChanged<List<dynamic>> onChanged;
|
||||||
|
const MultiSelectDropdownContainer({
|
||||||
|
Key? key,
|
||||||
|
this.color = kSecond,
|
||||||
|
required this.label,
|
||||||
|
required this.values,
|
||||||
|
required this.initialValue,
|
||||||
|
required this.isMultiple,
|
||||||
|
this.isAtLeastOne = false,
|
||||||
|
this.fontSize = 25,
|
||||||
|
required this.onChanged,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
return Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: AlignmentDirectional.centerStart,
|
||||||
|
child: AutoSizeText(
|
||||||
|
label,
|
||||||
|
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.w300),
|
||||||
|
maxLines: 2,
|
||||||
|
maxFontSize: fontSize,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: Container(
|
||||||
|
width: size.width *0.2,
|
||||||
|
child: MultiSelectDialogField(
|
||||||
|
items: values.map((e) => MultiSelectItem(e, e)).toList(),
|
||||||
|
listType: MultiSelectListType.LIST,
|
||||||
|
cancelText: Text("Annuler"),
|
||||||
|
initialValue: initialValue,
|
||||||
|
buttonText: Text("Sélectionner"),
|
||||||
|
checkColor: Colors.white,
|
||||||
|
searchable: true,
|
||||||
|
chipDisplay: MultiSelectChipDisplay.none(),
|
||||||
|
selectedColor: kPrimaryColor,
|
||||||
|
title: Text("Veuillez sélectionner une langue"),
|
||||||
|
dialogHeight: size.height *0.4,
|
||||||
|
dialogWidth: size.width *0.2,
|
||||||
|
onSelectionChanged: (selectedList) {
|
||||||
|
onChanged(selectedList);
|
||||||
|
},
|
||||||
|
onConfirm: (List<dynamic> test)
|
||||||
|
{
|
||||||
|
print("onConfirm MultiSelectDialogField");
|
||||||
|
print(test);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,7 +4,7 @@ import 'package:auto_size_text/auto_size_text.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/multi_input_modal.dart';
|
import 'package:manager_app/Components/multi_input_modal.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
class MultiStringContainer extends StatelessWidget {
|
class MultiStringContainer extends StatelessWidget {
|
||||||
final Color color;
|
final Color color;
|
||||||
@ -13,14 +13,20 @@ class MultiStringContainer extends StatelessWidget {
|
|||||||
final List<TranslationDTO> initialValue;
|
final List<TranslationDTO> initialValue;
|
||||||
final Function onGetResult;
|
final Function onGetResult;
|
||||||
final int maxLines;
|
final int maxLines;
|
||||||
|
final bool isTitle;
|
||||||
|
final bool isAudio;
|
||||||
|
final double fontSize;
|
||||||
const MultiStringContainer({
|
const MultiStringContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.color = kSecond,
|
this.color = kSecond,
|
||||||
this.label,
|
required this.label,
|
||||||
this.modalLabel,
|
required this.modalLabel,
|
||||||
this.initialValue,
|
required this.initialValue,
|
||||||
this.onGetResult,
|
required this.onGetResult,
|
||||||
this.maxLines,
|
required this.maxLines,
|
||||||
|
required this.isTitle,
|
||||||
|
this.isAudio = false,
|
||||||
|
this.fontSize = 25,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -32,7 +38,13 @@ class MultiStringContainer extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Align(
|
Align(
|
||||||
alignment: AlignmentDirectional.centerStart,
|
alignment: AlignmentDirectional.centerStart,
|
||||||
child: Text(label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300))
|
child: AutoSizeText(
|
||||||
|
label,
|
||||||
|
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.w300),
|
||||||
|
maxLines: 2,
|
||||||
|
maxFontSize: fontSize,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
@ -40,12 +52,24 @@ class MultiStringContainer extends StatelessWidget {
|
|||||||
width: size.width *0.15,
|
width: size.width *0.15,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
List<TranslationDTO> newValues = new List<TranslationDTO>();
|
List<TranslationDTO> newValues = <TranslationDTO>[];
|
||||||
// Make a copy
|
|
||||||
initialValue.forEach((value) {
|
List<TranslationDTO> initials = initialValue;
|
||||||
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value))));
|
if(initials == null) {
|
||||||
|
initials = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
languages.forEach((value) {
|
||||||
|
if(initials.map((iv) => iv.language).contains(value)) {
|
||||||
|
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!);
|
||||||
|
} else {
|
||||||
|
// New language
|
||||||
|
newValues.add(TranslationDTO(language: value, value: null));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
showMultiStringInput(label, modalLabel, initialValue, newValues, onGetResult, maxLines, context);
|
|
||||||
|
showMultiStringInput(label, modalLabel, isTitle, initials, newValues, onGetResult, maxLines, isAudio, context);
|
||||||
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -56,7 +80,7 @@ class MultiStringContainer extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
|
padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: AutoSizeText(
|
child: AutoSizeText(
|
||||||
"Changer les traductions",
|
isAudio ? "Changer audios" : "Changer traductions",
|
||||||
style: TextStyle(color: kWhite),
|
style: TextStyle(color: kWhite),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
)
|
)
|
||||||
|
|||||||
63
lib/Components/number_input_container.dart
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/Components/rounded_input_field.dart';
|
||||||
|
import 'package:manager_app/constants.dart';
|
||||||
|
|
||||||
|
class NumberInputContainer extends StatelessWidget {
|
||||||
|
final Color color;
|
||||||
|
final String label;
|
||||||
|
final int initialValue;
|
||||||
|
final ValueChanged<String> onChanged;
|
||||||
|
final bool isUrl;
|
||||||
|
final bool isSmall;
|
||||||
|
final int maxLength;
|
||||||
|
final double fontSize;
|
||||||
|
final double fontSizeText;
|
||||||
|
const NumberInputContainer({
|
||||||
|
Key? key,
|
||||||
|
this.color = kSecond,
|
||||||
|
required this.label,
|
||||||
|
required this.initialValue,
|
||||||
|
required this.onChanged,
|
||||||
|
this.isUrl = false,
|
||||||
|
this.isSmall = false,
|
||||||
|
this.maxLength = 50,
|
||||||
|
this.fontSize = 25,
|
||||||
|
this.fontSizeText = 20,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
return Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: AlignmentDirectional.centerStart,
|
||||||
|
child: AutoSizeText(
|
||||||
|
label,
|
||||||
|
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.w300),
|
||||||
|
maxLines: 2,
|
||||||
|
maxFontSize: fontSize,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: Container(
|
||||||
|
width: isUrl ? size.width *0.6 : isSmall ? size.width *0.1 : size.width *0.2,
|
||||||
|
child: RoundedInputField(
|
||||||
|
color: color,
|
||||||
|
textColor: kBlack,
|
||||||
|
fontSize: fontSizeText,
|
||||||
|
initialValue: initialValue.toString(),
|
||||||
|
onChanged: onChanged,
|
||||||
|
maxLength: maxLength,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,19 +2,20 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/Components/upload_audio_container.dart';
|
||||||
import 'package:manager_app/Components/upload_image_container.dart';
|
import 'package:manager_app/Components/upload_image_container.dart';
|
||||||
import 'package:manager_app/Components/upload_online_resources_container.dart';
|
import 'package:manager_app/Components/upload_online_resources_container.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
class ResourceTab extends StatefulWidget {
|
class ResourceTab extends StatefulWidget {
|
||||||
final ResourceDTO resourceDTO;
|
final ResourceDTO resourceDTO;
|
||||||
final Function onFileUpload;
|
final Function onFileUpload;
|
||||||
final Function onFileUploadWeb;
|
final Function onFileUploadWeb;
|
||||||
const ResourceTab({
|
const ResourceTab({
|
||||||
Key key,
|
Key? key,
|
||||||
this.resourceDTO,
|
required this.resourceDTO,
|
||||||
this.onFileUpload,
|
required this.onFileUpload,
|
||||||
this.onFileUploadWeb,
|
required this.onFileUploadWeb,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -22,17 +23,18 @@ class ResourceTab extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ResourceTabState extends State<ResourceTab> with SingleTickerProviderStateMixin {
|
class _ResourceTabState extends State<ResourceTab> with SingleTickerProviderStateMixin {
|
||||||
TabController _tabController;
|
TabController? _tabController;
|
||||||
List<Tab> tabsToShow = new List<Tab>();
|
List<Tab> tabsToShow = <Tab>[];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
tabsToShow.add(new Tab(text: "Image local"));
|
tabsToShow.add(new Tab(text: "Image local"));
|
||||||
tabsToShow.add(new Tab(text: "Image en ligne"));
|
tabsToShow.add(new Tab(text: "Image en ligne"));
|
||||||
tabsToShow.add(new Tab(text: "Vidéo en ligne"));
|
tabsToShow.add(new Tab(text: "Audio local"));
|
||||||
|
//tabsToShow.add(new Tab(text: "Vidéo en ligne"));
|
||||||
|
|
||||||
_tabController = new TabController(length: 3, vsync: this);
|
_tabController = new TabController(length: 3, vsync: this);
|
||||||
_tabController.addListener(_handleTabSelection);
|
_tabController!.addListener(_handleTabSelection);
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
@ -65,23 +67,23 @@ class _ResourceTabState extends State<ResourceTab> with SingleTickerProviderStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _handleTabSelection() {
|
void _handleTabSelection() {
|
||||||
switch(_tabController.index) {
|
switch(_tabController!.index) {
|
||||||
case 0:
|
case 0:
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.resourceDTO.data = null;
|
widget.resourceDTO.data = null;
|
||||||
widget.resourceDTO.type = ResourceType.image;
|
widget.resourceDTO.type = ResourceType.Image;
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.resourceDTO.data = null;
|
widget.resourceDTO.data = null;
|
||||||
widget.resourceDTO.type = ResourceType.imageUrl;
|
widget.resourceDTO.type = ResourceType.ImageUrl;
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.resourceDTO.data = null;
|
widget.resourceDTO.data = null;
|
||||||
widget.resourceDTO.type = ResourceType.videoUrl;
|
widget.resourceDTO.type = ResourceType.Audio;
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -89,20 +91,20 @@ class _ResourceTabState extends State<ResourceTab> with SingleTickerProviderStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
getContent(ResourceDTO resourceDTO, Function onFileUpload, Function onFileUploadWeb) {
|
getContent(ResourceDTO resourceDTO, Function onFileUpload, Function onFileUploadWeb) {
|
||||||
List<Widget> tabsToShow = new List<Widget>();
|
List<Widget> tabsToShow = <Widget>[];
|
||||||
|
|
||||||
// Local Image
|
// Local Image
|
||||||
tabsToShow.add(
|
tabsToShow.add(
|
||||||
new Padding(
|
new Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
||||||
child: UploadImageContainer(
|
child: UploadImageContainer(
|
||||||
onChanged: (List<File> files) {
|
onChanged: (List<File>? files) {
|
||||||
onFileUpload(files);
|
onFileUpload(files);
|
||||||
resourceDTO.type = ResourceType.image;
|
resourceDTO.type = ResourceType.Image;
|
||||||
},
|
},
|
||||||
onChangedWeb: (List<PlatformFile> files) {
|
onChangedWeb: (List<PlatformFile>? files) {
|
||||||
onFileUploadWeb(files);
|
onFileUploadWeb(files);
|
||||||
resourceDTO.type = ResourceType.image;
|
resourceDTO.type = ResourceType.Image;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -114,15 +116,32 @@ getContent(ResourceDTO resourceDTO, Function onFileUpload, Function onFileUpload
|
|||||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
||||||
child: UploadOnlineResourceContainer(
|
child: UploadOnlineResourceContainer(
|
||||||
resourceDTO: resourceDTO,
|
resourceDTO: resourceDTO,
|
||||||
onChanged: (ResourceDTO value) {
|
onChanged: (ResourceDTO value) {
|
||||||
resourceDTO = value;
|
resourceDTO = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Online Video
|
// Audio local
|
||||||
tabsToShow.add(
|
tabsToShow.add(
|
||||||
|
new Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
||||||
|
child: UploadAudioContainer(
|
||||||
|
onChanged: (List<File> files) {
|
||||||
|
onFileUpload(files);
|
||||||
|
resourceDTO.type = ResourceType.Audio;
|
||||||
|
},
|
||||||
|
onChangedWeb: (List<PlatformFile> files) {
|
||||||
|
onFileUploadWeb(files);
|
||||||
|
resourceDTO.type = ResourceType.Audio;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Online Video
|
||||||
|
/*tabsToShow.add(
|
||||||
new Padding(
|
new Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
||||||
child: UploadOnlineResourceContainer(
|
child: UploadOnlineResourceContainer(
|
||||||
@ -132,6 +151,6 @@ getContent(ResourceDTO resourceDTO, Function onFileUpload, Function onFileUpload
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
);
|
);*/
|
||||||
return tabsToShow;
|
return tabsToShow;
|
||||||
}
|
}
|
||||||
@ -1,23 +1,24 @@
|
|||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
|
|
||||||
class RoundedButton extends StatelessWidget {
|
class RoundedButton extends StatelessWidget {
|
||||||
final String text;
|
final String text;
|
||||||
final Function press;
|
final Function press;
|
||||||
final IconData icon;
|
final IconData? icon;
|
||||||
final Color color, textColor;
|
final Color color, textColor;
|
||||||
final double fontSize;
|
final double fontSize;
|
||||||
final int vertical;
|
final double? vertical;
|
||||||
final int horizontal;
|
final double? horizontal;
|
||||||
|
|
||||||
const RoundedButton({
|
const RoundedButton({
|
||||||
Key key,
|
Key? key,
|
||||||
this.text,
|
required this.text,
|
||||||
this.press,
|
required this.press,
|
||||||
this.icon,
|
this.icon,
|
||||||
this.color = kPrimaryColor,
|
this.color = kPrimaryColor,
|
||||||
this.textColor = kWhite,
|
this.textColor = kWhite,
|
||||||
this.fontSize,
|
required this.fontSize,
|
||||||
this.vertical,
|
this.vertical,
|
||||||
this.horizontal
|
this.horizontal
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
@ -27,7 +28,7 @@ class RoundedButton extends StatelessWidget {
|
|||||||
//Size size = MediaQuery.of(context).size;
|
//Size size = MediaQuery.of(context).size;
|
||||||
return TextButton(
|
return TextButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
padding: MaterialStateProperty.resolveWith((states) => EdgeInsets.symmetric(vertical: this.vertical != null ? this.vertical : 25, horizontal: this.horizontal != null ? this.horizontal : (icon == null ? 85 : 30))),
|
padding: MaterialStateProperty.resolveWith((states) => EdgeInsets.symmetric(vertical: this.vertical != null ? this.vertical! : 25, horizontal: this.horizontal != null ? this.horizontal!: (icon == null ? 85 : 30))),
|
||||||
backgroundColor: MaterialStateColor.resolveWith((states) => color),
|
backgroundColor: MaterialStateColor.resolveWith((states) => color),
|
||||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
@ -49,10 +50,13 @@ class RoundedButton extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: AutoSizeText(
|
||||||
text,
|
text,
|
||||||
style: new TextStyle(color: textColor, fontSize: fontSize, fontWeight: FontWeight.w400),
|
style: new TextStyle(color: textColor, fontSize: fontSize, fontWeight: FontWeight.w400),
|
||||||
),
|
maxLines: 2,
|
||||||
|
maxFontSize: fontSize,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10
|
width: 10
|
||||||
@ -65,10 +69,12 @@ class RoundedButton extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Text(
|
return AutoSizeText(
|
||||||
text,
|
text,
|
||||||
style: new TextStyle(color: textColor, fontSize: fontSize, fontWeight: FontWeight.w400),
|
style: new TextStyle(color: textColor, fontSize: fontSize, fontWeight: FontWeight.w400),
|
||||||
);
|
maxLines: 2,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,26 +1,33 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:manager_app/Components/text_field_container.dart';
|
import 'package:manager_app/Components/text_field_container.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
|
|
||||||
class RoundedInputField extends StatelessWidget {
|
class RoundedInputField extends StatelessWidget {
|
||||||
final String hintText;
|
final String? hintText;
|
||||||
final IconData icon;
|
final IconData? icon;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
final String initialValue;
|
final String? initialValue;
|
||||||
final Color color, textColor, iconColor;
|
final Color color, textColor, iconColor;
|
||||||
final int maxLength;
|
final int? maxLength;
|
||||||
final bool isEmail;
|
final bool isEmail;
|
||||||
|
final double fontSize;
|
||||||
|
final String? autofill;
|
||||||
|
final bool isInt;
|
||||||
const RoundedInputField({
|
const RoundedInputField({
|
||||||
Key key,
|
Key? key,
|
||||||
this.hintText,
|
this.hintText,
|
||||||
this.initialValue,
|
this.initialValue,
|
||||||
this.icon,
|
this.icon,
|
||||||
this.color = kSecond,
|
this.color = kSecond,
|
||||||
this.textColor = kBlack,
|
this.textColor = kBlack,
|
||||||
this.iconColor = kPrimaryColor,
|
this.iconColor = kPrimaryColor,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
this.maxLength, // 50
|
this.maxLength, // 50
|
||||||
this.isEmail = false
|
this.isEmail = false,
|
||||||
|
this.fontSize = 20,
|
||||||
|
this.autofill,
|
||||||
|
this.isInt = false
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -32,15 +39,19 @@ class RoundedInputField extends StatelessWidget {
|
|||||||
initialValue: initialValue,
|
initialValue: initialValue,
|
||||||
cursorColor: textColor,
|
cursorColor: textColor,
|
||||||
maxLength: maxLength,
|
maxLength: maxLength,
|
||||||
keyboardType: isEmail ? TextInputType.emailAddress : TextInputType.text,
|
autofillHints: autofill != null ? [autofill!] : [],
|
||||||
style: TextStyle(fontSize: 20, color: textColor),
|
keyboardType: isEmail ? TextInputType.emailAddress : isInt ? TextInputType.number : TextInputType.text,
|
||||||
|
inputFormatters: !isInt ? [] : <TextInputFormatter>[
|
||||||
|
FilteringTextInputFormatter.digitsOnly
|
||||||
|
],
|
||||||
|
style: TextStyle(fontSize: fontSize, color: textColor),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
icon: icon != null ? Icon(
|
icon: icon != null ? Icon(
|
||||||
icon,
|
icon,
|
||||||
color: iconColor,
|
color: iconColor,
|
||||||
): null,
|
): null,
|
||||||
hintText: hintText,
|
hintText: hintText,
|
||||||
hintStyle: TextStyle(fontSize: 20.0, color: textColor),
|
hintStyle: TextStyle(fontSize: fontSize, color: textColor),
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -6,9 +6,9 @@ class RoundedPasswordField extends StatefulWidget {
|
|||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
final String initialValue;
|
final String initialValue;
|
||||||
const RoundedPasswordField({
|
const RoundedPasswordField({
|
||||||
Key key,
|
Key? key,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
this.initialValue,
|
required this.initialValue
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -25,10 +25,11 @@ class _RoundedPasswordFieldState extends State<RoundedPasswordField> {
|
|||||||
obscureText: isVisible,
|
obscureText: isVisible,
|
||||||
onChanged: widget.onChanged,
|
onChanged: widget.onChanged,
|
||||||
initialValue: widget.initialValue,
|
initialValue: widget.initialValue,
|
||||||
|
autofillHints: [AutofillHints.password],
|
||||||
cursorColor: kPrimaryColor,
|
cursorColor: kPrimaryColor,
|
||||||
style: TextStyle(fontSize: 20, color: kBlack),
|
style: TextStyle(fontSize: 20, color: kBlack),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Password",
|
hintText: "Mot de passe",
|
||||||
hintStyle: TextStyle(fontSize: 20.0, color: kBlack),
|
hintStyle: TextStyle(fontSize: 20.0, color: kBlack),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.lock,
|
Icons.lock,
|
||||||
|
|||||||
@ -9,13 +9,13 @@ class SliderInputContainer extends StatefulWidget {
|
|||||||
final int max;
|
final int max;
|
||||||
final ValueChanged<double> onChanged;
|
final ValueChanged<double> onChanged;
|
||||||
const SliderInputContainer({
|
const SliderInputContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.color = kSecond,
|
this.color = kSecond,
|
||||||
this.label,
|
required this.label,
|
||||||
this.initialValue,
|
required this.initialValue,
|
||||||
this.min,
|
required this.min,
|
||||||
this.max,
|
required this.max,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -23,7 +23,7 @@ class SliderInputContainer extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SliderInputContainerState extends State<SliderInputContainer> {
|
class _SliderInputContainerState extends State<SliderInputContainer> {
|
||||||
double currentValue;
|
double? currentValue;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -43,7 +43,7 @@ class _SliderInputContainerState extends State<SliderInputContainer> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: Slider(
|
child: Slider(
|
||||||
value: currentValue,
|
value: currentValue!,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() => currentValue = value);
|
setState(() => currentValue = value);
|
||||||
widget.onChanged(value);
|
widget.onChanged(value);
|
||||||
|
|||||||
@ -1,43 +1,56 @@
|
|||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/rounded_input_field.dart';
|
import 'package:manager_app/Components/rounded_input_field.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
|
|
||||||
class StringInputContainer extends StatelessWidget {
|
class StringInputContainer extends StatelessWidget {
|
||||||
final Color color;
|
final Color? color;
|
||||||
final String label;
|
final String label;
|
||||||
final String initialValue;
|
final String? initialValue;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
final bool isUrl;
|
final bool isUrl;
|
||||||
final bool isSmall;
|
final bool isSmall;
|
||||||
final int maxLength;
|
final int maxLength;
|
||||||
|
final double fontSize;
|
||||||
|
final double fontSizeText;
|
||||||
const StringInputContainer({
|
const StringInputContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.color = kSecond,
|
this.color = kSecond,
|
||||||
this.label,
|
required this.label,
|
||||||
this.initialValue,
|
this.initialValue = "",
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
this.isUrl = false,
|
this.isUrl = false,
|
||||||
this.isSmall = false,
|
this.isSmall = false,
|
||||||
this.maxLength = 50,
|
this.maxLength = 50,
|
||||||
|
this.fontSize = 25,
|
||||||
|
this.fontSizeText = 20,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Align(
|
Align(
|
||||||
alignment: AlignmentDirectional.centerStart,
|
alignment: AlignmentDirectional.centerStart,
|
||||||
child: Text(label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300))
|
child: AutoSizeText(
|
||||||
|
label,
|
||||||
|
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.w300),
|
||||||
|
maxLines: 2,
|
||||||
|
maxFontSize: fontSize,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: isUrl ? size.width *0.6 : isSmall ? size.width *0.1 : size.width *0.2,
|
width: isUrl ? size.width *0.6 : isSmall ? size.width *0.1 : size.width *0.2,
|
||||||
child: RoundedInputField(
|
child: RoundedInputField(
|
||||||
color: color,
|
color: color!,
|
||||||
textColor: kBlack,
|
textColor: kBlack,
|
||||||
|
fontSize: fontSizeText,
|
||||||
initialValue: initialValue,
|
initialValue: initialValue,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
maxLength: maxLength,
|
maxLength: maxLength,
|
||||||
|
|||||||
@ -5,8 +5,8 @@ class TextFieldContainer extends StatelessWidget {
|
|||||||
final Widget child;
|
final Widget child;
|
||||||
final Color color;
|
final Color color;
|
||||||
const TextFieldContainer({
|
const TextFieldContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.child,
|
required this.child,
|
||||||
this.color = kSecond,
|
this.color = kSecond,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
|||||||
@ -9,13 +9,13 @@ class TextFormInputContainer extends StatelessWidget {
|
|||||||
final int maxLines;
|
final int maxLines;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
const TextFormInputContainer({
|
const TextFormInputContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.color = kSecond,
|
this.color = kSecond,
|
||||||
this.label,
|
required this.label,
|
||||||
this.initialValue,
|
required this.initialValue,
|
||||||
this.isTitle,
|
required this.isTitle,
|
||||||
this.maxLines = 5,
|
this.maxLines = 5,
|
||||||
this.onChanged
|
required this.onChanged
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
class TranslationTab extends StatefulWidget {
|
class TranslationTab extends StatefulWidget {
|
||||||
final List<TranslationDTO> translations;
|
final List<TranslationDTO> translations;
|
||||||
final int maxLines;
|
final int maxLines;
|
||||||
const TranslationTab({
|
const TranslationTab({
|
||||||
Key key,
|
Key? key,
|
||||||
this.translations,
|
required this.translations,
|
||||||
this.maxLines,
|
required this.maxLines,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -15,7 +15,7 @@ class TranslationTab extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _TranslationTabState extends State<TranslationTab> with SingleTickerProviderStateMixin {
|
class _TranslationTabState extends State<TranslationTab> with SingleTickerProviderStateMixin {
|
||||||
TabController _tabController;
|
TabController? _tabController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -52,7 +52,7 @@ class _TranslationTabState extends State<TranslationTab> with SingleTickerProvid
|
|||||||
}
|
}
|
||||||
|
|
||||||
getContent(List<TranslationDTO> translations, int maxLines) {
|
getContent(List<TranslationDTO> translations, int maxLines) {
|
||||||
List<Widget> tabsToShow = new List<Widget>();
|
List<Widget> tabsToShow = <Widget>[];
|
||||||
translations.forEach((translation) {
|
translations.forEach((translation) {
|
||||||
tabsToShow.add(
|
tabsToShow.add(
|
||||||
new Padding(
|
new Padding(
|
||||||
@ -64,8 +64,8 @@ getContent(List<TranslationDTO> translations, int maxLines) {
|
|||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
initialValue: translation.value,
|
initialValue: translation.value,
|
||||||
onChanged: (String value) {
|
onChanged: (String value) {
|
||||||
print("onChanged value in tranbslationTAB");
|
//print("onChanged value in tranbslationTAB");
|
||||||
print(value);
|
//print(value);
|
||||||
translation.value = value;
|
translation.value = value;
|
||||||
},
|
},
|
||||||
cursorColor: kPrimaryColor,
|
cursorColor: kPrimaryColor,
|
||||||
@ -103,7 +103,7 @@ getContent(List<TranslationDTO> translations, int maxLines) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTabs(List<TranslationDTO> newValues) {
|
getTabs(List<TranslationDTO> newValues) {
|
||||||
List<Tab> tabsToShow = new List<Tab>();
|
List<Tab> tabsToShow = <Tab>[];
|
||||||
newValues.forEach((value) {
|
newValues.forEach((value) {
|
||||||
tabsToShow.add(
|
tabsToShow.add(
|
||||||
new Tab(text: value.language));
|
new Tab(text: value.language));
|
||||||
|
|||||||
206
lib/Components/upload_audio_container.dart
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
import 'package:manager_app/constants.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
|
|
||||||
|
class UploadAudioContainer extends StatefulWidget {
|
||||||
|
final ValueChanged<List<File>> onChanged;
|
||||||
|
final ValueChanged<List<PlatformFile>> onChangedWeb;
|
||||||
|
const UploadAudioContainer({
|
||||||
|
Key? key,
|
||||||
|
required this.onChanged,
|
||||||
|
required this.onChangedWeb,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_UploadAudioContainerState createState() => _UploadAudioContainerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _UploadAudioContainerState extends State<UploadAudioContainer> with SingleTickerProviderStateMixin {
|
||||||
|
var filePath;
|
||||||
|
File? fileToShow;
|
||||||
|
String? fileToShowWeb;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
return Container(
|
||||||
|
width: size.width *0.5,
|
||||||
|
height: size.height *0.5,
|
||||||
|
child: displayElement(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getFileName(filePath) {
|
||||||
|
return (filePath.toString().split('\\').last);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> filePicker() async {
|
||||||
|
FilePickerResult? result;
|
||||||
|
if (kIsWeb) {
|
||||||
|
result = await FilePicker.platform.pickFiles(
|
||||||
|
type: FileType.custom,
|
||||||
|
dialogTitle: 'Sélectionner un fichier audio mp3',
|
||||||
|
allowMultiple: true,
|
||||||
|
allowedExtensions: ['mp3'],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
List<PlatformFile> files = result.files;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
filePath = "Fichiers"; // Only show one picture
|
||||||
|
fileToShowWeb = "Aucun aperçu possible"; // Only show one picture
|
||||||
|
widget.onChangedWeb(files);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result = await FilePicker.platform.pickFiles(
|
||||||
|
type: FileType.custom,
|
||||||
|
dialogTitle: 'Sélectionner un fichier audio mp3',
|
||||||
|
allowMultiple: true,
|
||||||
|
allowedExtensions: ['mp3'],
|
||||||
|
);
|
||||||
|
|
||||||
|
if(result != null) {
|
||||||
|
List<File> files = result.paths.map((path) => File(path!)).toList();
|
||||||
|
var file = files[0];
|
||||||
|
setState(() {
|
||||||
|
filePath = file.path; // Only show one picture
|
||||||
|
fileToShow = file; // Only show one picture
|
||||||
|
widget.onChanged(files);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*final file = OpenFilePicker()
|
||||||
|
..filterSpecification = {
|
||||||
|
'Images (*.jpg; *.jpeg;*.png)': '*.jpg;*.jpeg;*.png',
|
||||||
|
//'Video (*.mp4)': '*.mp4',
|
||||||
|
//'All Files': '*.*'
|
||||||
|
}
|
||||||
|
..defaultFilterIndex = 0
|
||||||
|
..title = 'Sélectionner un fichier';
|
||||||
|
|
||||||
|
final result = file.getFile();
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
filePath = result.path;
|
||||||
|
fileToShow = result;
|
||||||
|
widget.onChanged(result);
|
||||||
|
});
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
showFile() {
|
||||||
|
if (getFileName(filePath).contains(".mp4")) {
|
||||||
|
/*return FutureBuilder(
|
||||||
|
future: loadFile(fileToShow),
|
||||||
|
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
return Container(
|
||||||
|
height: 300,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text("La prévisualisation de la vidéo n'est pas disponible"),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.ondemand_video_sharp,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
//DartVLC(file: snapshot.data)
|
||||||
|
);
|
||||||
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
|
return Text("No data");
|
||||||
|
} else {
|
||||||
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
height: 200,
|
||||||
|
child: LoadingCommon()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);*/
|
||||||
|
} else {
|
||||||
|
if (kIsWeb) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return Text("TODO player affiché ou pas ?");/*Image.file(
|
||||||
|
fileToShow,
|
||||||
|
height: 200,
|
||||||
|
fit:BoxFit.scaleDown
|
||||||
|
);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadFile(File fileToShow) async {
|
||||||
|
//return await Media.file(fileToShow);
|
||||||
|
return null; // Useless no mp4 for now
|
||||||
|
}
|
||||||
|
|
||||||
|
displayElement() {
|
||||||
|
if (fileToShow == null && fileToShowWeb == null) return Center(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
filePicker();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: kPrimaryColor,
|
||||||
|
borderRadius: BorderRadius.circular(15)
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 25.0, right: 25.0, top: 15.0, bottom: 15.0),
|
||||||
|
child: Text(
|
||||||
|
"Ajouter un ou plusieurs fichiers",
|
||||||
|
style: new TextStyle(color: kWhite),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (fileToShow != null || fileToShowWeb != null)
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.all(8.0),
|
||||||
|
child: Card(
|
||||||
|
color: kBackgroundColor,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8.0))),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
filePicker();
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: <Widget>[
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(8.0),
|
||||||
|
topRight: Radius.circular(8.0),
|
||||||
|
),
|
||||||
|
child: showFile()
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text(getFileName(filePath)),
|
||||||
|
subtitle: Text(filePath),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,18 +1,16 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:manager_app/Components/loading.dart';
|
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
|
|
||||||
class UploadImageContainer extends StatefulWidget {
|
class UploadImageContainer extends StatefulWidget {
|
||||||
final ValueChanged<List<File>> onChanged;
|
final ValueChanged<List<File>?> onChanged;
|
||||||
final ValueChanged<List<PlatformFile>> onChangedWeb;
|
final ValueChanged<List<PlatformFile>?> onChangedWeb;
|
||||||
const UploadImageContainer({
|
const UploadImageContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
this.onChangedWeb,
|
required this.onChangedWeb,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -21,8 +19,8 @@ class UploadImageContainer extends StatefulWidget {
|
|||||||
|
|
||||||
class _UploadImageContainerState extends State<UploadImageContainer> with SingleTickerProviderStateMixin {
|
class _UploadImageContainerState extends State<UploadImageContainer> with SingleTickerProviderStateMixin {
|
||||||
var filePath;
|
var filePath;
|
||||||
File fileToShow;
|
File? fileToShow;
|
||||||
String fileToShowWeb;
|
String? fileToShowWeb;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -44,7 +42,7 @@ class _UploadImageContainerState extends State<UploadImageContainer> with Single
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> filePicker() async {
|
Future<void> filePicker() async {
|
||||||
FilePickerResult result;
|
FilePickerResult? result;
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
result = await FilePicker.platform.pickFiles(
|
result = await FilePicker.platform.pickFiles(
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
@ -70,13 +68,15 @@ class _UploadImageContainerState extends State<UploadImageContainer> with Single
|
|||||||
allowedExtensions: ['jpg', 'jpeg', 'png'],
|
allowedExtensions: ['jpg', 'jpeg', 'png'],
|
||||||
);
|
);
|
||||||
|
|
||||||
List<File> files = result.paths.map((path) => File(path)).toList();
|
if (result != null) {
|
||||||
var file = files[0];
|
List<File> files = result.paths.map((path) => File(path!)).toList();
|
||||||
setState(() {
|
var file = files[0];
|
||||||
filePath = file.path; // Only show one picture
|
setState(() {
|
||||||
fileToShow = file; // Only show one picture
|
filePath = file.path; // Only show one picture
|
||||||
widget.onChanged(files);
|
fileToShow = file; // Only show one picture
|
||||||
});
|
widget.onChanged(files);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*final file = OpenFilePicker()
|
/*final file = OpenFilePicker()
|
||||||
..filterSpecification = {
|
..filterSpecification = {
|
||||||
@ -128,7 +128,7 @@ class _UploadImageContainerState extends State<UploadImageContainer> with Single
|
|||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 200,
|
height: 200,
|
||||||
child: Loading()
|
child: LoadingCommon()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -138,11 +138,13 @@ class _UploadImageContainerState extends State<UploadImageContainer> with Single
|
|||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return Image.file(
|
if(fileToShow != null) {
|
||||||
fileToShow,
|
return Image.file(
|
||||||
height: 200,
|
fileToShow!,
|
||||||
fit:BoxFit.scaleDown
|
height: 200,
|
||||||
);
|
fit:BoxFit.scaleDown
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,15 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:manager_app/Components/rounded_input_field.dart';
|
import 'package:manager_app/Components/rounded_input_field.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class UploadOnlineResourceContainer extends StatefulWidget {
|
class UploadOnlineResourceContainer extends StatefulWidget {
|
||||||
final ResourceDTO resourceDTO;
|
final ResourceDTO resourceDTO;
|
||||||
final ValueChanged<ResourceDTO> onChanged;
|
final ValueChanged<ResourceDTO> onChanged;
|
||||||
const UploadOnlineResourceContainer({
|
const UploadOnlineResourceContainer({
|
||||||
Key key,
|
Key? key,
|
||||||
this.resourceDTO,
|
required this.resourceDTO,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -18,7 +17,7 @@ class UploadOnlineResourceContainer extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceContainer> with SingleTickerProviderStateMixin {
|
class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceContainer> with SingleTickerProviderStateMixin {
|
||||||
String urlResourceToShow;
|
String? urlResourceToShow;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -28,12 +27,12 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
print(size.width);
|
//print(size.width);
|
||||||
return displayElement(size);
|
return displayElement(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
showFile() {
|
showFile() {
|
||||||
if (widget.resourceDTO.type == ResourceType.videoUrl || widget.resourceDTO.type == ResourceType.video) {
|
if (widget.resourceDTO.type == ResourceType.VideoUrl || widget.resourceDTO.type == ResourceType.Video) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@ -65,9 +64,24 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
|||||||
/*await Media.file(widget.file)*/
|
/*await Media.file(widget.file)*/
|
||||||
} else {
|
} else {
|
||||||
return Image.network(
|
return Image.network(
|
||||||
urlResourceToShow,
|
urlResourceToShow!,
|
||||||
height: 200,
|
height: 200,
|
||||||
fit:BoxFit.scaleDown
|
fit:BoxFit.scaleDown,
|
||||||
|
loadingBuilder: (BuildContext context, Widget child,
|
||||||
|
ImageChunkEvent? loadingProgress) {
|
||||||
|
if (loadingProgress == null) {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: kPrimaryColor,
|
||||||
|
value: loadingProgress.expectedTotalBytes != null
|
||||||
|
? loadingProgress.cumulativeBytesLoaded /
|
||||||
|
loadingProgress.expectedTotalBytes!
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,10 +105,10 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: size.width *0.35, // TODO GET SIZE
|
width: size.width *0.35, // TODO GET SIZE
|
||||||
child: RoundedInputField(
|
child: RoundedInputField(
|
||||||
hintText: widget.resourceDTO.type == ResourceType.imageUrl ? "Url de l'image" : "Url de la vidéo",
|
hintText: widget.resourceDTO.type == ResourceType.ImageUrl ? "Url de l'image" : "Url de la vidéo",
|
||||||
icon: widget.resourceDTO.type == ResourceType.imageUrl ? Icons.image : Icons.ondemand_video, // TODO: TBD
|
icon: widget.resourceDTO.type == ResourceType.ImageUrl ? Icons.image : Icons.ondemand_video, // TODO: TBD
|
||||||
onChanged: (String text) {
|
onChanged: (String text) {
|
||||||
print("onchanged url");
|
//print("onchanged url");
|
||||||
widget.resourceDTO.data = text;
|
widget.resourceDTO.data = text;
|
||||||
widget.onChanged(widget.resourceDTO);
|
widget.onChanged(widget.resourceDTO);
|
||||||
},
|
},
|
||||||
@ -104,7 +118,7 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
|||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
print("refresh preview");
|
//print("refresh preview");
|
||||||
setState(() {
|
setState(() {
|
||||||
urlResourceToShow = widget.resourceDTO.data;
|
urlResourceToShow = widget.resourceDTO.data;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
//import 'package:dart_vlc/dart_vlc.dart';
|
//import 'package:dart_vlc/dart_vlc.dart';
|
||||||
/*
|
/*
|
||||||
class DartVLC extends StatefulWidget {
|
class DartVLC extends StatefulWidget {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:encrypt/encrypt.dart';
|
import 'package:encrypt/encrypt.dart';
|
||||||
@ -8,8 +7,7 @@ import 'package:manager_app/Components/message_notification.dart';
|
|||||||
import 'package:manager_app/Models/session.dart';
|
import 'package:manager_app/Models/session.dart';
|
||||||
import 'package:manager_app/client.dart';
|
import 'package:manager_app/client.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
//import 'package:path_provider/path_provider.dart';
|
|
||||||
|
|
||||||
class FileHelper {
|
class FileHelper {
|
||||||
final key = Key.fromUtf8('aVs:ZMe3EK-yS<y:;k>vCGrj3T8]yG6E');
|
final key = Key.fromUtf8('aVs:ZMe3EK-yS<y:;k>vCGrj3T8]yG6E');
|
||||||
@ -32,7 +30,7 @@ class FileHelper {
|
|||||||
|
|
||||||
if (session.password != null) {
|
if (session.password != null) {
|
||||||
var encrypter = Encrypter(AES(key));
|
var encrypter = Encrypter(AES(key));
|
||||||
var encrypted = encrypter.encrypt(session.password, iv: iv);
|
var encrypted = encrypter.encrypt(session.password!, iv: iv);
|
||||||
|
|
||||||
session.password = encrypted.base64;
|
session.password = encrypted.base64;
|
||||||
}
|
}
|
||||||
@ -42,20 +40,20 @@ class FileHelper {
|
|||||||
|
|
||||||
Future<File> storeConfiguration(ExportConfigurationDTO exportConfigurationDTO) async {
|
Future<File> storeConfiguration(ExportConfigurationDTO exportConfigurationDTO) async {
|
||||||
final path = await _localPath;
|
final path = await _localPath;
|
||||||
new File('$path/'+exportConfigurationDTO.label+'.json').createSync(recursive: true);
|
new File('$path/'+exportConfigurationDTO.label!+'.json').createSync(recursive: true);
|
||||||
|
|
||||||
// Write the file
|
// Write the file
|
||||||
File file = File('$path/'+exportConfigurationDTO.label+'.json');
|
File file = File('$path/'+exportConfigurationDTO.label!+'.json');
|
||||||
return file.writeAsString(jsonEncode(exportConfigurationDTO.toJson()));
|
return file.writeAsString(jsonEncode(exportConfigurationDTO.toJson()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> importConfiguration(FilePickerResult filePickerResult, String path, Client client, context) async {
|
Future<void> importConfiguration(FilePickerResult filePickerResult, String? path, Client client, context) async {
|
||||||
var fileTest = filePickerResult.files[0];
|
var fileTest = filePickerResult.files[0];
|
||||||
String fileContent = utf8.decode(fileTest.bytes);
|
String fileContent = utf8.decode(fileTest.bytes!);
|
||||||
ExportConfigurationDTO export = ExportConfigurationDTO.fromJson(jsonDecode(fileContent));
|
ExportConfigurationDTO export = ExportConfigurationDTO.fromJson(jsonDecode(fileContent))!;
|
||||||
try {
|
try {
|
||||||
String test = await client.configurationApi.configurationImport(export);
|
String? test = await client.configurationApi!.configurationImport(export);
|
||||||
if (test.contains("successfully")) {
|
if (test != null && test.contains("successfully")) {
|
||||||
showNotification(kSuccess, kWhite, 'La configuration a été importée avec succès', context, null);
|
showNotification(kSuccess, kWhite, 'La configuration a été importée avec succès', context, null);
|
||||||
} else {
|
} else {
|
||||||
showNotification(kPrimaryColor, kWhite, 'Une erreur est survenue lors de l''import de la configuration', context, null);
|
showNotification(kPrimaryColor, kWhite, 'Une erreur est survenue lors de l''import de la configuration', context, null);
|
||||||
@ -78,7 +76,7 @@ class FileHelper {
|
|||||||
var encrypter = Encrypter(AES(key));
|
var encrypter = Encrypter(AES(key));
|
||||||
|
|
||||||
if (session.password != null) {
|
if (session.password != null) {
|
||||||
session.password = encrypter.decrypt64(session.password, iv: iv);
|
session.password = encrypter.decrypt64(session.password!, iv: iv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
@ -86,7 +84,7 @@ class FileHelper {
|
|||||||
if (e.toString().contains("cannot find the file")) {
|
if (e.toString().contains("cannot find the file")) {
|
||||||
final path = await _localPath;
|
final path = await _localPath;
|
||||||
new File('$path/session.json').createSync(recursive: true);
|
new File('$path/session.json').createSync(recursive: true);
|
||||||
print("file created");
|
//print("file created");
|
||||||
await writeSession(new Session(rememberMe: false));
|
await writeSession(new Session(rememberMe: false));
|
||||||
}
|
}
|
||||||
// If encountering an error, return 0
|
// If encountering an error, return 0
|
||||||
|
|||||||
74
lib/Helpers/PDFHelper.dart
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:manager_api_new/api.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'package:pdf/pdf.dart';
|
||||||
|
import 'package:pdf/widgets.dart' as pw;
|
||||||
|
import 'dart:html' as html;
|
||||||
|
|
||||||
|
class PDFHelper {
|
||||||
|
static downloadPDF(List<SectionDTO> sections) async {
|
||||||
|
var sectionsArticle = sections.where((section) => section.type == SectionType.Article || section.type == SectionType.Quizz); // TODO HERE Support more section types
|
||||||
|
if(sectionsArticle.length > 0) {
|
||||||
|
//final font = await rootBundle.load("fonts/OpenSans-Medium.ttf");
|
||||||
|
//Uint8List byteData = new File("fonts/OpenSans-Medium.ttf").readAsBytesSync();
|
||||||
|
//ByteData font = ByteData.view(byteData.buffer);
|
||||||
|
//final ttf = pw.Font.ttf(font);
|
||||||
|
final pdf = pw.Document();
|
||||||
|
pdf.addPage(pw.MultiPage(
|
||||||
|
pageFormat: PdfPageFormat.a4,
|
||||||
|
build: (pw.Context context) {
|
||||||
|
return <pw.Widget> [
|
||||||
|
for(var section in sectionsArticle)
|
||||||
|
pw.Center(
|
||||||
|
child:
|
||||||
|
pw.Column(
|
||||||
|
children: [
|
||||||
|
pw.Text(section.label!.replaceAll(RegExp("[^A-Za-z0-9---():!éàèëêäâç' ]"), '')), //style: pw.TextStyle(font: ttf, fontSize: 30)
|
||||||
|
pw.Padding(padding: const pw.EdgeInsets.only(top: 20)),
|
||||||
|
pw.BarcodeWidget(
|
||||||
|
data: section.id!,
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
|
barcode: pw.Barcode.qrCode(),
|
||||||
|
drawText: false,
|
||||||
|
),
|
||||||
|
pw.Padding(padding: const pw.EdgeInsets.only(bottom: 30)),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}));
|
||||||
|
|
||||||
|
/*pdf.addPage(pw.Page(
|
||||||
|
pageFormat: PdfPageFormat.a4,
|
||||||
|
build: (pw.Context context) {
|
||||||
|
return
|
||||||
|
pw.Center(
|
||||||
|
child: pw.Column(
|
||||||
|
children: [
|
||||||
|
pw.Text(section.label, style: pw.TextStyle(font: ttf, fontSize: 30)),
|
||||||
|
pw.Padding(padding: const pw.EdgeInsets.only(top: 10)),
|
||||||
|
pw.BarcodeWidget(
|
||||||
|
data: section.id,
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
|
barcode: pw.Barcode.qrCode(),
|
||||||
|
drawText: false,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}));*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var test = await pdf.save();
|
||||||
|
final content = base64Encode(test);
|
||||||
|
final fileName = sectionsArticle.length > 1 ? 'QRCodes' : sectionsArticle.first.label;
|
||||||
|
final anchor = html.AnchorElement(
|
||||||
|
href: "data:application/octet-stream;charset=utf-16le;base64,$content")
|
||||||
|
..setAttribute("download", '$fileName.pdf')
|
||||||
|
..click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:password_credential/credentials.dart';
|
import 'package:password_credential/credentials.dart';
|
||||||
import 'package:password_credential/entity/mediation.dart';
|
import 'package:password_credential/entity/mediation.dart';
|
||||||
import 'package:password_credential/entity/password_credential.dart';
|
import 'package:password_credential/entity/password_credential.dart';
|
||||||
@ -8,7 +7,7 @@ import 'package:password_credential/entity/result.dart';
|
|||||||
class Model with ChangeNotifier {
|
class Model with ChangeNotifier {
|
||||||
final _credentials = Credentials();
|
final _credentials = Credentials();
|
||||||
|
|
||||||
bool hasCredentialFeature = false;
|
bool? hasCredentialFeature = false;
|
||||||
var idEdit = TextEditingController();
|
var idEdit = TextEditingController();
|
||||||
var passwordEdit = TextEditingController();
|
var passwordEdit = TextEditingController();
|
||||||
|
|
||||||
@ -27,11 +26,11 @@ class Model with ChangeNotifier {
|
|||||||
Future<PasswordCredential> get(Mediation mediation) async {
|
Future<PasswordCredential> get(Mediation mediation) async {
|
||||||
var credential = await _credentials.get(mediation: mediation);
|
var credential = await _credentials.get(mediation: mediation);
|
||||||
if (credential != null) {
|
if (credential != null) {
|
||||||
idEdit.text = credential.id;
|
idEdit.text = credential.id!;
|
||||||
passwordEdit.text = credential.password;
|
passwordEdit.text = credential.password!;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
return credential;
|
return credential!;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> delete() async {
|
Future<void> delete() async {
|
||||||
|
|||||||
@ -1,23 +1,24 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Models/session.dart';
|
|
||||||
import 'package:manager_app/client.dart';
|
import 'package:manager_app/client.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
|
|
||||||
class ManagerAppContext with ChangeNotifier{
|
class ManagerAppContext with ChangeNotifier{
|
||||||
String email;
|
String? email;
|
||||||
TokenDTO token;
|
String? instanceId;
|
||||||
Client clientAPI;
|
String? host;
|
||||||
String currentRoute;
|
String? accessToken;
|
||||||
ConfigurationDTO selectedConfiguration;
|
Client? clientAPI;
|
||||||
SectionDTO selectedSection;
|
String? currentRoute;
|
||||||
bool isLoading = false;
|
ConfigurationDTO? selectedConfiguration;
|
||||||
|
SectionDTO? selectedSection;
|
||||||
|
bool? isLoading = false;
|
||||||
|
|
||||||
ManagerAppContext({this.email, this.token, this.currentRoute});
|
ManagerAppContext({this.email, this.accessToken, this.currentRoute});
|
||||||
|
|
||||||
// Implement toString to make it easier to see information about
|
// Implement toString to make it easier to see information about
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ManagerAppContext{email: $email, token: $token, currentRoute: $currentRoute}, selectedConfiguration: $selectedConfiguration, selectedSection: $selectedSection}';
|
return 'ManagerAppContext{email: $email, host: $host, token: $accessToken, instanceId: $instanceId, currentRoute: $currentRoute}, selectedConfiguration: $selectedConfiguration, selectedSection: $selectedSection}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,9 +2,9 @@ import 'package:manager_app/Models/menuSection.dart';
|
|||||||
|
|
||||||
class Menu {
|
class Menu {
|
||||||
String title;
|
String title;
|
||||||
List<MenuSection> sections;
|
List<MenuSection>? sections;
|
||||||
|
|
||||||
Menu({this.title, this.sections});
|
Menu({required this.title, this.sections});
|
||||||
|
|
||||||
factory Menu.fromJson(Map<String, dynamic> json) {
|
factory Menu.fromJson(Map<String, dynamic> json) {
|
||||||
return new Menu(
|
return new Menu(
|
||||||
|
|||||||
@ -3,7 +3,7 @@ class MenuSection {
|
|||||||
String type;
|
String type;
|
||||||
int order;
|
int order;
|
||||||
|
|
||||||
MenuSection({this.name, this.type, this.order});
|
MenuSection({required this.name, required this.type, required this.order});
|
||||||
|
|
||||||
factory MenuSection.fromJson(Map<String, dynamic> json) {
|
factory MenuSection.fromJson(Map<String, dynamic> json) {
|
||||||
return new MenuSection(
|
return new MenuSection(
|
||||||
|
|||||||
27
lib/Models/resourceTypeModel.dart
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
|
class ResourceTypeModel {
|
||||||
|
String label;
|
||||||
|
ResourceType type;
|
||||||
|
|
||||||
|
ResourceTypeModel({required this.label, required this.type});
|
||||||
|
|
||||||
|
factory ResourceTypeModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
return new ResourceTypeModel(
|
||||||
|
label: json['label'] as String,
|
||||||
|
type: json['type'] as ResourceType,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
'label': label,
|
||||||
|
'type': type
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '{label: $label, type: $type}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
class Session {
|
class Session {
|
||||||
bool rememberMe;
|
bool rememberMe;
|
||||||
String host;
|
String? host;
|
||||||
String email;
|
String? email;
|
||||||
String password;
|
String? password;
|
||||||
|
|
||||||
Session({this.rememberMe, this.host, this.email, this.password});
|
Session({required this.rememberMe, this.host, this.email, this.password});
|
||||||
|
|
||||||
factory Session.fromJson(Map<String, dynamic> json) {
|
factory Session.fromJson(Map<String, dynamic> json) {
|
||||||
return new Session(
|
return new Session(
|
||||||
|
|||||||
@ -0,0 +1,252 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/Components/audio_input_container.dart';
|
||||||
|
import 'package:manager_app/Components/check_input_container.dart';
|
||||||
|
import 'package:manager_app/Components/multi_string_input_container.dart';
|
||||||
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart';
|
||||||
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart';
|
||||||
|
import 'package:manager_app/app_context.dart';
|
||||||
|
import 'package:manager_app/constants.dart';
|
||||||
|
import 'package:manager_api_new/api.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class ArticleConfig extends StatefulWidget {
|
||||||
|
final String? color;
|
||||||
|
final String? label;
|
||||||
|
final String initialValue;
|
||||||
|
final ValueChanged<String> onChanged;
|
||||||
|
const ArticleConfig({
|
||||||
|
Key? key,
|
||||||
|
this.color,
|
||||||
|
this.label,
|
||||||
|
required this.initialValue,
|
||||||
|
required this.onChanged,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ArticleConfigState createState() => _ArticleConfigState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ArticleConfigState extends State<ArticleConfig> {
|
||||||
|
late ArticleDTO articleDTO;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
articleDTO = ArticleDTO.fromJson(json.decode(widget.initialValue))!;
|
||||||
|
List<ImageDTO> test = new List<ImageDTO>.from(articleDTO.images!);
|
||||||
|
|
||||||
|
articleDTO.images = test;
|
||||||
|
articleDTO.images!.sort((a, b) => a.order!.compareTo(b.order!));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final appContext = Provider.of<AppContext>(context);
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
|
void _onReorder(int oldIndex, int newIndex) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
if (newIndex > oldIndex) {
|
||||||
|
newIndex -= 1;
|
||||||
|
}
|
||||||
|
final ImageDTO item = articleDTO.images!.removeAt(oldIndex);
|
||||||
|
articleDTO.images!.insert(newIndex, item);
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
articleDTO.images!.forEach((image) {
|
||||||
|
image.order = i;
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
|
||||||
|
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: size.height * 0.15,
|
||||||
|
//width: size.width * 0.5,//,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
MultiStringContainer(
|
||||||
|
label: "Contenu affiché :",
|
||||||
|
modalLabel: "Contenu",
|
||||||
|
color: kPrimaryColor,
|
||||||
|
initialValue: articleDTO != null ? articleDTO.content! : [],
|
||||||
|
isTitle: false,
|
||||||
|
onGetResult: (value) {
|
||||||
|
setState(() {
|
||||||
|
if (articleDTO.content! != value) {
|
||||||
|
articleDTO.content = value;
|
||||||
|
//save(true, articleDTO, appContext);
|
||||||
|
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
CheckInputContainer(
|
||||||
|
label: "Contenu au-dessus :",
|
||||||
|
isChecked: articleDTO.isContentTop,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
//print(value);
|
||||||
|
articleDTO.isContentTop = value;
|
||||||
|
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
MultiStringContainer(
|
||||||
|
label: "Audio :",
|
||||||
|
isAudio: true,
|
||||||
|
modalLabel: "Audio",
|
||||||
|
color: kPrimaryColor,
|
||||||
|
initialValue: articleDTO != null ? articleDTO.audioIds! : [],
|
||||||
|
isTitle: false,
|
||||||
|
onGetResult: (value) {
|
||||||
|
setState(() {
|
||||||
|
if (articleDTO.audioIds != value) {
|
||||||
|
articleDTO.audioIds = value;
|
||||||
|
//save(true, articleDTO, appContext);
|
||||||
|
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
CheckInputContainer(
|
||||||
|
label: "Lecture audio auto :",
|
||||||
|
isChecked: articleDTO.isReadAudioAuto,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
//print(value);
|
||||||
|
articleDTO.isReadAudioAuto = value;
|
||||||
|
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(25),
|
||||||
|
border: Border.all(width: 1.5, color: kSecond)
|
||||||
|
),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 40, left: 10, right: 10, bottom: 10),
|
||||||
|
child: Container(
|
||||||
|
height: 250,
|
||||||
|
width: size.width * 0.95,
|
||||||
|
child: ReorderableListView(
|
||||||
|
onReorder: _onReorder,
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
||||||
|
children: List.generate(
|
||||||
|
articleDTO.images!.length,
|
||||||
|
(index) {
|
||||||
|
return ListViewCardImage(
|
||||||
|
articleDTO.images!,
|
||||||
|
index,
|
||||||
|
Key('$index'),
|
||||||
|
appContext,
|
||||||
|
(images) {
|
||||||
|
setState(() {
|
||||||
|
List<ImageDTO> test = new List<ImageDTO>.from(images);
|
||||||
|
articleDTO.images = test;
|
||||||
|
List<ImageDTO> testToSend = new List<ImageDTO>.from(images);
|
||||||
|
testToSend = testToSend.where((element) => element.source_ != null).toList();
|
||||||
|
var articleToSend = new ArticleDTO();
|
||||||
|
articleToSend.images = testToSend;
|
||||||
|
articleToSend.audioIds = articleDTO.audioIds;
|
||||||
|
articleToSend.isContentTop = articleDTO.isContentTop;
|
||||||
|
articleToSend.content = articleDTO.content;
|
||||||
|
articleToSend.isReadAudioAuto = articleDTO.isReadAudioAuto;
|
||||||
|
widget.onChanged(jsonEncode(articleToSend).toString());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
true, // don't show titles
|
||||||
|
false // show description
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 10,
|
||||||
|
left: 10,
|
||||||
|
child: Text(
|
||||||
|
"Images",
|
||||||
|
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
bottom: 15,
|
||||||
|
right: 15,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
var result = await showNewOrUpdateImageSlider(null, appContext, context, true, false);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
setState(() {
|
||||||
|
result.order = articleDTO.images!.length;
|
||||||
|
articleDTO.images!.add(result);
|
||||||
|
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.width * 0.04,
|
||||||
|
width: MediaQuery.of(context).size.width * 0.04,
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
color: kTextLightColor,
|
||||||
|
size: 30.0,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: kSuccess,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: kSecond,
|
||||||
|
spreadRadius: 0.5,
|
||||||
|
blurRadius: 5,
|
||||||
|
offset: Offset(0, 1.5), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/Helpers/PDFHelper.dart';
|
||||||
|
import 'package:manager_app/constants.dart';
|
||||||
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
|
class DownloadPDF extends StatefulWidget {
|
||||||
|
final List<SectionDTO> sections;
|
||||||
|
const DownloadPDF({
|
||||||
|
Key? key,
|
||||||
|
required this.sections,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_DownloadPDFState createState() => _DownloadPDFState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DownloadPDFState extends State<DownloadPDF> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return
|
||||||
|
InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
try {
|
||||||
|
PDFHelper.downloadPDF(widget.sections);
|
||||||
|
} catch(e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 5.0),
|
||||||
|
child: Icon(Icons.qr_code, color: kPrimaryColor)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,19 +1,19 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/listView_card_geoPoint_images.dart';
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/listView_card_geoPoint_images.dart';
|
||||||
import 'package:manager_app/Screens/Resources/select_resource_modal.dart';
|
import 'package:manager_app/Screens/Resources/select_resource_modal.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class GeoPointImageList extends StatefulWidget {
|
class GeoPointImageList extends StatefulWidget {
|
||||||
final List<ImageGeoPoint> images;
|
final List<ImageGeoPoint> images;
|
||||||
final ValueChanged<List<ImageGeoPoint>> onChanged;
|
final ValueChanged<List<ImageGeoPoint>> onChanged;
|
||||||
const GeoPointImageList({
|
const GeoPointImageList({
|
||||||
Key key,
|
Key? key,
|
||||||
this.images,
|
required this.images,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -21,7 +21,7 @@ class GeoPointImageList extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _GeoPointImageListState extends State<GeoPointImageList> {
|
class _GeoPointImageListState extends State<GeoPointImageList> {
|
||||||
List<ImageGeoPoint> imagesGeo;
|
late List<ImageGeoPoint> imagesGeo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -92,16 +92,16 @@ class _GeoPointImageListState extends State<GeoPointImageList> {
|
|||||||
var result = await showSelectResourceModal(
|
var result = await showSelectResourceModal(
|
||||||
"Sélectionner une ressource",
|
"Sélectionner une ressource",
|
||||||
1,
|
1,
|
||||||
true,
|
[ResourceType.Image, ResourceType.ImageUrl],
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
ImageGeoPoint newImage = new ImageGeoPoint(imageResourceId: result.id, imageSource: result.type == ResourceType.imageUrl ? result.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ result.id);
|
ImageGeoPoint newImage = new ImageGeoPoint(imageResourceId: result.id, imageSource: result.type == ResourceType.ImageUrl ? result.data : (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.apiClient.basePath+"/api/Resource/"+ result.id);
|
||||||
print("REULT IMAGES = ");
|
//print("REULT IMAGES = ");
|
||||||
print(newImage);
|
//print(newImage);
|
||||||
imagesGeo.add(newImage);
|
imagesGeo.add(newImage);
|
||||||
print(imagesGeo);
|
//print(imagesGeo);
|
||||||
widget.onChanged(imagesGeo);
|
widget.onChanged(imagesGeo);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ListViewCardGeoPointImages extends StatefulWidget {
|
class ListViewCardGeoPointImages extends StatefulWidget {
|
||||||
@ -60,7 +60,7 @@ class _ListViewCardGeoPointImagesState extends State<ListViewCardGeoPointImages>
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.delete,
|
Icons.delete,
|
||||||
color: kPrimaryColor,
|
color: kError,
|
||||||
size: 25.0,
|
size: 25.0,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -82,8 +82,23 @@ class _ListViewCardGeoPointImagesState extends State<ListViewCardGeoPointImages>
|
|||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
imageGeoPoint.imageSource,
|
imageGeoPoint.imageSource!,
|
||||||
fit:BoxFit.scaleDown
|
fit:BoxFit.scaleDown,
|
||||||
|
loadingBuilder: (BuildContext context, Widget child,
|
||||||
|
ImageChunkEvent? loadingProgress) {
|
||||||
|
if (loadingProgress == null) {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: kPrimaryColor,
|
||||||
|
value: loadingProgress.expectedTotalBytes != null
|
||||||
|
? loadingProgress.cumulativeBytesLoaded /
|
||||||
|
loadingProgress.expectedTotalBytes!
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
/*Align(
|
/*Align(
|
||||||
|
|||||||
@ -1,29 +1,29 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/fetch_section_icon.dart';
|
import 'package:manager_app/Components/fetch_section_icon.dart';
|
||||||
import 'package:manager_app/Components/image_input_container.dart';
|
import 'package:manager_app/Components/image_input_container.dart';
|
||||||
import 'package:manager_app/Components/multi_select_container.dart';
|
import 'package:manager_app/Components/multi_select_container.dart';
|
||||||
import 'package:manager_app/Components/slider_input_container.dart';
|
import 'package:manager_app/Components/slider_input_container.dart';
|
||||||
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart';
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MapConfig extends StatefulWidget {
|
class MapConfig extends StatefulWidget {
|
||||||
final String color;
|
final String? color;
|
||||||
final String label;
|
final String? label;
|
||||||
final String initialValue;
|
final String initialValue;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
const MapConfig({
|
const MapConfig({
|
||||||
Key key,
|
Key? key,
|
||||||
this.color,
|
this.color,
|
||||||
this.label,
|
this.label,
|
||||||
this.initialValue,
|
required this.initialValue,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -31,18 +31,43 @@ class MapConfig extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MapConfigState extends State<MapConfig> {
|
class _MapConfigState extends State<MapConfig> {
|
||||||
MapDTO mapDTO;
|
late MapDTO mapDTO;
|
||||||
|
|
||||||
|
String mapType= "hybrid";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
mapDTO = MapDTO.fromJson(json.decode(widget.initialValue));
|
mapDTO = MapDTO.fromJson(json.decode(widget.initialValue))!;
|
||||||
List<GeoPointDTO> test = new List<GeoPointDTO>.from(mapDTO.points);
|
List<GeoPointDTO> test = new List<GeoPointDTO>.from(mapDTO.points!);
|
||||||
mapDTO.points = test;
|
mapDTO.points = test;
|
||||||
|
|
||||||
|
if(mapDTO.mapType != null) {
|
||||||
|
switch(mapDTO.mapType!.value) {
|
||||||
|
case 0:
|
||||||
|
mapType = "none";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
mapType = "normal";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
mapType = "satellite";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
mapType = "terrain";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
mapType = "hybrid";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*print("MAPDTO");
|
||||||
|
print(mapDTO);
|
||||||
|
print(mapDTO.mapType.toString());
|
||||||
if (mapDTO.mapType == null) {
|
if (mapDTO.mapType == null) {
|
||||||
mapDTO.mapType = MapTypeApp.hybrid;
|
mapDTO.mapType = MapTypeApp.hybrid;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -67,8 +92,13 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
imageFit: BoxFit.contain,
|
imageFit: BoxFit.contain,
|
||||||
onChanged: (ResourceDTO resource) {
|
onChanged: (ResourceDTO resource) {
|
||||||
mapDTO.iconSource = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id;
|
if(resource.id == null) {
|
||||||
mapDTO.iconResourceId = resource.id;
|
mapDTO.iconSource = null;
|
||||||
|
mapDTO.iconResourceId = null;
|
||||||
|
} else {
|
||||||
|
mapDTO.iconResourceId = resource.id;
|
||||||
|
mapDTO.iconSource = resource.type == ResourceType.ImageUrl ? resource.data : (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.apiClient.basePath+"/api/Resource/"+ resource.id!;
|
||||||
|
}
|
||||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||||
},
|
},
|
||||||
isSmall: true
|
isSmall: true
|
||||||
@ -76,11 +106,13 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
// Map Type
|
// Map Type
|
||||||
MultiSelectContainer(
|
MultiSelectContainer(
|
||||||
label: "Type :",
|
label: "Type :",
|
||||||
initialValue: [mapDTO.mapType.toString()],
|
initialValue: [mapType], //mapDTO.mapType.toString()
|
||||||
isMultiple: false,
|
isMultiple: false,
|
||||||
values: map_types,
|
values: map_types,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
var tempOutput = new List<String>.from(value);
|
var tempOutput = new List<String>.from(value);
|
||||||
|
print("Type MAP");
|
||||||
|
print(value);
|
||||||
mapDTO.mapType = MapTypeApp.fromJson(tempOutput[0]);
|
mapDTO.mapType = MapTypeApp.fromJson(tempOutput[0]);
|
||||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||||
},
|
},
|
||||||
@ -88,7 +120,7 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
// Zoom
|
// Zoom
|
||||||
SliderInputContainer(
|
SliderInputContainer(
|
||||||
label: "Zoom:",
|
label: "Zoom:",
|
||||||
initialValue: mapDTO.zoom != null ? mapDTO.zoom.toDouble() : 18,
|
initialValue: mapDTO.zoom != null ? mapDTO.zoom!.toDouble() : 18,
|
||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 30,
|
max: 30,
|
||||||
@ -114,14 +146,14 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 8),
|
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 8),
|
||||||
itemCount: mapDTO.points.length,
|
itemCount: mapDTO.points!.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return
|
return
|
||||||
Container(
|
Container(
|
||||||
decoration: boxDecoration(mapDTO.points[index], appContext),
|
decoration: boxDecoration(mapDTO.points![index], appContext),
|
||||||
padding: const EdgeInsets.all(5),
|
padding: const EdgeInsets.all(5),
|
||||||
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
child: getElement(index, mapDTO.points[index], size, appContext),
|
child: getElement(index, mapDTO.points![index], size, appContext),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@ -143,7 +175,7 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
null,
|
null,
|
||||||
(GeoPointDTO geoPoint) {
|
(GeoPointDTO geoPoint) {
|
||||||
setState(() {
|
setState(() {
|
||||||
mapDTO.points.add(geoPoint);
|
mapDTO.points!.add(geoPoint);
|
||||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -182,7 +214,7 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getElement(int index, GeoPointDTO point, Size size, AppContext appContext) {
|
getElement(int index, GeoPointDTO? point, Size size, AppContext appContext) {
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
@ -192,7 +224,7 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: AutoSizeText(
|
child: AutoSizeText(
|
||||||
point.title == null ? "" : point.title[0].value,
|
point != null ? point.title == null ? "" : point.title![0].value! : "",
|
||||||
style: new TextStyle(fontSize: 20),
|
style: new TextStyle(fontSize: 20),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -203,7 +235,7 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
top: 0,
|
top: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
getSectionIcon(SectionType.map),
|
getSectionIcon(SectionType.Map),
|
||||||
color: kSecond,
|
color: kSecond,
|
||||||
size: 18.0,
|
size: 18.0,
|
||||||
),
|
),
|
||||||
@ -214,10 +246,10 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showNewOrUpdateGeoPoint(
|
showNewOrUpdateGeoPoint(
|
||||||
mapDTO.points[index],
|
mapDTO.points![index],
|
||||||
(GeoPointDTO geoPoint) {
|
(GeoPointDTO geoPoint) {
|
||||||
setState(() {
|
setState(() {
|
||||||
mapDTO.points[index] = geoPoint;
|
mapDTO.points![index] = geoPoint;
|
||||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -237,13 +269,13 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
mapDTO.points.removeAt(index);
|
mapDTO.points!.removeAt(index);
|
||||||
});
|
});
|
||||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.delete,
|
Icons.delete,
|
||||||
color: kPrimaryColor,
|
color: kError,
|
||||||
size: 20.0,
|
size: 20.0,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -7,9 +7,9 @@ import 'package:manager_app/Models/managerContext.dart';
|
|||||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart';
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/geopoint_image_list.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, AppContext appContext, BuildContext context) {
|
void showNewOrUpdateGeoPoint(GeoPointDTO? inputGeoPointDTO, Function getResult, AppContext appContext, BuildContext context) {
|
||||||
GeoPointDTO geoPointDTO = new GeoPointDTO();
|
GeoPointDTO geoPointDTO = new GeoPointDTO();
|
||||||
|
|
||||||
if (inputGeoPointDTO != null) {
|
if (inputGeoPointDTO != null) {
|
||||||
@ -20,12 +20,12 @@ void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, A
|
|||||||
geoPointDTO.images = <ImageGeoPoint>[];
|
geoPointDTO.images = <ImageGeoPoint>[];
|
||||||
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
managerAppContext.selectedConfiguration.languages.forEach((element) {
|
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
|
||||||
var translationDTO = new TranslationDTO();
|
var translationDTO = new TranslationDTO();
|
||||||
translationDTO.language = element;
|
translationDTO.language = element;
|
||||||
translationDTO.value = "";
|
translationDTO.value = "";
|
||||||
geoPointDTO.title.add(translationDTO);
|
geoPointDTO.title!.add(translationDTO);
|
||||||
geoPointDTO.description.add(translationDTO);
|
geoPointDTO.description!.add(translationDTO);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,14 +47,14 @@ void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, A
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
StringInputContainer(
|
StringInputContainer(
|
||||||
label: "Latitude :",
|
label: "Latitude (#.#):",
|
||||||
initialValue: geoPointDTO.latitude,
|
initialValue: geoPointDTO.latitude,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
geoPointDTO.latitude = value;
|
geoPointDTO.latitude = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
StringInputContainer(
|
StringInputContainer(
|
||||||
label: "Longitude :",
|
label: "Longitude (#.#):",
|
||||||
initialValue: geoPointDTO.longitude,
|
initialValue: geoPointDTO.longitude,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
geoPointDTO.longitude = value;
|
geoPointDTO.longitude = value;
|
||||||
@ -87,7 +87,7 @@ void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, A
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: GeoPointImageList(
|
child: GeoPointImageList(
|
||||||
images: geoPointDTO.images,
|
images: geoPointDTO.images!,
|
||||||
onChanged: (List<ImageGeoPoint> imagesOutput) {
|
onChanged: (List<ImageGeoPoint> imagesOutput) {
|
||||||
geoPointDTO.images = imagesOutput;
|
geoPointDTO.images = imagesOutput;
|
||||||
},
|
},
|
||||||
@ -152,7 +152,7 @@ void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, A
|
|||||||
getTranslations(BuildContext context, AppContext appContext, GeoPointDTO geoPointDTO) {
|
getTranslations(BuildContext context, AppContext appContext, GeoPointDTO geoPointDTO) {
|
||||||
List<Widget> translations = <Widget>[];
|
List<Widget> translations = <Widget>[];
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
for(var language in managerAppContext.selectedConfiguration.languages) {
|
for(var language in managerAppContext.selectedConfiguration!.languages!) {
|
||||||
translations.add(
|
translations.add(
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -181,18 +181,18 @@ getTranslations(BuildContext context, AppContext appContext, GeoPointDTO geoPoin
|
|||||||
label: "Titre:",
|
label: "Titre:",
|
||||||
color: kWhite,
|
color: kWhite,
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
initialValue: geoPointDTO.title.where((element) => element.language == language).first.value,
|
initialValue: geoPointDTO.title!.where((element) => element.language == language).first.value!,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
geoPointDTO.title.where((element) => element.language == language).first.value = value;
|
geoPointDTO.title!.where((element) => element.language == language).first.value = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextFormInputContainer(
|
TextFormInputContainer(
|
||||||
label: "Description:",
|
label: "Description:",
|
||||||
color: kWhite,
|
color: kWhite,
|
||||||
isTitle: false,
|
isTitle: false,
|
||||||
initialValue: geoPointDTO.description.where((element) => element.language == language).first.value,
|
initialValue: geoPointDTO.description!.where((element) => element.language == language).first.value!,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
geoPointDTO.description.where((element) => element.language == language).first.value = value;
|
geoPointDTO.description!.where((element) => element.language == language).first.value = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/fetch_section_icon.dart';
|
import 'package:manager_app/Components/fetch_section_icon.dart';
|
||||||
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart';
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ListViewCardSubSection extends StatefulWidget {
|
class ListViewCardSubSection extends StatefulWidget {
|
||||||
@ -57,7 +58,8 @@ class _ListViewCardSubSection extends State<ListViewCardSubSection> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
showEditSubSection(
|
showEditSubSection(
|
||||||
widget.listItems[widget.index],
|
widget.listItems[widget.index],
|
||||||
(value) {
|
(SectionDTO value) async {
|
||||||
|
var result = await (appContext.getContext() as ManagerAppContext).clientAPI!.sectionApi!.sectionUpdate(value);
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.listItems[widget.index] = value;
|
widget.listItems[widget.index] = value;
|
||||||
widget.onChanged(widget.listItems);
|
widget.onChanged(widget.listItems);
|
||||||
@ -85,7 +87,7 @@ class _ListViewCardSubSection extends State<ListViewCardSubSection> {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.delete,
|
Icons.delete,
|
||||||
color: kPrimaryColor,
|
color: kError,
|
||||||
size: 25.0,
|
size: 25.0,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -107,7 +109,7 @@ class _ListViewCardSubSection extends State<ListViewCardSubSection> {
|
|||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: AutoSizeText(
|
child: AutoSizeText(
|
||||||
sectionDTO.label,
|
sectionDTO.label!,
|
||||||
style: new TextStyle(fontSize: 15),
|
style: new TextStyle(fontSize: 15),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -149,7 +151,7 @@ class _ListViewCardSubSection extends State<ListViewCardSubSection> {
|
|||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.delete,
|
Icons.delete,
|
||||||
color: kPrimaryColor,
|
color: kPrimaryColorOld,
|
||||||
size: 20.0,
|
size: 20.0,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,27 +1,27 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/fetch_section_icon.dart';
|
import 'package:manager_app/Components/fetch_section_icon.dart';
|
||||||
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart';
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Menu/listView_card_subSection.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/new_section_popup.dart';
|
import 'package:manager_app/Screens/Configurations/new_section_popup.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MenuConfig extends StatefulWidget {
|
class MenuConfig extends StatefulWidget {
|
||||||
final String color;
|
final String? color;
|
||||||
final String label;
|
final String? label;
|
||||||
final String initialValue;
|
final String initialValue;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
const MenuConfig({
|
const MenuConfig({
|
||||||
Key key,
|
Key? key,
|
||||||
this.color,
|
this.color,
|
||||||
this.label,
|
this.label,
|
||||||
this.initialValue,
|
required this.initialValue,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -29,14 +29,14 @@ class MenuConfig extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MenuConfigState extends State<MenuConfig> {
|
class _MenuConfigState extends State<MenuConfig> {
|
||||||
MenuDTO menuDTO;
|
late MenuDTO menuDTO;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
menuDTO = MenuDTO.fromJson(json.decode(widget.initialValue));
|
menuDTO = MenuDTO.fromJson(json.decode(widget.initialValue))!;
|
||||||
List<SectionDTO> test = new List<SectionDTO>.from(menuDTO.sections);
|
List<SectionDTO> test = new List<SectionDTO>.from(menuDTO.sections!);
|
||||||
menuDTO.sections = test;
|
menuDTO.sections = test;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +56,8 @@ class _MenuConfigState extends State<MenuConfig> {
|
|||||||
if (newIndex > oldIndex) {
|
if (newIndex > oldIndex) {
|
||||||
newIndex -= 1;
|
newIndex -= 1;
|
||||||
}
|
}
|
||||||
final SectionDTO item = menuDTO.sections.removeAt(oldIndex);
|
final SectionDTO item = menuDTO.sections!.removeAt(oldIndex);
|
||||||
menuDTO.sections.insert(newIndex, item);
|
menuDTO.sections!.insert(newIndex, item);
|
||||||
|
|
||||||
/*var i = 0;
|
/*var i = 0;
|
||||||
menuDTO.sections.forEach((image) {
|
menuDTO.sections.forEach((image) {
|
||||||
@ -82,10 +82,10 @@ class _MenuConfigState extends State<MenuConfig> {
|
|||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
||||||
children: List.generate(
|
children: List.generate(
|
||||||
menuDTO.sections.length,
|
menuDTO.sections!.length,
|
||||||
(index) {
|
(index) {
|
||||||
return ListViewCardSubSection(
|
return ListViewCardSubSection(
|
||||||
menuDTO.sections,
|
menuDTO.sections!,
|
||||||
index,
|
index,
|
||||||
Key('$index'),
|
Key('$index'),
|
||||||
appContext,
|
appContext,
|
||||||
@ -108,18 +108,20 @@ class _MenuConfigState extends State<MenuConfig> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showNewSection(
|
showNewSection(
|
||||||
appContext.getContext().selectedConfiguration.id,
|
(appContext.getContext() as ManagerAppContext).selectedConfiguration!.id!,
|
||||||
appContext,
|
appContext,
|
||||||
context,
|
context,
|
||||||
true,
|
true,
|
||||||
(SectionDTO newSubsection) {
|
(SectionDTO newSubsection) {
|
||||||
setState(() {
|
setState(() {
|
||||||
print("RECEIVED new swubssection");
|
//print("RECEIVED new swubssection");
|
||||||
print(newSubsection);
|
//print(newSubsection);
|
||||||
menuDTO.sections.add(newSubsection);
|
menuDTO.sections!.add(newSubsection);
|
||||||
widget.onChanged(jsonEncode(menuDTO).toString());
|
widget.onChanged(jsonEncode(menuDTO).toString());
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: MediaQuery.of(context).size.width * 0.04,
|
height: MediaQuery.of(context).size.width * 0.04,
|
||||||
@ -159,7 +161,7 @@ class _MenuConfigState extends State<MenuConfig> {
|
|||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: AutoSizeText(
|
child: AutoSizeText(
|
||||||
sectionDTO.label,
|
sectionDTO.label!,
|
||||||
style: new TextStyle(fontSize: 15),
|
style: new TextStyle(fontSize: 15),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -195,13 +197,13 @@ class _MenuConfigState extends State<MenuConfig> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
menuDTO.sections.removeAt(index);
|
menuDTO.sections!.removeAt(index);
|
||||||
widget.onChanged(jsonEncode(menuDTO).toString());
|
widget.onChanged(jsonEncode(menuDTO).toString());
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.delete,
|
Icons.delete,
|
||||||
color: kPrimaryColor,
|
color: kError,
|
||||||
size: 20.0,
|
size: 20.0,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -5,11 +5,12 @@ import 'package:manager_app/Components/rounded_button.dart';
|
|||||||
import 'package:manager_app/Components/string_input_container.dart';
|
import 'package:manager_app/Components/string_input_container.dart';
|
||||||
import 'package:manager_app/Components/text_form_input_container.dart';
|
import 'package:manager_app/Components/text_form_input_container.dart';
|
||||||
import 'package:manager_app/Models/managerContext.dart';
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Quizz/quizz_config.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/slider_config.dart';
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/slider_config.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/WebOrVideo/web_video_config.dart';
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/WebOrVideo/web_video_config.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
import '../Map/map_config.dart';
|
import '../Map/map_config.dart';
|
||||||
import 'menu_config.dart';
|
import 'menu_config.dart';
|
||||||
@ -46,8 +47,13 @@ void showEditSubSection(SectionDTO subSectionDTO, Function getResult, AppContext
|
|||||||
initialValue: subSectionDTO.imageId,
|
initialValue: subSectionDTO.imageId,
|
||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
onChanged: (ResourceDTO resource) {
|
onChanged: (ResourceDTO resource) {
|
||||||
subSectionDTO.imageId = resource.id;
|
if(resource.id == null) {
|
||||||
subSectionDTO.imageSource = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id;
|
subSectionDTO.imageId = null;
|
||||||
|
subSectionDTO.imageSource = null;
|
||||||
|
} else {
|
||||||
|
subSectionDTO.imageId = resource.id;
|
||||||
|
subSectionDTO.imageSource = resource.type == ResourceType.ImageUrl ? resource.data : (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.apiClient.basePath+"/api/Resource/"+ resource.id!;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
isSmall: true,
|
isSmall: true,
|
||||||
),
|
),
|
||||||
@ -125,43 +131,52 @@ void showEditSubSection(SectionDTO subSectionDTO, Function getResult, AppContext
|
|||||||
|
|
||||||
getSpecificData(SectionDTO sectionDTO, BuildContext context, AppContext appContext) {
|
getSpecificData(SectionDTO sectionDTO, BuildContext context, AppContext appContext) {
|
||||||
switch(sectionDTO.type) {
|
switch(sectionDTO.type) {
|
||||||
case SectionType.map:
|
case SectionType.Map:
|
||||||
return MapConfig(
|
return MapConfig(
|
||||||
initialValue: sectionDTO.data,
|
initialValue: sectionDTO.data!,
|
||||||
onChanged: (String data) {
|
onChanged: (String data) {
|
||||||
print("Received info in parent");
|
//print("Received info in parent");
|
||||||
print(data);
|
//print(data);
|
||||||
sectionDTO.data = data;
|
sectionDTO.data = data;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.slider:
|
case SectionType.Slider:
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.of(context).size.width * 0.5,
|
width: MediaQuery.of(context).size.width * 0.5,
|
||||||
height: MediaQuery.of(context).size.height * 0.5,
|
height: MediaQuery.of(context).size.height * 0.5,
|
||||||
child: SliderConfig(
|
child: SliderConfig(
|
||||||
initialValue: sectionDTO.data,
|
initialValue: sectionDTO.data!,
|
||||||
onChanged: (String data) {
|
onChanged: (String data) {
|
||||||
print("Received info in parent");
|
//print("Received info in parent");
|
||||||
print(data);
|
//print(data);
|
||||||
sectionDTO.data = data;
|
sectionDTO.data = data;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case SectionType.video:
|
case SectionType.Video:
|
||||||
case SectionType.web:
|
case SectionType.Web:
|
||||||
return WebOrVideoConfig(
|
return WebOrVideoConfig(
|
||||||
label: sectionDTO.type == SectionType.video ? "Url de la vidéo:": "Url du site web:",
|
label: sectionDTO.type == SectionType.Video ? "Url de la vidéo:": "Url du site web:",
|
||||||
initialValue: sectionDTO.data,
|
initialValue: sectionDTO.data!,
|
||||||
onChanged: (String data) {
|
onChanged: (String data) {
|
||||||
sectionDTO.data = data;
|
sectionDTO.data = data;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.menu:
|
case SectionType.Menu:
|
||||||
return MenuConfig(
|
return MenuConfig(
|
||||||
initialValue: sectionDTO.data,
|
initialValue: sectionDTO.data!,
|
||||||
onChanged: (String data) {
|
onChanged: (String data) {
|
||||||
print("Received info in parent");
|
//print("Received info in parent");
|
||||||
print(data);
|
//print(data);
|
||||||
|
sectionDTO.data = data;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
case SectionType.Quizz:
|
||||||
|
return QuizzConfig(
|
||||||
|
initialValue: sectionDTO.data!,
|
||||||
|
onChanged: (String data) {
|
||||||
|
//print("Received info in parent");
|
||||||
|
//print(data);
|
||||||
sectionDTO.data = data;
|
sectionDTO.data = data;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -171,7 +186,7 @@ getSpecificData(SectionDTO sectionDTO, BuildContext context, AppContext appConte
|
|||||||
getTranslations(BuildContext context, AppContext appContext, SectionDTO subSectionDTO) {
|
getTranslations(BuildContext context, AppContext appContext, SectionDTO subSectionDTO) {
|
||||||
List<Widget> translations = <Widget>[];
|
List<Widget> translations = <Widget>[];
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
for(var language in managerAppContext.selectedConfiguration.languages) {
|
for(var language in managerAppContext.selectedConfiguration!.languages!) {
|
||||||
translations.add(
|
translations.add(
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -201,18 +216,18 @@ getTranslations(BuildContext context, AppContext appContext, SectionDTO subSecti
|
|||||||
color: kWhite,
|
color: kWhite,
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
initialValue: subSectionDTO.title.where((element) => element.language == language).first.value,
|
initialValue: subSectionDTO.title!.where((element) => element.language == language).first.value!,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
subSectionDTO.title.where((element) => element.language == language).first.value = value;
|
subSectionDTO.title!.where((element) => element.language == language).first.value = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextFormInputContainer(
|
TextFormInputContainer(
|
||||||
label: "Description:",
|
label: "Description:",
|
||||||
color: kWhite,
|
color: kWhite,
|
||||||
isTitle: false,
|
isTitle: false,
|
||||||
initialValue: subSectionDTO.description.where((element) => element.language == language).first.value,
|
initialValue: subSectionDTO.description!.where((element) => element.language == language).first.value!,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
subSectionDTO.description.where((element) => element.language == language).first.value = value;
|
subSectionDTO.description!.where((element) => element.language == language).first.value = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -8,9 +8,9 @@ import 'package:manager_app/Models/managerContext.dart';
|
|||||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart';
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO inputQuestionDTO, AppContext appContext, BuildContext context, String text) async {
|
Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO? inputQuestionDTO, AppContext appContext, BuildContext context, String text) async {
|
||||||
QuestionDTO questionDTO = new QuestionDTO();
|
QuestionDTO questionDTO = new QuestionDTO();
|
||||||
|
|
||||||
if (inputQuestionDTO != null) {
|
if (inputQuestionDTO != null) {
|
||||||
@ -19,12 +19,12 @@ Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO inputQuestionDTO, A
|
|||||||
questionDTO.label = <TranslationDTO>[];
|
questionDTO.label = <TranslationDTO>[];
|
||||||
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
managerAppContext.selectedConfiguration.languages.forEach((element) {
|
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
|
||||||
var translationMessageDTO = new TranslationDTO();
|
var translationMessageDTO = new TranslationDTO();
|
||||||
translationMessageDTO.language = element;
|
translationMessageDTO.language = element;
|
||||||
translationMessageDTO.value = "";
|
translationMessageDTO.value = "";
|
||||||
|
|
||||||
questionDTO.label.add(translationMessageDTO);
|
questionDTO.label!.add(translationMessageDTO);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,9 +54,13 @@ Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO inputQuestionDTO, A
|
|||||||
initialValue: questionDTO.resourceId,
|
initialValue: questionDTO.resourceId,
|
||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
onChanged: (ResourceDTO resource) {
|
onChanged: (ResourceDTO resource) {
|
||||||
var result = resource;
|
if(resource.id == null) {
|
||||||
questionDTO.source_ = result.type == ResourceType.imageUrl ? result.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ result.id;
|
questionDTO.resourceId = null;
|
||||||
questionDTO.resourceId = result.id;
|
questionDTO.source_ = null;
|
||||||
|
} else {
|
||||||
|
questionDTO.resourceId = resource.id;
|
||||||
|
questionDTO.source_ = resource.type == ResourceType.ImageUrl ? resource.data : (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.apiClient.basePath+"/api/Resource/"+ resource.id!;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
isSmall: true
|
isSmall: true
|
||||||
),
|
),
|
||||||
@ -88,7 +92,7 @@ Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO inputQuestionDTO, A
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: QuizzResponseList(
|
child: QuizzResponseList(
|
||||||
responses: questionDTO.responses,
|
responses: questionDTO.responses!,
|
||||||
onChanged: (List<ResponseDTO> responsesOutput) {
|
onChanged: (List<ResponseDTO> responsesOutput) {
|
||||||
questionDTO.responses = responsesOutput;
|
questionDTO.responses = responsesOutput;
|
||||||
},
|
},
|
||||||
@ -131,7 +135,7 @@ Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO inputQuestionDTO, A
|
|||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
textColor: kWhite,
|
textColor: kWhite,
|
||||||
press: () {
|
press: () {
|
||||||
if(!questionDTO.label.any((label) => label.value == null || label.value.trim() == "")) {
|
if(!questionDTO.label!.any((label) => label.value == null || label.value!.trim() == "")) {
|
||||||
Navigator.pop(dialogContext, questionDTO);
|
Navigator.pop(dialogContext, questionDTO);
|
||||||
} else {
|
} else {
|
||||||
showNotification(kPrimaryColor, kWhite, "La traduction n'est pas complète", context, null);
|
showNotification(kPrimaryColor, kWhite, "La traduction n'est pas complète", context, null);
|
||||||
@ -152,7 +156,7 @@ Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO inputQuestionDTO, A
|
|||||||
getTranslations(BuildContext context, AppContext appContext, QuestionDTO questionDTO) {
|
getTranslations(BuildContext context, AppContext appContext, QuestionDTO questionDTO) {
|
||||||
List<Widget> translations = <Widget>[];
|
List<Widget> translations = <Widget>[];
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
for(var language in managerAppContext.selectedConfiguration.languages) {
|
for(var language in managerAppContext.selectedConfiguration!.languages!) {
|
||||||
translations.add(
|
translations.add(
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -181,9 +185,9 @@ getTranslations(BuildContext context, AppContext appContext, QuestionDTO questio
|
|||||||
label: "Question:",
|
label: "Question:",
|
||||||
color: kWhite,
|
color: kWhite,
|
||||||
isTitle: false,
|
isTitle: false,
|
||||||
initialValue: questionDTO.label.where((element) => element.language == language).first.value,
|
initialValue: questionDTO.label!.where((element) => element.language == language).first.value!,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
questionDTO.label.where((element) => element.language == language).first.value = value;
|
questionDTO.label!.where((element) => element.language == language).first.value = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:manager_app/Components/image_input_container.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/message_notification.dart';
|
import 'package:manager_app/Components/message_notification.dart';
|
||||||
import 'package:manager_app/Components/rounded_button.dart';
|
import 'package:manager_app/Components/rounded_button.dart';
|
||||||
@ -7,9 +6,9 @@ import 'package:manager_app/Components/text_form_input_container.dart';
|
|||||||
import 'package:manager_app/Models/managerContext.dart';
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
Future<ResponseDTO> showNewOrUpdateResponseQuizz(ResponseDTO inputResponseDTO, AppContext appContext, BuildContext context, String text) async {
|
Future<ResponseDTO> showNewOrUpdateResponseQuizz(ResponseDTO? inputResponseDTO, AppContext appContext, BuildContext context, String text) async {
|
||||||
ResponseDTO responseDTO = new ResponseDTO();
|
ResponseDTO responseDTO = new ResponseDTO();
|
||||||
|
|
||||||
if (inputResponseDTO != null) {
|
if (inputResponseDTO != null) {
|
||||||
@ -18,12 +17,12 @@ Future<ResponseDTO> showNewOrUpdateResponseQuizz(ResponseDTO inputResponseDTO, A
|
|||||||
responseDTO.label = <TranslationDTO>[];
|
responseDTO.label = <TranslationDTO>[];
|
||||||
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
managerAppContext.selectedConfiguration.languages.forEach((element) {
|
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
|
||||||
var translationMessageDTO = new TranslationDTO();
|
var translationMessageDTO = new TranslationDTO();
|
||||||
translationMessageDTO.language = element;
|
translationMessageDTO.language = element;
|
||||||
translationMessageDTO.value = "";
|
translationMessageDTO.value = "";
|
||||||
|
|
||||||
responseDTO.label.add(translationMessageDTO);
|
responseDTO.label!.add(translationMessageDTO);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +107,7 @@ Future<ResponseDTO> showNewOrUpdateResponseQuizz(ResponseDTO inputResponseDTO, A
|
|||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
textColor: kWhite,
|
textColor: kWhite,
|
||||||
press: () {
|
press: () {
|
||||||
if(!responseDTO.label.any((label) => label.value == null || label.value.trim() == "")) {
|
if(!responseDTO.label!.any((label) => label.value == null || label.value!.trim() == "")) {
|
||||||
Navigator.pop(dialogContext, responseDTO);
|
Navigator.pop(dialogContext, responseDTO);
|
||||||
} else {
|
} else {
|
||||||
showNotification(kPrimaryColor, kWhite, "La traduction n'est pas complète", context, null);
|
showNotification(kPrimaryColor, kWhite, "La traduction n'est pas complète", context, null);
|
||||||
@ -129,7 +128,7 @@ Future<ResponseDTO> showNewOrUpdateResponseQuizz(ResponseDTO inputResponseDTO, A
|
|||||||
getTranslations(BuildContext context, AppContext appContext, ResponseDTO responseDTO) {
|
getTranslations(BuildContext context, AppContext appContext, ResponseDTO responseDTO) {
|
||||||
List<Widget> translations = <Widget>[];
|
List<Widget> translations = <Widget>[];
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
for(var language in managerAppContext.selectedConfiguration.languages) {
|
for(var language in managerAppContext.selectedConfiguration!.languages!) {
|
||||||
translations.add(
|
translations.add(
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -158,9 +157,9 @@ getTranslations(BuildContext context, AppContext appContext, ResponseDTO respons
|
|||||||
label: "Réponse:",
|
label: "Réponse:",
|
||||||
color: kWhite,
|
color: kWhite,
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
initialValue: responseDTO.label.where((element) => element.language == language).first.value,
|
initialValue: responseDTO.label!.where((element) => element.language == language).first.value!,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
responseDTO.label.where((element) => element.language == language).first.value = value;
|
responseDTO.label!.where((element) => element.language == language).first.value = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import 'package:manager_app/Components/text_form_input_container.dart';
|
|||||||
import 'package:manager_app/Models/managerContext.dart';
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
Future<LevelDTO> showNewOrUpdateScoreQuizz(LevelDTO inputLevelDTO, AppContext appContext, BuildContext context, String text) async {
|
Future<LevelDTO?> showNewOrUpdateScoreQuizz(LevelDTO? inputLevelDTO, AppContext appContext, BuildContext context, String text) async {
|
||||||
LevelDTO levelDTO = new LevelDTO();
|
LevelDTO levelDTO = new LevelDTO();
|
||||||
|
|
||||||
if (inputLevelDTO != null) {
|
if (inputLevelDTO != null) {
|
||||||
@ -17,12 +17,12 @@ Future<LevelDTO> showNewOrUpdateScoreQuizz(LevelDTO inputLevelDTO, AppContext ap
|
|||||||
levelDTO.label = <TranslationDTO>[];
|
levelDTO.label = <TranslationDTO>[];
|
||||||
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
managerAppContext.selectedConfiguration.languages.forEach((element) {
|
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
|
||||||
var translationMessageDTO = new TranslationDTO();
|
var translationMessageDTO = new TranslationDTO();
|
||||||
translationMessageDTO.language = element;
|
translationMessageDTO.language = element;
|
||||||
translationMessageDTO.value = "";
|
translationMessageDTO.value = "";
|
||||||
|
|
||||||
levelDTO.label.add(translationMessageDTO);
|
levelDTO.label!.add(translationMessageDTO);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,9 +48,13 @@ Future<LevelDTO> showNewOrUpdateScoreQuizz(LevelDTO inputLevelDTO, AppContext ap
|
|||||||
initialValue: levelDTO.resourceId,
|
initialValue: levelDTO.resourceId,
|
||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
onChanged: (ResourceDTO resource) {
|
onChanged: (ResourceDTO resource) {
|
||||||
var result = resource;
|
if(resource.id == null) {
|
||||||
levelDTO.source_ = result.type == ResourceType.imageUrl ? result.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ result.id;
|
levelDTO.resourceId = null;
|
||||||
levelDTO.resourceId = result.id;
|
levelDTO.source_ = null;
|
||||||
|
} else {
|
||||||
|
levelDTO.resourceId = resource.id;
|
||||||
|
levelDTO.source_ = resource.type == ResourceType.ImageUrl ? resource.data : (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.apiClient.basePath+"/api/Resource/"+ resource.id!;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
isSmall: true
|
isSmall: true
|
||||||
),
|
),
|
||||||
@ -117,7 +121,7 @@ Future<LevelDTO> showNewOrUpdateScoreQuizz(LevelDTO inputLevelDTO, AppContext ap
|
|||||||
getTranslations(BuildContext context, AppContext appContext, LevelDTO levelDTO) {
|
getTranslations(BuildContext context, AppContext appContext, LevelDTO levelDTO) {
|
||||||
List<Widget> translations = <Widget>[];
|
List<Widget> translations = <Widget>[];
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
for(var language in managerAppContext.selectedConfiguration.languages) {
|
for(var language in managerAppContext.selectedConfiguration!.languages!) {
|
||||||
translations.add(
|
translations.add(
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -146,9 +150,9 @@ getTranslations(BuildContext context, AppContext appContext, LevelDTO levelDTO)
|
|||||||
label: "Message:",
|
label: "Message:",
|
||||||
color: kWhite,
|
color: kWhite,
|
||||||
isTitle: false,
|
isTitle: false,
|
||||||
initialValue: levelDTO.label.where((element) => element.language == language).first.value,
|
initialValue: levelDTO.label!.where((element) => element.language == language).first.value!,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
levelDTO.label.where((element) => element.language == language).first.value = value;
|
levelDTO.label!.where((element) => element.language == language).first.value = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'new_update_response_quizz.dart';
|
import 'new_update_response_quizz.dart';
|
||||||
@ -12,9 +11,9 @@ class QuizzResponseList extends StatefulWidget {
|
|||||||
final List<ResponseDTO> responses;
|
final List<ResponseDTO> responses;
|
||||||
final ValueChanged<List<ResponseDTO>> onChanged;
|
final ValueChanged<List<ResponseDTO>> onChanged;
|
||||||
const QuizzResponseList({
|
const QuizzResponseList({
|
||||||
Key key,
|
Key? key,
|
||||||
this.responses,
|
required this.responses,
|
||||||
this.onChanged,
|
required this.onChanged,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -22,7 +21,7 @@ class QuizzResponseList extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _QuizzResponseListState extends State<QuizzResponseList> {
|
class _QuizzResponseListState extends State<QuizzResponseList> {
|
||||||
List<ResponseDTO> responsesMiddle;
|
late List<ResponseDTO> responsesMiddle;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -139,7 +138,7 @@ class _QuizzResponseListState extends State<QuizzResponseList> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(2.0),
|
padding: const EdgeInsets.all(2.0),
|
||||||
child: AutoSizeText(
|
child: AutoSizeText(
|
||||||
response.label == null ? "" : response.label[0].value,
|
response.label == null ? "" : response.label![0].value!,
|
||||||
style: new TextStyle(fontSize: 15),
|
style: new TextStyle(fontSize: 15),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -162,9 +161,9 @@ class _QuizzResponseListState extends State<QuizzResponseList> {
|
|||||||
value: response.isGood,
|
value: response.isGood,
|
||||||
checkColor: Colors.white,
|
checkColor: Colors.white,
|
||||||
activeColor: kPrimaryColor,
|
activeColor: kPrimaryColor,
|
||||||
onChanged: (bool value) {
|
onChanged: (bool? value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
response.isGood = !response.isGood;
|
response.isGood = !response.isGood!;
|
||||||
widget.onChanged(responsesMiddle);
|
widget.onChanged(responsesMiddle);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -184,7 +183,7 @@ class _QuizzResponseListState extends State<QuizzResponseList> {
|
|||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
responsesMiddle[response.order] = result;
|
responsesMiddle[response.order!] = result;
|
||||||
widget.onChanged(responsesMiddle);
|
widget.onChanged(responsesMiddle);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -204,7 +203,7 @@ class _QuizzResponseListState extends State<QuizzResponseList> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
responsesMiddle.removeAt(response.order);
|
responsesMiddle.removeAt(response.order!);
|
||||||
widget.onChanged(responsesMiddle);
|
widget.onChanged(responsesMiddle);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -212,7 +211,7 @@ class _QuizzResponseListState extends State<QuizzResponseList> {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.delete,
|
Icons.delete,
|
||||||
color: kPrimaryColor,
|
color: kError,
|
||||||
size: 25.0,
|
size: 25.0,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||