Add language selection
This commit is contained in:
parent
dbd2254085
commit
72a96b08b6
@ -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"}
|
||||
{"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"}
|
||||
@ -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/
|
||||
|
||||
BIN
assets/images/DE.png
Normal file
BIN
assets/images/DE.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 225 B |
BIN
assets/images/EN.png
Normal file
BIN
assets/images/EN.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
assets/images/FR.png
Normal file
BIN
assets/images/FR.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 233 B |
BIN
assets/images/NL.png
Normal file
BIN
assets/images/NL.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 219 B |
@ -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<CustomAppBar> {
|
||||
});
|
||||
}
|
||||
) : 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(
|
||||
|
||||
88
lib/Components/LanguageSelection.dart
Normal file
88
lib/Components/LanguageSelection.dart
Normal file
@ -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<LanguageSelection> with TickerProviderStateMixin {
|
||||
List<String>? languagesEnable;
|
||||
double flagSize = 60;
|
||||
|
||||
String? selectedLanguage;
|
||||
double? elementMinimizedSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appContext = Provider.of<AppContext>(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<PopupMenuItem> menuItems = [];
|
||||
for(var language in languagesEnable!) {
|
||||
menuItems.add(PopupMenuItem<int>(
|
||||
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
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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<ResourceModel?> resources;
|
||||
@ -29,10 +28,8 @@ class _SliderImagesWidget extends State<SliderImagesWidget> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
print("COUCOU DISPOSE");
|
||||
sliderController = null;
|
||||
super.dispose();
|
||||
print("COUCOU DISPOSE AFTER");
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -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<ConfigurationDTO>? configurations;
|
||||
ConfigurationDTO? configuration;
|
||||
|
||||
VisitAppContext({this.language, this.id});
|
||||
VisitAppContext({this.language, this.id, this.configuration});
|
||||
|
||||
Map<String, dynamic> 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}';
|
||||
}
|
||||
}
|
||||
@ -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<ArticlePage> {
|
||||
Widget build(BuildContext context) {
|
||||
final appContext = Provider.of<AppContext>(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<dynamic> 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<ArticlePage> {
|
||||
)
|
||||
],
|
||||
),
|
||||
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<ArticlePage> {
|
||||
//color: kMainColor
|
||||
),
|
||||
),
|
||||
|
||||
*/
|
||||
|
||||
|
||||
if(articleDTO!.isContentTop!)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user