Skip to content

Commit

Permalink
chore: Follow up audioplayer design
Browse files Browse the repository at this point in the history
  • Loading branch information
krille-chan committed Sep 11, 2024
1 parent a732ea6 commit 5430684
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/pages/chat/events/audio_player.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:io';

import 'package:fluffychat/config/app_config.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -244,6 +245,11 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
body.isNotEmpty &&
widget.event.content['org.matrix.msc1767.audio'] == null;

final wavePosition =
(currentPosition / maxPosition) * AudioPlayerWidget.wavesCount;

final fontSize = 12 * AppConfig.fontSizeFactor;

return Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
Expand Down Expand Up @@ -300,8 +306,10 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
horizontal: 1,
),
decoration: BoxDecoration(
color: widget.color.withAlpha(96),
borderRadius: BorderRadius.circular(32),
color: i < wavePosition
? theme.colorScheme.onPrimaryContainer
: widget.color.withAlpha(64),
borderRadius: BorderRadius.circular(64),
),
height: 32 * (waveform[i] / 1024),
),
Expand Down Expand Up @@ -366,22 +374,24 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
],
),
),
if (displayBody)
if (displayBody) ...[
const SizedBox(height: 8),
Linkify(
text: body,
style: TextStyle(
color: widget.color,
fontSize: widget.fontSize,
fontSize: fontSize,
),
options: const LinkifyOptions(humanize: false),
linkStyle: TextStyle(
color: widget.color.withAlpha(150),
fontSize: widget.fontSize,
fontSize: fontSize,
decoration: TextDecoration.underline,
decorationColor: widget.color.withAlpha(150),
),
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
),
],
],
),
);
Expand Down

0 comments on commit 5430684

Please sign in to comment.