chore: Follow up audioplayer design
This commit is contained in:
parent
a732ea62e2
commit
54306847f8
1 changed files with 15 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
@ -244,6 +245,11 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
body.isNotEmpty &&
|
body.isNotEmpty &&
|
||||||
widget.event.content['org.matrix.msc1767.audio'] == null;
|
widget.event.content['org.matrix.msc1767.audio'] == null;
|
||||||
|
|
||||||
|
final wavePosition =
|
||||||
|
(currentPosition / maxPosition) * AudioPlayerWidget.wavesCount;
|
||||||
|
|
||||||
|
final fontSize = 12 * AppConfig.fontSizeFactor;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
@ -300,8 +306,10 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
horizontal: 1,
|
horizontal: 1,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: widget.color.withAlpha(96),
|
color: i < wavePosition
|
||||||
borderRadius: BorderRadius.circular(32),
|
? theme.colorScheme.onPrimaryContainer
|
||||||
|
: widget.color.withAlpha(64),
|
||||||
|
borderRadius: BorderRadius.circular(64),
|
||||||
),
|
),
|
||||||
height: 32 * (waveform[i] / 1024),
|
height: 32 * (waveform[i] / 1024),
|
||||||
),
|
),
|
||||||
|
|
@ -366,22 +374,24 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (displayBody)
|
if (displayBody) ...[
|
||||||
|
const SizedBox(height: 8),
|
||||||
Linkify(
|
Linkify(
|
||||||
text: body,
|
text: body,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: widget.color,
|
color: widget.color,
|
||||||
fontSize: widget.fontSize,
|
fontSize: fontSize,
|
||||||
),
|
),
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: widget.color.withAlpha(150),
|
color: widget.color.withAlpha(150),
|
||||||
fontSize: widget.fontSize,
|
fontSize: fontSize,
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.underline,
|
||||||
decorationColor: widget.color.withAlpha(150),
|
decorationColor: widget.color.withAlpha(150),
|
||||||
),
|
),
|
||||||
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
|
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue