mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Integrate an audio player in the application
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
import 'package:comunic/models/conversation_message.dart';
|
||||
import 'package:comunic/ui/dialogs/audio_player_dialog.dart';
|
||||
import 'package:comunic/ui/widgets/network_image_widget.dart';
|
||||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -47,7 +48,7 @@ class _ConversationFileWidgetState extends State<ConversationFileWidget> {
|
||||
),
|
||||
);
|
||||
|
||||
// The file is not downloadable, we open it in the browser
|
||||
// We open it in the browser
|
||||
default:
|
||||
return Container(
|
||||
color: widget.defaultBackgroundColor,
|
||||
@ -69,11 +70,22 @@ class _ConversationFileWidgetState extends State<ConversationFileWidget> {
|
||||
Spacer(flex: 2),
|
||||
],
|
||||
),
|
||||
onPressed: () => launch(file.url),
|
||||
onPressed: _openFile,
|
||||
),
|
||||
),
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void _openFile() {
|
||||
switch (file.fileType) {
|
||||
case ConversationMessageFileType.AUDIO:
|
||||
showAudioPlayerDialog(context, file.url);
|
||||
break;
|
||||
|
||||
default:
|
||||
launch(file.url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user