diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 305d80e..5cfbe18 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.0\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.0\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2022-08-31 18:00:02.358724","version":"3.0.3"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.0\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.0\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2022-09-03 17:27:02.945881","version":"3.0.3"} \ No newline at end of file diff --git a/.packages b/.packages index 2a5f97f..4791810 100644 --- a/.packages +++ b/.packages @@ -3,7 +3,7 @@ # # For more info see: https://dart.dev/go/dot-packages-deprecation # -# Generated by pub on 2022-08-31 16:18:04.785377. +# Generated by pub on 2022-09-03 17:19:05.522230. _fe_analyzer_shared:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/_fe_analyzer_shared-31.0.0/lib/ analyzer:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/analyzer-2.8.0/lib/ args:file:///C:/Users/thoma/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/args-2.3.1/lib/ diff --git a/assets/images/DE.png b/assets/images/DE.png new file mode 100644 index 0000000..c4caaaf Binary files /dev/null and b/assets/images/DE.png differ diff --git a/assets/images/EN.png b/assets/images/EN.png new file mode 100644 index 0000000..b81442d Binary files /dev/null and b/assets/images/EN.png differ diff --git a/assets/images/FR.png b/assets/images/FR.png new file mode 100644 index 0000000..feff210 Binary files /dev/null and b/assets/images/FR.png differ diff --git a/assets/images/NL.png b/assets/images/NL.png new file mode 100644 index 0000000..e456302 Binary files /dev/null and b/assets/images/NL.png differ diff --git a/lib/Components/CustomAppBar.dart b/lib/Components/CustomAppBar.dart index 91980c9..1b6cd62 100644 --- a/lib/Components/CustomAppBar.dart +++ b/lib/Components/CustomAppBar.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:mymuseum_visitapp/Components/LanguageSelection.dart'; import 'package:mymuseum_visitapp/Screens/Home/home.dart'; import 'package:mymuseum_visitapp/constants.dart'; //import 'package:flutter_svg/svg.dart'; @@ -40,6 +41,16 @@ class _CustomAppBarState extends State { }); } ) : null, + actions: [ + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: SizedBox( + width: 50, + height: 50, + child: LanguageSelection() + ) + ), + ], flexibleSpace: Container( decoration: const BoxDecoration( gradient: LinearGradient( diff --git a/lib/Components/LanguageSelection.dart b/lib/Components/LanguageSelection.dart new file mode 100644 index 0000000..3c78983 --- /dev/null +++ b/lib/Components/LanguageSelection.dart @@ -0,0 +1,88 @@ +import 'package:flutter/material.dart'; +import 'package:mymuseum_visitapp/Models/visitContext.dart'; +import 'package:mymuseum_visitapp/app_context.dart'; +import 'package:mymuseum_visitapp/constants.dart'; +import 'package:provider/provider.dart'; + +class LanguageSelection extends StatefulWidget { + const LanguageSelection(); + + @override + _LanguageSelection createState() => _LanguageSelection(); +} + +class _LanguageSelection extends State with TickerProviderStateMixin { + List? languagesEnable; + double flagSize = 60; + + String? selectedLanguage; + double? elementMinimizedSize; + + @override + Widget build(BuildContext context) { + final appContext = Provider.of(context); + Size size = MediaQuery.of(context).size; + print("YOLOO"); + selectedLanguage = (appContext.getContext() as VisitAppContext).language; + print(selectedLanguage); + languagesEnable = ["FR", "EN", "NL", "DE"]; // TODO + //languagesEnable = (appContext.getContext() as VisitAppContext).configuration!.languages; // Todo filter language possible + print(languagesEnable); + + return PopupMenuButton( + icon: Container( + height: size.height *0.07, + width: size.width *0.07, + decoration: flagDecoration(selectedLanguage!), + ), + itemBuilder: (context){ + int i = 0; + List menuItems = []; + for(var language in languagesEnable!) { + menuItems.add(PopupMenuItem( + value: i, + child: Center( + child: Container( + width: size.width *0.07, + height: size.width *0.07, + decoration: flagDecoration(language), + ) + ), + )); + i = i+1; + } + return menuItems; + }, + onSelected:(value){ + // TODO update App context + update local DB + if(value == 0){ + print("My account menu is selected."); + }else if(value == 1){ + print("Settings menu is selected."); + }else if(value == 2){ + print("Logout menu is selected."); + } + } + ); + } + + flagDecoration(String language) { + return BoxDecoration( + color: kBackgroundColor, + shape: BoxShape.circle, + //border: Border.all(width: 1.5, color: kSecondGrey), + image: DecorationImage( + fit: BoxFit.contain, + image: AssetImage("assets/images/"+language+".png"), + ), + boxShadow: const [ + BoxShadow( + color: kSecondGrey, + spreadRadius: 0.5, + blurRadius: 5, + offset: Offset(0, 1.5), // changes position of shadow + ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/Components/SliderImages.dart b/lib/Components/SliderImages.dart index 3460b74..3ffc17f 100644 --- a/lib/Components/SliderImages.dart +++ b/lib/Components/SliderImages.dart @@ -6,7 +6,6 @@ import 'package:mymuseum_visitapp/Models/resourceModel.dart'; import 'package:mymuseum_visitapp/app_context.dart'; import 'package:mymuseum_visitapp/constants.dart'; import 'package:provider/provider.dart'; -import 'package:photo_view/photo_view.dart'; class SliderImagesWidget extends StatefulWidget { final List resources; @@ -29,10 +28,8 @@ class _SliderImagesWidget extends State { @override void dispose() { - print("COUCOU DISPOSE"); sliderController = null; super.dispose(); - print("COUCOU DISPOSE AFTER"); } @override diff --git a/lib/Models/visitContext.dart b/lib/Models/visitContext.dart index 52de53a..e63b475 100644 --- a/lib/Models/visitContext.dart +++ b/lib/Models/visitContext.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:manager_api/api.dart'; @@ -7,15 +9,16 @@ class VisitAppContext with ChangeNotifier{ //String? host = ""; String? language = ""; List? configurations; + ConfigurationDTO? configuration; - VisitAppContext({this.language, this.id}); + VisitAppContext({this.language, this.id, this.configuration}); Map toMap() { return { 'id': id, //'host': host, 'language': language, - //'token': token + 'configuration': configuration == null ? null : jsonEncode(configuration?.toJson()), }; } @@ -24,13 +27,13 @@ class VisitAppContext with ChangeNotifier{ id: json['id'] as String, /*host: json['host'] as String,*/ language: json['language'] as String, - //token: json['token'] as String, + configuration: json['configuration'] == null ? null : ConfigurationDTO.fromJson(json['configuration']), ); } // Implement toString to make it easier to see information about @override String toString() { - return 'VisitAppContext{id: $id, language: $language}'; + return 'VisitAppContext{id: $id, language: $language, configuration: $configuration}'; } } \ No newline at end of file diff --git a/lib/Screens/Article/article.dart b/lib/Screens/Article/article.dart index 0aa264d..f10f71c 100644 --- a/lib/Screens/Article/article.dart +++ b/lib/Screens/Article/article.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:manager_api/api.dart'; +import 'package:mymuseum_visitapp/Components/CustomAppBar.dart'; import 'package:mymuseum_visitapp/Components/Loading.dart'; import 'package:mymuseum_visitapp/Components/ScannerBouton.dart'; import 'package:mymuseum_visitapp/Components/SliderImages.dart'; @@ -35,21 +36,22 @@ class _ArticlePageState extends State { Widget build(BuildContext context) { final appContext = Provider.of(context); Size size = MediaQuery.of(context).size; + final notchInset = MediaQuery.of(context).padding; return Scaffold( key: _scaffoldKey, - /*appBar: CustomAppBar( + appBar: CustomAppBar( title: sectionDTO != null ? TranslationHelper.get(sectionDTO!.title, appContext) : "", isHomeButton: false, - ),*/ + ), body: FutureBuilder( future: getArticle(appContext.clientAPI, widget.articleId), builder: (context, AsyncSnapshot snapshot) { if(articleDTO != null && sectionDTO != null) { return Column( children: [ - if(mainResource != null) + /*if(mainResource != null) Container( - height: size.height * 0.2, + height: size.height * 0.1, width: size.width, child: Stack( children: [ @@ -86,27 +88,34 @@ class _ArticlePageState extends State { ) ], ), - InkWell( - onTap: () { - print("play push"); - }, - child: const Center( - child: Padding( - padding: EdgeInsets.only(right: 20.0), - child: Icon(Icons.play_arrow, size: 35, color: kMainColor), - ), - ), - ) + if(articleDTO!.audioId != null) + InkWell( + onTap: () { + print("play push"); + }, + child: const Center( + child: Padding( + padding: EdgeInsets.only(right: 20.0), + child: Icon(Icons.play_arrow, size: 35, color: kMainColor), + ), + ), + ) ], ), ) ], ), ), - Positioned( - top: 0, + /*Positioned( + top: notchInset.top, left: 0, - child: Text("Coucou")) + child: InkWell( + onTap: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + child: Text("Coucou")))*/ ], ), decoration: BoxDecoration( @@ -118,7 +127,7 @@ class _ArticlePageState extends State { //color: kMainColor ), ), - + */ if(articleDTO!.isContentTop!) diff --git a/pubspec.yaml b/pubspec.yaml index b966d16..7f21eb2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -70,6 +70,11 @@ flutter: # the material Icons class. uses-material-design: true + assets: + #- assets/icons/ + - assets/images/ + #- assets/animations/ + #- assets/files/ # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg