chore: analytics details page tweaks

This commit is contained in:
ggurdin 2026-01-16 09:42:08 -05:00
parent 9b8993c602
commit d36ae65154
No known key found for this signature in database
GPG key ID: A01CB41737CBB478
4 changed files with 47 additions and 56 deletions

View file

@ -41,32 +41,16 @@ class ConstructXPProgressBar extends StatelessWidget {
return Column(
spacing: 8.0,
children: [
LayoutBuilder(
builder: (context, constraints) {
double availableGap =
constraints.maxWidth - (categories.length * iconSize);
const totalPoints = AnalyticsConstants.xpForFlower;
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
...categories.map(
(c) {
final gapPercent = (c.xpNeeded / totalPoints);
final gap = availableGap * gapPercent;
availableGap -= gap;
return Container(
width: iconSize + gap,
alignment: Alignment.centerRight,
child: Opacity(
opacity: level == c ? 1.0 : 0.4,
child: c.icon(iconSize),
),
);
},
),
],
);
},
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
...categories.map(
(c) => Opacity(
opacity: level == c ? 1.0 : 0.4,
child: c.icon(iconSize),
),
),
],
),
AnimatedProgressBar(
height: 20.0,

View file

@ -82,35 +82,40 @@ class VocabDetailsView extends StatelessWidget {
maxWidth: 600.0,
showBorder: false,
child: Column(
spacing: 16.0,
spacing: 20.0,
children: [
WordZoomWidget(
token: tokenText,
langCode:
MatrixState.pangeaController.userController.userL2Code!,
construct: constructId,
onClose: Navigator.of(context).pop,
onFlagTokenInfo:
(LemmaInfoResponse lemmaInfo, String phonetics) {
final requestData = TokenInfoFeedbackRequestData(
userId: Matrix.of(context).client.userID!,
detectedLanguage:
MatrixState.pangeaController.userController.userL2Code!,
tokens: [token],
selectedToken: 0,
wordCardL1:
MatrixState.pangeaController.userController.userL1Code!,
lemmaInfo: lemmaInfo,
phonetics: phonetics,
);
const SizedBox(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: WordZoomWidget(
token: tokenText,
langCode:
MatrixState.pangeaController.userController.userL2Code!,
construct: constructId,
onClose: Navigator.of(context).pop,
onFlagTokenInfo:
(LemmaInfoResponse lemmaInfo, String phonetics) {
final requestData = TokenInfoFeedbackRequestData(
userId: Matrix.of(context).client.userID!,
detectedLanguage: MatrixState
.pangeaController.userController.userL2Code!,
tokens: [token],
selectedToken: 0,
wordCardL1: MatrixState
.pangeaController.userController.userL1Code!,
lemmaInfo: lemmaInfo,
phonetics: phonetics,
);
TokenFeedbackUtil.showTokenFeedbackDialog(
context,
requestData: requestData,
langCode:
MatrixState.pangeaController.userController.userL2Code!,
);
},
TokenFeedbackUtil.showTokenFeedbackDialog(
context,
requestData: requestData,
langCode: MatrixState
.pangeaController.userController.userL2Code!,
);
},
maxWidth: double.infinity,
),
),
if (construct != null)
Column(

View file

@ -2,7 +2,7 @@ class AnalyticsConstants {
static const int xpPerLevel = 500;
static const int vocabUseMaxXP = 30;
static const int morphUseMaxXP = 500;
static const int xpForGreens = 30;
static const int xpForGreens = 50;
static const int xpForFlower = 100;
static const String seedSvgFileName = "Seed.svg";
static const String leafSvgFileName = "Leaf.svg";

View file

@ -30,6 +30,7 @@ class WordZoomWidget extends StatelessWidget {
final bool enableEmojiSelection;
final VoidCallback? onDismissNewWordOverlay;
final Function(LemmaInfoResponse, String)? onFlagTokenInfo;
final double? maxWidth;
const WordZoomWidget({
super.key,
@ -41,6 +42,7 @@ class WordZoomWidget extends StatelessWidget {
this.enableEmojiSelection = true,
this.onDismissNewWordOverlay,
this.onFlagTokenInfo,
this.maxWidth,
});
String get transformTargetId => "word-zoom-card-${token.uniqueKey}";
@ -63,8 +65,8 @@ class WordZoomWidget extends StatelessWidget {
Container(
height: AppConfig.toolbarMaxHeight - 8,
padding: const EdgeInsets.all(12.0),
constraints: const BoxConstraints(
maxWidth: AppConfig.toolbarMinWidth,
constraints: BoxConstraints(
maxWidth: maxWidth ?? AppConfig.toolbarMinWidth,
),
child: CompositedTransformTarget(
link: layerLink,