From bfe8766dd1afea79b88035ce657524304ec5f697 Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Tue, 6 May 2025 09:35:00 -0400 Subject: [PATCH] chore: hide level up details on production (#2682) --- lib/pangea/analytics_misc/level_up.dart | 114 +++++++++++++----------- 1 file changed, 63 insertions(+), 51 deletions(-) diff --git a/lib/pangea/analytics_misc/level_up.dart b/lib/pangea/analytics_misc/level_up.dart index eea3121e0..fab1f2473 100644 --- a/lib/pangea/analytics_misc/level_up.dart +++ b/lib/pangea/analytics_misc/level_up.dart @@ -10,6 +10,7 @@ import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/pangea/analytics_misc/analytics_constants.dart'; import 'package:fluffychat/pangea/analytics_misc/learning_skills_enum.dart'; +import 'package:fluffychat/pangea/common/config/environment.dart'; import 'package:fluffychat/pangea/common/utils/overlay.dart'; import 'package:fluffychat/pangea/constructs/construct_repo.dart'; import 'package:fluffychat/widgets/matrix.dart'; @@ -178,6 +179,8 @@ class LevelUpBannerState extends State } Future _toggleDetails() async { + if (!Environment.isStaging) return; + if (mounted) { setState(() { _showDetails = !_showDetails; @@ -282,59 +285,68 @@ class LevelUpBannerState extends State ), ), ), - AnimatedSize( - duration: FluffyThemes.animationDuration, - child: _error == null - ? FluffyThemes.isColumnMode(context) - ? ElevatedButton( - style: IconButton.styleFrom( - padding: - const EdgeInsets.symmetric( - vertical: 4.0, - horizontal: 16.0, - ), - ), - onPressed: _toggleDetails, - child: Text( - L10n.of(context).details, - ), - ) - : SizedBox( - width: 32.0, - height: 32.0, - child: Center( - child: IconButton( - icon: const Icon( - Icons.info_outline, + Row( + children: [ + if (Environment.isStaging) + AnimatedSize( + duration: FluffyThemes.animationDuration, + child: _error == null + ? FluffyThemes.isColumnMode(context) + ? ElevatedButton( + style: IconButton.styleFrom( + padding: const EdgeInsets + .symmetric( + vertical: 4.0, + horizontal: 16.0, + ), + ), + onPressed: _toggleDetails, + child: Text( + L10n.of(context).details, + ), + ) + : SizedBox( + width: 32.0, + height: 32.0, + child: Center( + child: IconButton( + icon: const Icon( + Icons.info_outline, + ), + style: + IconButton.styleFrom( + padding: + const EdgeInsets + .all( + 4.0, + ), + ), + onPressed: _toggleDetails, + constraints: + const BoxConstraints(), + ), + ), + ) + : Row( + children: [ + Tooltip( + message: L10n.of(context) + .oopsSomethingWentWrong, + child: Icon( + Icons.error, + color: Theme.of(context) + .colorScheme + .error, + ), ), - style: IconButton.styleFrom( - padding: - const EdgeInsets.all(4.0), - ), - onPressed: _toggleDetails, - constraints: - const BoxConstraints(), - ), + ], ), - ) - : Row( - children: [ - Tooltip( - message: L10n.of(context) - .oopsSomethingWentWrong, - child: Icon( - Icons.error, - color: Theme.of(context) - .colorScheme - .error, - ), - ), - IconButton( - icon: const Icon(Icons.close), - onPressed: _close, - ), - ], - ), + ), + IconButton( + icon: const Icon(Icons.close), + onPressed: _close, + ), + ], ), ], ),