merge a
This commit is contained in:
parent
c15be05246
commit
41cc0560d0
15 changed files with 87 additions and 64 deletions
|
|
@ -8,8 +8,6 @@ import 'package:matrix/matrix.dart';
|
|||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/config/setting_keys.dart';
|
||||
import 'package:fluffychat/utils/file_description.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/utils/url_launcher.dart';
|
||||
import 'package:fluffychat/widgets/blur_hash.dart';
|
||||
import 'package:fluffychat/widgets/mxc_image.dart';
|
||||
|
|
@ -33,8 +31,6 @@ class EventVideoPlayer extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final supportsVideoPlayer = PlatformInfos.supportsVideoPlayer;
|
||||
|
||||
final blurHash =
|
||||
(event.infoMap as Map<String, dynamic>).tryGet<String>(
|
||||
'xyz.amorgan.blurhash',
|
||||
|
|
@ -63,8 +59,7 @@ class EventVideoPlayer extends StatelessWidget {
|
|||
color: Colors.black,
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
child: InkWell(
|
||||
onTap: () => supportsVideoPlayer
|
||||
? showDialog(
|
||||
onTap: () => showDialog(
|
||||
context: context,
|
||||
builder: (_) => ImageViewer(
|
||||
event,
|
||||
|
|
@ -72,7 +67,6 @@ class EventVideoPlayer extends StatelessWidget {
|
|||
outerContext: context,
|
||||
),
|
||||
)
|
||||
: event.saveFile(context),
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
|
|
@ -104,9 +98,7 @@ class EventVideoPlayer extends StatelessWidget {
|
|||
),
|
||||
Center(
|
||||
child: CircleAvatar(
|
||||
child: supportsVideoPlayer
|
||||
? const Icon(Icons.play_arrow_outlined)
|
||||
: const Icon(Icons.file_download_outlined),
|
||||
child: const Icon(Icons.play_arrow_outlined),
|
||||
),
|
||||
),
|
||||
if (duration != null)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class ImageViewerController extends State<ImageViewer> {
|
|||
(event) => {
|
||||
MessageTypes.Image,
|
||||
MessageTypes.Sticker,
|
||||
if (PlatformInfos.supportsVideoPlayer) MessageTypes.Video,
|
||||
MessageTypes.Video,
|
||||
}.contains(event.messageType),
|
||||
)
|
||||
.toList()
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import 'package:path_provider/path_provider.dart';
|
|||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/blur_hash.dart';
|
||||
import '../../../utils/error_reporter.dart';
|
||||
import '../../widgets/mxc_image.dart';
|
||||
|
|
@ -30,16 +28,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
|
||||
double? _downloadProgress;
|
||||
|
||||
// The video_player package only doesn't support Windows and Linux.
|
||||
final _supportsVideoPlayer =
|
||||
!PlatformInfos.isWindows && !PlatformInfos.isLinux;
|
||||
|
||||
Future<void> _downloadAction() async {
|
||||
if (!_supportsVideoPlayer) {
|
||||
widget.event.saveFile(context);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final fileSize = widget.event.content
|
||||
.tryGetMap<String, Object?>('info')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue