only show 100 most recent uses in level bar popup (#1224)
This commit is contained in:
parent
029dbef481
commit
43040c4010
3 changed files with 7 additions and 5 deletions
|
|
@ -4622,5 +4622,6 @@
|
|||
"currentXP": {},
|
||||
"maxXP": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"registrationEmailMessage": "Please verify your email with a link sent there. In some cases, the email takes up to 5 minutes to arrive. Please also check your spam folder."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class ConstructListModel {
|
|||
_uses.clear();
|
||||
}
|
||||
|
||||
final List<OneConstructUse> _uses = [];
|
||||
List<OneConstructUse> _uses = [];
|
||||
List<OneConstructUse> get uses => _uses;
|
||||
|
||||
/// A map of lemmas to ConstructUses, each of which contains a lemma
|
||||
|
|
@ -70,8 +70,9 @@ class ConstructListModel {
|
|||
}
|
||||
|
||||
void _updateUsesList(List<OneConstructUse> newUses) {
|
||||
newUses.sort((a, b) => a.timeStamp.compareTo(b.timeStamp));
|
||||
_uses.addAll(newUses);
|
||||
newUses.sort((a, b) => b.timeStamp.compareTo(a.timeStamp));
|
||||
_uses.insertAll(0, newUses);
|
||||
_uses = _uses.take(100).toList();
|
||||
}
|
||||
|
||||
/// A map of lemmas to ConstructUses, each of which contains a lemma
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class LevelBarPopup extends StatelessWidget {
|
|||
child: ListView.builder(
|
||||
itemCount: uses.length,
|
||||
itemBuilder: (context, index) {
|
||||
final use = uses[(uses.length - 1) - index];
|
||||
final use = uses[index];
|
||||
String lemmaCopy = use.lemma;
|
||||
if (use.constructType == ConstructTypeEnum.morph) {
|
||||
lemmaCopy = getGrammarCopy(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue