fix default lang bug
This commit is contained in:
parent
c547e75b1f
commit
715a780edd
@ -295,11 +295,11 @@ class _GeneralState extends State<_General> {
|
|||||||
Map<String, String> langsMap = {for (var v in langsList) v[0]: v[1]};
|
Map<String, String> langsMap = {for (var v in langsList) v[0]: v[1]};
|
||||||
List<String> keys = langsMap.keys.toList();
|
List<String> keys = langsMap.keys.toList();
|
||||||
List<String> values = langsMap.values.toList();
|
List<String> values = langsMap.values.toList();
|
||||||
keys.insert(0, "default");
|
keys.insert(0, "");
|
||||||
values.insert(0, "Default");
|
values.insert(0, "Default");
|
||||||
String currentKey = data["lang"]!;
|
String currentKey = data["lang"]!;
|
||||||
if (!keys.contains(currentKey)) {
|
if (!keys.contains(currentKey)) {
|
||||||
currentKey = "default";
|
currentKey = "";
|
||||||
}
|
}
|
||||||
return _ComboBox(
|
return _ComboBox(
|
||||||
keys: keys,
|
keys: keys,
|
||||||
@ -1023,6 +1023,7 @@ class _ComboBox extends StatelessWidget {
|
|||||||
required this.values,
|
required this.values,
|
||||||
required this.initialKey,
|
required this.initialKey,
|
||||||
required this.onChanged,
|
required this.onChanged,
|
||||||
|
// ignore: unused_element
|
||||||
this.enabled = true,
|
this.enabled = true,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@ -1030,7 +1031,6 @@ class _ComboBox extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var index = keys.indexOf(initialKey);
|
var index = keys.indexOf(initialKey);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
assert(false);
|
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
var ref = values[index].obs;
|
var ref = values[index].obs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user