fix: update morph feature sort order (#1796)

This commit is contained in:
ggurdin 2025-02-14 12:15:48 -05:00 committed by GitHub
parent f296012a0e
commit 91ab045365
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 40 additions and 40 deletions

View file

@ -31,7 +31,7 @@ class MorphAnalyticsView extends StatelessWidget {
builder: (context, snapshot) {
final morphs = snapshot.data ?? defaultMorphMapping;
morphs.displayFeatures.sort(
final features = morphs.displayFeatures.sorted(
(a, b) => morphFeatureSortOrder
.indexOf(a.feature)
.compareTo(morphFeatureSortOrder.indexOf(b.feature)),
@ -40,21 +40,21 @@ class MorphAnalyticsView extends StatelessWidget {
return snapshot.connectionState == ConnectionState.done
? ListView.builder(
key: const PageStorageKey<String>('morph-analytics'),
itemCount: morphs.displayFeatures.length,
itemBuilder: (context, index) => morphs
.displayFeatures[index].displayTags.isNotEmpty
? MorphFeatureBox(
morphFeature: morphs.displayFeatures[index].feature,
allTags: snapshot.data
?.getDisplayTags(
morphs.displayFeatures[index].feature,
)
.map((tag) => tag.toLowerCase())
.toSet() ??
{},
onConstructZoom: onConstructZoom,
)
: const SizedBox.shrink(),
itemCount: features.length,
itemBuilder: (context, index) =>
features[index].displayTags.isNotEmpty
? MorphFeatureBox(
morphFeature: features[index].feature,
allTags: snapshot.data
?.getDisplayTags(
features[index].feature,
)
.map((tag) => tag.toLowerCase())
.toSet() ??
{},
onConstructZoom: onConstructZoom,
)
: const SizedBox.shrink(),
)
: const Center(
child: CircularProgressIndicator(),

View file

@ -235,33 +235,33 @@ final MorphFeaturesAndTags defaultMorphMapping = MorphFeaturesAndTags.fromJson({
final List<String> morphFeatureSortOrder = [
"pos",
"advtype",
"aspect",
"case",
"conjtype",
"definite",
"degree",
"evident",
"gender",
"mood",
"nountype",
"numform",
"numtype",
"number",
"number[psor]",
"person",
"polarity",
"polite",
"poss",
"prepcase",
"prontype",
"punctside",
"puncttype",
"reflex",
"tense",
"aspect",
"mood",
"voice",
"verbform",
"verbtype",
"voice",
"number",
"gender",
"nountype",
"case",
"prontype",
"person",
"definite",
"reflex",
"prepcase",
"poss",
"number[psor]",
"degree",
"polarity",
"advtype",
"conjtype",
"numform",
"numtype",
"polite",
"puncttype",
"punctside",
"evident",
"foreign",
"x",
];