mirror of
https://github.com/haorendashu/nowser.git
synced 2025-12-17 01:44:19 +01:00
fix appdetail sometime error bug
This commit is contained in:
@@ -117,8 +117,10 @@ class _AppDetailRouter extends State<AppDetailRouter> {
|
|||||||
|
|
||||||
var keyWidget =
|
var keyWidget =
|
||||||
Selector<KeyProvider, List<String>>(builder: (context, pubkeys, child) {
|
Selector<KeyProvider, List<String>>(builder: (context, pubkeys, child) {
|
||||||
|
var uniquePubkeys = pubkeys.toSet().toList();
|
||||||
|
|
||||||
List<DropdownMenuItem<String>> items = [];
|
List<DropdownMenuItem<String>> items = [];
|
||||||
for (var pubkey in pubkeys) {
|
for (var pubkey in uniquePubkeys) {
|
||||||
items.add(DropdownMenuItem(
|
items.add(DropdownMenuItem(
|
||||||
value: pubkey,
|
value: pubkey,
|
||||||
child: UserNameComponent(
|
child: UserNameComponent(
|
||||||
@@ -128,11 +130,17 @@ class _AppDetailRouter extends State<AppDetailRouter> {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String? currentValue = app!.pubkey;
|
||||||
|
if (currentValue != null && !uniquePubkeys.contains(currentValue)) {
|
||||||
|
currentValue = uniquePubkeys.isNotEmpty ? uniquePubkeys.first : null;
|
||||||
|
}
|
||||||
|
|
||||||
return DropdownButton<String>(
|
return DropdownButton<String>(
|
||||||
items: items,
|
items: items,
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
onChanged: null,
|
onChanged: null,
|
||||||
value: app!.pubkey,
|
value: currentValue,
|
||||||
);
|
);
|
||||||
}, selector: (context, provider) {
|
}, selector: (context, provider) {
|
||||||
return provider.pubkeys;
|
return provider.pubkeys;
|
||||||
|
|||||||
Reference in New Issue
Block a user