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)
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(right: 5.0),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 5.0),
|
||||
child: SizedBox(
|
||||
width: 50,
|
||||
height: 50,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.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/app_context.dart';
|
||||
import 'package:mymuseum_visitapp/constants.dart';
|
||||
@ -7,7 +8,9 @@ import 'package:provider/provider.dart';
|
||||
import '../Helpers/DatabaseHelper.dart';
|
||||
|
||||
class LanguageSelection extends StatefulWidget {
|
||||
const LanguageSelection();
|
||||
LanguageSelection({Key? key, this.configurationDTO}) : super(key: key);
|
||||
|
||||
ConfigurationDTO? configurationDTO;
|
||||
|
||||
@override
|
||||
_LanguageSelection createState() => _LanguageSelection();
|
||||
@ -29,10 +32,16 @@ class _LanguageSelection extends State<LanguageSelection> with TickerProviderSta
|
||||
//print(configurationLanguages);
|
||||
languagesEnable = configurationLanguages ?? languages;
|
||||
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)
|
||||
{
|
||||
if(widget.configurationDTO != null) {
|
||||
languagesEnable = widget.configurationDTO!.languages ?? languages;
|
||||
} else {
|
||||
languagesEnable = [configurationLanguages!.firstWhere((element) => element == visitAppContext.language)];
|
||||
}
|
||||
}
|
||||
|
||||
if(!languagesEnable!.any((lg) => lg == selectedLanguage)) {
|
||||
selectedLanguage = defaultLanguage;
|
||||
|
||||
@ -270,7 +270,7 @@ class _ConfigurationsListState extends State<ConfigurationsList> {
|
||||
: TranslationHelper.getFromLocale(
|
||||
"downloadPromptUpdate",
|
||||
appContext.getContext()),
|
||||
style: TextStyle(color: kMainColor),
|
||||
style: const TextStyle(color: kMainColor),
|
||||
textAlign: TextAlign.center),
|
||||
),
|
||||
const SizedBox(
|
||||
@ -279,12 +279,12 @@ class _ConfigurationsListState extends State<ConfigurationsList> {
|
||||
Text(
|
||||
TranslationHelper.getFromLocale(
|
||||
"downloadLanguage", appContext.getContext()),
|
||||
style: TextStyle(color: kMainColor),
|
||||
style: const TextStyle(color: kMainColor),
|
||||
textAlign: TextAlign.center),
|
||||
const SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
LanguageSelection()
|
||||
LanguageSelection(configurationDTO: configuration)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user