Init version 2.0.0 + wip visitNamur request + wip upload resource to firebase
This commit is contained in:
parent
ff18f37b1b
commit
dca7474551
@ -1,5 +1,6 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
import 'package:manager_app/Components/fetch_section_icon.dart';
|
||||
import 'package:manager_app/Components/image_input_container.dart';
|
||||
import 'package:manager_app/Components/multi_select_container.dart';
|
||||
@ -223,11 +224,13 @@ class _MapConfigState extends State<MapConfig> {
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: AutoSizeText(
|
||||
point != null ? point.title == null ? "" : point.title![0].value! : "",
|
||||
style: new TextStyle(fontSize: 20),
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
child: HtmlWidget(
|
||||
point != null ? point.title == null ? "" : point.title![0].value! : "",
|
||||
//textAlign: TextAlign.left,
|
||||
customStylesBuilder: (element) {
|
||||
return {'text-align': 'center'};
|
||||
},
|
||||
textStyle: TextStyle(fontSize: 20)
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -60,7 +60,7 @@ class _DeviceElementState extends State<DeviceElement> {
|
||||
child: Row(
|
||||
children: [
|
||||
AutoSizeText(
|
||||
deviceDTO.name!,
|
||||
deviceDTO.name != null ? deviceDTO.name! : deviceDTO.identifier!,
|
||||
style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w300),
|
||||
maxLines: 1,
|
||||
),
|
||||
@ -94,7 +94,7 @@ class _DeviceElementState extends State<DeviceElement> {
|
||||
icon: Icon(Icons.edit),
|
||||
onPressed: () {
|
||||
showChangeInfo(
|
||||
"Mettre à jour le device",
|
||||
"Mettre à jour la tablette",
|
||||
deviceDTO,
|
||||
(DeviceDTO outputDevice) {
|
||||
// For refresh
|
||||
|
||||
@ -32,7 +32,7 @@ class _DevicesScreenState extends State<DevicesScreen> {
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: AutoSizeText(
|
||||
"PinCode: " + managerAppContext.pinCode.toString(),
|
||||
"Code pin: " + managerAppContext.pinCode.toString(),
|
||||
style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.w300),
|
||||
maxLines: 2,
|
||||
maxFontSize: 25.0,
|
||||
|
||||
@ -41,8 +41,8 @@ class _BodyState extends State<Body> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
devices = new MenuSection(name: "Appareils", type: "devices", order: 0);
|
||||
configurations = new MenuSection(name: "Visites", type: "configurations", order: widget.showDevice ? 1 : 0);
|
||||
devices = new MenuSection(name: "Tablettes", type: "devices", order: 0);
|
||||
configurations = new MenuSection(name: "Configurations", type: "configurations", order: widget.showDevice ? 1 : 0); // TODO Renommer spécifiquement en Visites pour St Heribert
|
||||
resources = new MenuSection(name: "Ressources", type: "resources", order: widget.showDevice ? 2 : 1);
|
||||
//tabsToShow.add(new Tab(text: "Vidéo en ligne"));
|
||||
|
||||
|
||||
@ -42,8 +42,8 @@ class _MainScreenState extends State<MainScreen> {
|
||||
}
|
||||
|
||||
getMenu() {
|
||||
MenuSection devices = new MenuSection(name: "Appareils", type: "devices", order: 0);
|
||||
MenuSection configurations = new MenuSection(name: "Visites", type: "configurations", order: 1);
|
||||
MenuSection devices = new MenuSection(name: "Tablettes", type: "devices", order: 0);
|
||||
MenuSection configurations = new MenuSection(name: "Configurations", type: "configurations", order: 1); // TODO Visites pour Fort St Héribert
|
||||
MenuSection resources = new MenuSection(name: "Ressources", type: "resources", order: 2);
|
||||
|
||||
Menu menu = new Menu(title: "MyMuseum");
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import 'dart:io';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/loading_common.dart';
|
||||
import 'package:manager_app/Components/message_notification.dart';
|
||||
@ -13,6 +15,8 @@ import 'package:manager_api_new/api.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:path/path.dart' as Path;
|
||||
import 'dart:html' as html;
|
||||
|
||||
class ResourcesScreen extends StatefulWidget {
|
||||
final Function? onGetResult; //return ResourceDTO
|
||||
@ -158,7 +162,37 @@ Future<ResourceDTO?> create(ResourceDTO resourceDTO, List<File>? files, List<Pla
|
||||
await res.stream.bytesToString();
|
||||
|
||||
if (res.statusCode == 200) {
|
||||
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context, null);
|
||||
|
||||
|
||||
// TODO just create resource ref with download url from followed
|
||||
try {
|
||||
for (PlatformFile platformFile in filesWeb!) {
|
||||
resourceDTO.instanceId = (appContext.getContext() as ManagerAppContext).instanceId;
|
||||
ResourceDTO? newResource = await (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.resourceCreate(resourceDTO);
|
||||
|
||||
if(newResource != null) {
|
||||
FirebaseStorage storage = FirebaseStorage.instance;
|
||||
Reference ref = storage.ref().child('pictures/${appContext.getContext().instanceId}/${Path.basename(newResource.id!.toString())}');
|
||||
|
||||
UploadTask uploadTask = ref.putData(platformFile.bytes!);
|
||||
uploadTask.then((res) {
|
||||
res.ref.getDownloadURL().then((urlImage) {
|
||||
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context, null);
|
||||
newResource.data = urlImage;
|
||||
(appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.resourceUpdate(newResource);
|
||||
return newResource;
|
||||
});
|
||||
});
|
||||
}
|
||||
showNotification(Colors.orange, kWhite, 'Une erreur est survenue lors de la création de la ressource', context, null);
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error uploading file: $e');
|
||||
}
|
||||
|
||||
return null;
|
||||
} else {
|
||||
showNotification(kPrimaryColor, kWhite, 'Erreur, attention, la taille de la ressource doit être inférieure à 1.5Mb', context, null);
|
||||
|
||||
@ -16,7 +16,7 @@ const kWhite = Color(0xFFFFFFFF);
|
||||
const kBlack = Color(0xFF000000);
|
||||
const kSuccess = Color(0xFF8bc34a);
|
||||
|
||||
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article"];
|
||||
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article", "PDF", "Puzzle", "Agenda"];
|
||||
const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"];
|
||||
const List<String> languages = ["FR", "NL", "EN", "DE", "IT", "ES", "CN", "PL", "AR", "UK"];
|
||||
List<ResourceTypeModel> resource_types = [
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:manager_app/Models/managerContext.dart';
|
||||
import 'package:manager_app/Screens/Main/main_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -31,6 +32,19 @@ Future<void> main() async {
|
||||
//context: localContext,
|
||||
);
|
||||
|
||||
await Firebase.initializeApp(
|
||||
// Replace with actual values
|
||||
options: FirebaseOptions(
|
||||
apiKey: "AIzaSyCFXuDsslqHiPpK6WTcxdIvTDP3ioaaxp4",
|
||||
authDomain: "mymuseum-3b97f.firebaseapp.com",
|
||||
projectId: "mymuseum-3b97f",
|
||||
storageBucket: "mymuseum-3b97f.appspot.com",
|
||||
messagingSenderId: "1034665398515",
|
||||
appId: "1:1034665398515:web:688e2a7b3465e621d6a786",
|
||||
measurementId: "G-EKKHJLJ1E9"
|
||||
),
|
||||
);
|
||||
|
||||
runApp(myApp);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,8 @@ import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import audio_session
|
||||
import firebase_core
|
||||
import firebase_storage
|
||||
import just_audio
|
||||
import package_info_plus
|
||||
import pasteboard
|
||||
@ -17,6 +19,8 @@ import wakelock_plus
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
|
||||
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
|
||||
|
||||
60
pubspec.lock
60
pubspec.lock
@ -9,6 +9,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "63.0.0"
|
||||
_flutterfire_internals:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: _flutterfire_internals
|
||||
sha256: f5628cd9c92ed11083f425fd1f8f1bc60ecdda458c81d73b143aeda036c35fe7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.16"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -325,10 +333,58 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: file_picker
|
||||
sha256: "903dd4ba13eae7cef64acc480e91bf54c3ddd23b5b90b639c170f3911e489620"
|
||||
sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.0"
|
||||
version: "6.1.1"
|
||||
firebase_core:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: firebase_core
|
||||
sha256: "96607c0e829a581c2a483c658f04e8b159964c3bae2730f73297070bc85d40bb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.24.2"
|
||||
firebase_core_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: firebase_core_platform_interface
|
||||
sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
firebase_core_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: firebase_core_web
|
||||
sha256: d585bdf3c656c3f7821ba1bd44da5f13365d22fcecaf5eb75c4295246aaa83c0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.10.0"
|
||||
firebase_storage:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: firebase_storage
|
||||
sha256: "8126e80210c0841a5b8204590b40d6b9e87cded3d342a92833f484a564dcddb3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "11.5.6"
|
||||
firebase_storage_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: firebase_storage_platform_interface
|
||||
sha256: "545a3a8edf337850403bb0fa03c8074a53deb87c0107d19755c77a82ce07919e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.3"
|
||||
firebase_storage_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: firebase_storage_web
|
||||
sha256: ee6870ff79aa304b8996ba18a4aefe1e8b3fc31fd385eab6574180267aa8d393
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.6.17"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.0.2+3
|
||||
version: 2.0.0+4
|
||||
|
||||
environment:
|
||||
sdk: ">=3.1.0 <4.0.0"
|
||||
@ -33,7 +33,7 @@ dependencies:
|
||||
convert: ^3.1.1
|
||||
collection: any
|
||||
#filepicker_windows: ^2.0.0
|
||||
file_picker: ^6.0.0
|
||||
file_picker: ^6.1.1
|
||||
flare_flutter: ^3.0.1
|
||||
#dart_vlc: ^0.0.6
|
||||
#video_player: ^2.1.1
|
||||
@ -64,6 +64,8 @@ dependencies:
|
||||
responsive_framework: ^1.1.1
|
||||
tab_container: ^2.0.0
|
||||
flutter_widget_from_html: ^0.10.1
|
||||
firebase_storage: ^11.5.6
|
||||
firebase_core: ^2.24.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
@ -111,5 +111,28 @@
|
||||
loadMainDartJs();
|
||||
}
|
||||
</script>
|
||||
<script type="module">
|
||||
// Import the functions you need from the SDKs you need
|
||||
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js";
|
||||
import { getAnalytics } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-analytics.js";
|
||||
// TODO: Add SDKs for Firebase products that you want to use
|
||||
// https://firebase.google.com/docs/web/setup#available-libraries
|
||||
|
||||
// Your web app's Firebase configuration
|
||||
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
|
||||
const firebaseConfig = {
|
||||
apiKey: "AIzaSyCFXuDsslqHiPpK6WTcxdIvTDP3ioaaxp4",
|
||||
authDomain: "mymuseum-3b97f.firebaseapp.com",
|
||||
projectId: "mymuseum-3b97f",
|
||||
storageBucket: "mymuseum-3b97f.appspot.com",
|
||||
messagingSenderId: "1034665398515",
|
||||
appId: "1:1034665398515:web:688e2a7b3465e621d6a786",
|
||||
measurementId: "G-EKKHJLJ1E9"
|
||||
};
|
||||
|
||||
// Initialize Firebase
|
||||
const app = initializeApp(firebaseConfig);
|
||||
const analytics = getAnalytics(app);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -6,10 +6,16 @@
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <firebase_core/firebase_core_plugin_c_api.h>
|
||||
#include <firebase_storage/firebase_storage_plugin_c_api.h>
|
||||
#include <pasteboard/pasteboard_plugin.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
FirebaseCorePluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
|
||||
FirebaseStoragePluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FirebaseStoragePluginCApi"));
|
||||
PasteboardPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PasteboardPlugin"));
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
firebase_core
|
||||
firebase_storage
|
||||
pasteboard
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user