From d8c1ca991a31d79a087997b82acb0ee0a19f95b5 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Thu, 13 Nov 2025 13:17:04 -0500 Subject: [PATCH] stylistic tweaks --- .../choreographer_error_controller.dart | 8 +-- .../choreographer_state_extension.dart | 11 ++-- lib/pangea/choreographer/it/it_shimmer.dart | 60 ++++++++----------- .../choreographer/it/word_data_card.dart | 22 +++---- 4 files changed, 42 insertions(+), 59 deletions(-) diff --git a/lib/pangea/choreographer/choreographer_error_controller.dart b/lib/pangea/choreographer/choreographer_error_controller.dart index 2072abe19..876fd54d1 100644 --- a/lib/pangea/choreographer/choreographer_error_controller.dart +++ b/lib/pangea/choreographer/choreographer_error_controller.dart @@ -41,7 +41,7 @@ class ChoreographerErrorController extends ChangeNotifier { _error = error; Future.delayed(defaultCooldown, () { - clear(); + _error = null; notifyListeners(); }); notifyListeners(); @@ -53,11 +53,7 @@ class ChoreographerErrorController extends ChangeNotifier { } void resetError() { - clear(); + _error = null; notifyListeners(); } - - void clear() { - _error = null; - } } diff --git a/lib/pangea/choreographer/choreographer_state_extension.dart b/lib/pangea/choreographer/choreographer_state_extension.dart index ec1d269ce..e8bb94213 100644 --- a/lib/pangea/choreographer/choreographer_state_extension.dart +++ b/lib/pangea/choreographer/choreographer_state_extension.dart @@ -3,12 +3,7 @@ import 'package:fluffychat/pangea/choreographer/choreo_mode_enum.dart'; import 'package:fluffychat/pangea/choreographer/choreographer.dart'; import 'package:fluffychat/widgets/matrix.dart'; -extension ChoregrapherUserSettingsExtension on Choreographer { - bool get isRunningIT { - return choreoMode == ChoreoModeEnum.it && - itController.currentITStep.value?.isFinal != true; - } - +extension ChoregrapherStateExtension on Choreographer { AssistanceStateEnum get assistanceState { final isSubscribed = MatrixState.pangeaController.subscriptionController.isSubscribed; @@ -21,7 +16,9 @@ extension ChoregrapherUserSettingsExtension on Choreographer { return AssistanceStateEnum.error; } - if (igcController.openMatches.isNotEmpty || isRunningIT) { + if (igcController.openMatches.isNotEmpty || + (choreoMode == ChoreoModeEnum.it && + itController.currentITStep.value?.isFinal != true)) { return AssistanceStateEnum.fetched; } diff --git a/lib/pangea/choreographer/it/it_shimmer.dart b/lib/pangea/choreographer/it/it_shimmer.dart index 93c32e633..33ab1ba28 100644 --- a/lib/pangea/choreographer/it/it_shimmer.dart +++ b/lib/pangea/choreographer/it/it_shimmer.dart @@ -7,47 +7,35 @@ class ItShimmer extends StatelessWidget { @override Widget build(BuildContext context) { - final List dummyStrings = []; - for (int i = 0; i < 3; i++) { - dummyStrings.add(" " * 10); - } + final color = Theme.of(context).colorScheme.primary.withAlpha(50); + return Wrap( alignment: WrapAlignment.center, - children: [ - ...dummyStrings.map( - (e) => Container( - constraints: const BoxConstraints(minWidth: 50), - margin: const EdgeInsets.all(2), - padding: EdgeInsets.zero, - child: ImageFiltered( - imageFilter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: TextButton( - style: ButtonStyle( - padding: WidgetStateProperty.all( - const EdgeInsets.symmetric(horizontal: 7), - ), - shape: WidgetStateProperty.all( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - ), - backgroundColor: WidgetStateProperty.all( - Theme.of(context).colorScheme.primary.withAlpha(50), - ), - ), - onPressed: null, - child: Text( - e, - style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: Colors.transparent, - fontSize: 16, - ), - ), + spacing: 4, + runSpacing: 4, + children: List.generate(3, (_) { + return ImageFiltered( + imageFilter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: TextButton( + style: TextButton.styleFrom( + minimumSize: const Size(50, 36), + backgroundColor: color, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + padding: const EdgeInsets.symmetric(horizontal: 7), + ), + onPressed: null, + child: const Text( + " ", // 10 spaces + style: TextStyle( + color: Colors.transparent, + fontSize: 16, ), ), ), - ), - ], + ); + }), ); } } diff --git a/lib/pangea/choreographer/it/word_data_card.dart b/lib/pangea/choreographer/it/word_data_card.dart index 0399248bf..c0dae4dcf 100644 --- a/lib/pangea/choreographer/it/word_data_card.dart +++ b/lib/pangea/choreographer/it/word_data_card.dart @@ -23,19 +23,21 @@ class WordDataCard extends StatelessWidget { required this.langCode, }); + ContextualDefinitionRequestModel get _request => + ContextualDefinitionRequestModel( + fullText: fullText, + word: word, + fullTextLang: langCode, + wordLang: langCode, + feedbackLang: + MatrixState.pangeaController.languageController.activeL1Code() ?? + LanguageKeys.defaultLanguage, + ); + Future> _fetchDefinition() { - final request = ContextualDefinitionRequestModel( - fullText: fullText, - word: word, - fullTextLang: langCode, - wordLang: langCode, - feedbackLang: - MatrixState.pangeaController.languageController.activeL1Code() ?? - LanguageKeys.defaultLanguage, - ); return ContextualDefinitionRepo.get( MatrixState.pangeaController.userController.accessToken, - request, + _request, ).timeout( const Duration(seconds: 10), onTimeout: () => Result.error("Timeout getting definition"),