From d36ae6515486c363ec9ea5e07d5f91841ef3f965 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Fri, 16 Jan 2026 09:42:08 -0500 Subject: [PATCH] chore: analytics details page tweaks --- .../construct_xp_progress_bar.dart | 36 ++++------- .../vocab_analytics_details_view.dart | 59 ++++++++++--------- .../analytics_misc/analytics_constants.dart | 2 +- .../toolbar/word_card/word_zoom_widget.dart | 6 +- 4 files changed, 47 insertions(+), 56 deletions(-) diff --git a/lib/pangea/analytics_details_popup/construct_xp_progress_bar.dart b/lib/pangea/analytics_details_popup/construct_xp_progress_bar.dart index 4089a46b1..794cdbe5f 100644 --- a/lib/pangea/analytics_details_popup/construct_xp_progress_bar.dart +++ b/lib/pangea/analytics_details_popup/construct_xp_progress_bar.dart @@ -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, diff --git a/lib/pangea/analytics_details_popup/vocab_analytics_details_view.dart b/lib/pangea/analytics_details_popup/vocab_analytics_details_view.dart index 6de39e654..58bafc387 100644 --- a/lib/pangea/analytics_details_popup/vocab_analytics_details_view.dart +++ b/lib/pangea/analytics_details_popup/vocab_analytics_details_view.dart @@ -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( diff --git a/lib/pangea/analytics_misc/analytics_constants.dart b/lib/pangea/analytics_misc/analytics_constants.dart index d680c1fd7..96fb33a13 100644 --- a/lib/pangea/analytics_misc/analytics_constants.dart +++ b/lib/pangea/analytics_misc/analytics_constants.dart @@ -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"; diff --git a/lib/pangea/toolbar/word_card/word_zoom_widget.dart b/lib/pangea/toolbar/word_card/word_zoom_widget.dart index f8094f26c..0d53ba459 100644 --- a/lib/pangea/toolbar/word_card/word_zoom_widget.dart +++ b/lib/pangea/toolbar/word_card/word_zoom_widget.dart @@ -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,