feat: add custom svgs to lemmas in word zoom card (#1540)
This commit is contained in:
parent
0bb323b95d
commit
77e8b3f474
2 changed files with 29 additions and 1 deletions
|
|
@ -5,8 +5,10 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/analytics/constants/analytics_constants.dart';
|
||||
import 'package:fluffychat/pangea/analytics/enums/construct_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/analytics/enums/construct_use_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/analytics/enums/lemma_category_enum.dart';
|
||||
import 'package:fluffychat/pangea/analytics/extensions/client_analytics_extension.dart';
|
||||
import 'package:fluffychat/pangea/analytics/models/construct_use_model.dart';
|
||||
import 'package:fluffychat/pangea/analytics/models/constructs_model.dart';
|
||||
|
|
@ -622,6 +624,16 @@ class PangeaToken {
|
|||
}
|
||||
}
|
||||
|
||||
LemmaCategoryEnum get lemmaXPCategory {
|
||||
if (vocabConstruct.points >= AnalyticsConstants.xpForFlower) {
|
||||
return LemmaCategoryEnum.flowers;
|
||||
} else if (vocabConstruct.points >= AnalyticsConstants.xpForGreens) {
|
||||
return LemmaCategoryEnum.greens;
|
||||
} else {
|
||||
return LemmaCategoryEnum.seeds;
|
||||
}
|
||||
}
|
||||
|
||||
List<String> morphActivityDistractors(
|
||||
String morphFeature,
|
||||
String morphTag,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/analytics/enums/lemma_category_enum.dart';
|
||||
import 'package:fluffychat/pangea/common/widgets/customized_svg.dart';
|
||||
import 'package:fluffychat/pangea/events/models/pangea_token_model.dart';
|
||||
|
||||
class LemmaWidget extends StatelessWidget {
|
||||
|
|
@ -14,7 +16,21 @@ class LemmaWidget extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Text("${token.lemma.text} ${token.xpEmoji}"),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(token.lemma.text),
|
||||
const SizedBox(width: 6),
|
||||
SizedBox(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: CustomizedSvg(
|
||||
svgUrl: token.lemmaXPCategory.svgURL,
|
||||
colorReplacements: const {},
|
||||
errorIcon: Text(token.xpEmoji),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue