diff --git a/lib/pangea/chat/widgets/chat_input_bar.dart b/lib/pangea/chat/widgets/chat_input_bar.dart index 72c3d4160..78a0cdf4f 100644 --- a/lib/pangea/chat/widgets/chat_input_bar.dart +++ b/lib/pangea/chat/widgets/chat_input_bar.dart @@ -8,6 +8,8 @@ import 'package:fluffychat/pages/chat/reply_display.dart'; import 'package:fluffychat/pangea/activity_sessions/activity_session_chat/activity_role_tooltip.dart'; import 'package:fluffychat/pangea/chat/widgets/pangea_chat_input_row.dart'; import 'package:fluffychat/pangea/choreographer/it/it_bar.dart'; +import 'package:fluffychat/pangea/instructions/instructions_enum.dart'; +import 'package:fluffychat/pangea/instructions/instructions_inline_tooltip.dart'; class ChatInputBar extends StatelessWidget { final ChatController controller; @@ -25,9 +27,24 @@ class ChatInputBar extends StatelessWidget { return Column( mainAxisSize: MainAxisSize.min, children: [ - ActivityRoleTooltip( - room: controller.room, - hide: controller.choreographer.itController.open, + ValueListenableBuilder( + valueListenable: controller.choreographer.itController.open, + builder: (context, open, __) { + return open + ? InstructionsInlineTooltip( + instructionsEnum: InstructionsEnum.clickBestOption, + animate: false, + padding: EdgeInsets.only( + left: 16.0, + right: 16.0, + top: FluffyThemes.isColumnMode(context) ? 16.0 : 8.0, + ), + ) + : ActivityRoleTooltip( + room: controller.room, + hide: controller.choreographer.itController.open, + ); + }, ), Container( margin: EdgeInsets.all( diff --git a/lib/pangea/choreographer/it/it_bar.dart b/lib/pangea/choreographer/it/it_bar.dart index a4804d6e6..dfdd6e87a 100644 --- a/lib/pangea/choreographer/it/it_bar.dart +++ b/lib/pangea/choreographer/it/it_bar.dart @@ -12,8 +12,6 @@ import 'package:fluffychat/pangea/choreographer/it/it_feedback_card.dart'; import 'package:fluffychat/pangea/choreographer/it/word_data_card.dart'; import 'package:fluffychat/pangea/common/utils/error_handler.dart'; import 'package:fluffychat/pangea/common/widgets/error_indicator.dart'; -import 'package:fluffychat/pangea/instructions/instructions_enum.dart'; -import 'package:fluffychat/pangea/instructions/instructions_inline_tooltip.dart'; import 'package:fluffychat/pangea/learning_settings/pages/settings_learning.dart'; import 'package:fluffychat/pangea/translation/full_text_translation_request_model.dart'; import 'package:fluffychat/widgets/matrix.dart'; @@ -186,91 +184,79 @@ class ITBarState extends State with SingleTickerProviderStateMixin { ), child: CompositedTransformTarget( link: MatrixState.pAnyState.layerLinkAndKey('it_bar').link, - child: Column( - children: [ - if (!InstructionsEnum.clickBestOption.isToggledOff) ...[ - const InstructionsInlineTooltip( - instructionsEnum: InstructionsEnum.clickBestOption, - animate: false, - ), - const SizedBox(height: 8.0), - ], - Container( - key: MatrixState.pAnyState.layerLinkAndKey('it_bar').key, - decoration: BoxDecoration( - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(24), - topRight: Radius.circular(24), - ), - color: Theme.of(context).colorScheme.surfaceContainer, - ), - padding: const EdgeInsets.all(12.0), - child: Column( - spacing: 12.0, - children: [ - _ITBarHeader( - onClose: widget.choreographer.itController.closeIT, - setEditing: - widget.choreographer.itController.setEditingSourceText, - editing: widget.choreographer.itController.editing, - sourceTextController: _sourceTextController, - sourceText: _sourceText, - onSubmitEdits: (_) { - widget.choreographer.itController.submitSourceTextEdits( - _sourceTextController.text, - ); - }, - ), - Container( - padding: const EdgeInsets.symmetric(horizontal: 12.0), - constraints: const BoxConstraints(minHeight: 80), - child: Center( - child: widget.choreographer.errorService.isError - ? Row( - spacing: 8.0, - mainAxisSize: MainAxisSize.min, - children: [ - ErrorIndicator( - message: L10n.of(context).translationError, - style: TextStyle( - fontStyle: FontStyle.italic, - color: Theme.of(context).colorScheme.error, - ), - ), - IconButton( - onPressed: - widget.choreographer.itController.closeIT, - icon: const Icon( - Icons.close, - size: 20, - ), - ), - ], - ) - : ValueListenableBuilder( - valueListenable: widget - .choreographer.itController.currentITStep, - builder: (context, step, __) { - return step == null - ? CircularProgressIndicator( - strokeWidth: 2.0, - color: Theme.of(context) - .colorScheme - .primary, - ) - : _ITChoices( - continuances: step.continuances, - onPressed: _selectContinuance, - onLongPressed: _showFeedbackCard, - ); - }, - ), - ), - ), - ], - ), + child: Container( + key: MatrixState.pAnyState.layerLinkAndKey('it_bar').key, + decoration: BoxDecoration( + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(24), + topRight: Radius.circular(24), ), - ], + color: Theme.of(context).colorScheme.surfaceContainer, + ), + padding: const EdgeInsets.all(12.0), + child: Column( + spacing: 12.0, + children: [ + _ITBarHeader( + onClose: widget.choreographer.itController.closeIT, + setEditing: + widget.choreographer.itController.setEditingSourceText, + editing: widget.choreographer.itController.editing, + sourceTextController: _sourceTextController, + sourceText: _sourceText, + onSubmitEdits: (_) { + widget.choreographer.itController.submitSourceTextEdits( + _sourceTextController.text, + ); + }, + ), + Container( + padding: const EdgeInsets.symmetric(horizontal: 12.0), + constraints: const BoxConstraints(minHeight: 80), + child: Center( + child: widget.choreographer.errorService.isError + ? Row( + spacing: 8.0, + mainAxisSize: MainAxisSize.min, + children: [ + ErrorIndicator( + message: L10n.of(context).translationError, + style: TextStyle( + fontStyle: FontStyle.italic, + color: Theme.of(context).colorScheme.error, + ), + ), + IconButton( + onPressed: + widget.choreographer.itController.closeIT, + icon: const Icon( + Icons.close, + size: 20, + ), + ), + ], + ) + : ValueListenableBuilder( + valueListenable: + widget.choreographer.itController.currentITStep, + builder: (context, step, __) { + return step == null + ? CircularProgressIndicator( + strokeWidth: 2.0, + color: + Theme.of(context).colorScheme.primary, + ) + : _ITChoices( + continuances: step.continuances, + onPressed: _selectContinuance, + onLongPressed: _showFeedbackCard, + ); + }, + ), + ), + ), + ], + ), ), ), );