Filter languages in download popup + allow all languages if IsAdmin
This commit is contained in:
parent
0322716c60
commit
59a16cde74
@ -73,8 +73,8 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
child: visitAppContext.isMaximizeTextSize ? const Icon(Icons.text_fields) : const Icon(Icons.format_size)
|
child: visitAppContext.isMaximizeTextSize ? const Icon(Icons.text_fields) : const Icon(Icons.format_size)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(right: 5.0),
|
padding: const EdgeInsets.only(right: 5.0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 50,
|
width: 50,
|
||||||
height: 50,
|
height: 50,
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg_provider/flutter_svg_provider.dart';
|
import 'package:flutter_svg_provider/flutter_svg_provider.dart';
|
||||||
|
import 'package:manager_api/api.dart';
|
||||||
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
||||||
import 'package:mymuseum_visitapp/app_context.dart';
|
import 'package:mymuseum_visitapp/app_context.dart';
|
||||||
import 'package:mymuseum_visitapp/constants.dart';
|
import 'package:mymuseum_visitapp/constants.dart';
|
||||||
@ -7,7 +8,9 @@ import 'package:provider/provider.dart';
|
|||||||
import '../Helpers/DatabaseHelper.dart';
|
import '../Helpers/DatabaseHelper.dart';
|
||||||
|
|
||||||
class LanguageSelection extends StatefulWidget {
|
class LanguageSelection extends StatefulWidget {
|
||||||
const LanguageSelection();
|
LanguageSelection({Key? key, this.configurationDTO}) : super(key: key);
|
||||||
|
|
||||||
|
ConfigurationDTO? configurationDTO;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_LanguageSelection createState() => _LanguageSelection();
|
_LanguageSelection createState() => _LanguageSelection();
|
||||||
@ -29,9 +32,15 @@ class _LanguageSelection extends State<LanguageSelection> with TickerProviderSta
|
|||||||
//print(configurationLanguages);
|
//print(configurationLanguages);
|
||||||
languagesEnable = configurationLanguages ?? languages;
|
languagesEnable = configurationLanguages ?? languages;
|
||||||
selectedLanguage = visitAppContext.language;
|
selectedLanguage = visitAppContext.language;
|
||||||
|
var isAdmin = visitAppContext.isAdmin ?? false;
|
||||||
|
|
||||||
if(visitAppContext.configuration != null && visitAppContext.configuration!.isOffline!) {
|
if((visitAppContext.configuration != null && visitAppContext.configuration!.isOffline! && !isAdmin) || widget.configurationDTO != null)
|
||||||
languagesEnable = [configurationLanguages!.firstWhere((element) => element == visitAppContext.language)];
|
{
|
||||||
|
if(widget.configurationDTO != null) {
|
||||||
|
languagesEnable = widget.configurationDTO!.languages ?? languages;
|
||||||
|
} else {
|
||||||
|
languagesEnable = [configurationLanguages!.firstWhere((element) => element == visitAppContext.language)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!languagesEnable!.any((lg) => lg == selectedLanguage)) {
|
if(!languagesEnable!.any((lg) => lg == selectedLanguage)) {
|
||||||
|
|||||||
@ -270,7 +270,7 @@ class _ConfigurationsListState extends State<ConfigurationsList> {
|
|||||||
: TranslationHelper.getFromLocale(
|
: TranslationHelper.getFromLocale(
|
||||||
"downloadPromptUpdate",
|
"downloadPromptUpdate",
|
||||||
appContext.getContext()),
|
appContext.getContext()),
|
||||||
style: TextStyle(color: kMainColor),
|
style: const TextStyle(color: kMainColor),
|
||||||
textAlign: TextAlign.center),
|
textAlign: TextAlign.center),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
@ -279,12 +279,12 @@ class _ConfigurationsListState extends State<ConfigurationsList> {
|
|||||||
Text(
|
Text(
|
||||||
TranslationHelper.getFromLocale(
|
TranslationHelper.getFromLocale(
|
||||||
"downloadLanguage", appContext.getContext()),
|
"downloadLanguage", appContext.getContext()),
|
||||||
style: TextStyle(color: kMainColor),
|
style: const TextStyle(color: kMainColor),
|
||||||
textAlign: TextAlign.center),
|
textAlign: TextAlign.center),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 25,
|
height: 25,
|
||||||
),
|
),
|
||||||
LanguageSelection()
|
LanguageSelection(configurationDTO: configuration)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user