Testing fixes (#1079)

* make toolbar translation scrollable

* fix for playing audio on mobile for very long messages
This commit is contained in:
ggurdin 2024-11-20 15:26:35 -05:00 committed by GitHub
parent 82359a11fa
commit 6091fecb09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 45 deletions

View file

@ -323,7 +323,12 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
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<AudioPlayerWidget> {
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

View file

@ -144,43 +144,51 @@ class MessageTranslationCardState extends State<MessageTranslationCard> {
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,
),
],
),
],
),
),
),
);

View file

@ -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: [