diff --git a/lib/pages/chat/events/audio_player.dart b/lib/pages/chat/events/audio_player.dart index ad160274c..216beb08e 100644 --- a/lib/pages/chat/events/audio_player.dart +++ b/lib/pages/chat/events/audio_player.dart @@ -323,7 +323,12 @@ class AudioPlayerState extends State { if (kIsWeb) return; final temp = await getTemporaryDirectory(); final tempDir = temp; - final file = File('${tempDir.path}/${widget.matrixFile!.name}'); + String filename = widget.matrixFile!.name; + if (filename.length > 100) { + filename = filename.substring(filename.length - 100); + } + final file = File('${tempDir.path}/$filename'); + await file.writeAsBytes(widget.matrixFile!.bytes); audioFile = file; } @@ -337,11 +342,7 @@ class AudioPlayerState extends State { if (widget.matrixFile != null) { _downloadMatrixFile().then((_) { setState(() => status = AudioPlayerStatus.downloaded); - if (widget.autoplay) { - status == AudioPlayerStatus.downloaded - ? _playAction() - : _downloadAction(); - } + if (widget.autoplay) _playAction(); }); } else if (widget.autoplay) { status == AudioPlayerStatus.downloaded diff --git a/lib/pangea/widgets/chat/message_translation_card.dart b/lib/pangea/widgets/chat/message_translation_card.dart index 42725e3dc..aeb5ae51f 100644 --- a/lib/pangea/widgets/chat/message_translation_card.dart +++ b/lib/pangea/widgets/chat/message_translation_card.dart @@ -144,43 +144,51 @@ class MessageTranslationCardState extends State { return const ToolbarContentLoadingIndicator(); } - return SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 20, 16, 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - widget.selection != null ? selectionTranslation! : repEvent!.text, - style: AppConfig.messageTextStyle( - widget.messageEvent.event, - Theme.of(context).colorScheme.primary, + return ConstrainedBox( + constraints: const BoxConstraints( + maxWidth: AppConfig.toolbarMinWidth, + maxHeight: AppConfig.toolbarMaxHeight, + ), + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 20, 16, 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + widget.selection != null + ? selectionTranslation! + : repEvent!.text, + style: AppConfig.messageTextStyle( + widget.messageEvent.event, + Theme.of(context).colorScheme.primary, + ), + textAlign: TextAlign.center, ), - textAlign: TextAlign.center, - ), - if (notGoingToTranslate && - widget.selection == null && - !InstructionsEnum.l1Translation.toggledOff()) - const Row( - mainAxisSize: MainAxisSize.min, - children: [ - InlineTooltip( - instructionsEnum: InstructionsEnum.l1Translation, - ), - ], - ), - if (widget.selection != null && - !InstructionsEnum.clickAgainToDeselect.toggledOff()) - const Row( - mainAxisSize: MainAxisSize.min, - children: [ - InlineTooltip( - instructionsEnum: InstructionsEnum.clickAgainToDeselect, - ), - ], - ), - ], + if (notGoingToTranslate && + widget.selection == null && + !InstructionsEnum.l1Translation.toggledOff()) + const Row( + mainAxisSize: MainAxisSize.min, + children: [ + InlineTooltip( + instructionsEnum: InstructionsEnum.l1Translation, + ), + ], + ), + if (widget.selection != null && + !InstructionsEnum.clickAgainToDeselect.toggledOff()) + const Row( + mainAxisSize: MainAxisSize.min, + children: [ + InlineTooltip( + instructionsEnum: InstructionsEnum.clickAgainToDeselect, + ), + ], + ), + ], + ), ), ), ); diff --git a/lib/pangea/widgets/igc/card_error_widget.dart b/lib/pangea/widgets/igc/card_error_widget.dart index 54ca282be..81066ad13 100644 --- a/lib/pangea/widgets/igc/card_error_widget.dart +++ b/lib/pangea/widgets/igc/card_error_widget.dart @@ -25,9 +25,7 @@ class CardErrorWidget extends StatelessWidget { return Container( padding: const EdgeInsets.all(8), - constraints: maxWidth != null - ? BoxConstraints(maxWidth: maxWidth!) - : const BoxConstraints(), + constraints: const BoxConstraints(maxWidth: 275), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [