feat: Send image / video / file dialog
This commit is contained in:
parent
b45c44239e
commit
e9d806c844
11 changed files with 245 additions and 45 deletions
|
|
@ -31,4 +31,34 @@ extension MatrixFileExtension on MatrixFile {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
MatrixFile get detectFileType {
|
||||
if (msgType == MessageTypes.Image) {
|
||||
return MatrixImageFile(bytes: bytes, name: name);
|
||||
}
|
||||
if (msgType == MessageTypes.Video) {
|
||||
return MatrixVideoFile(bytes: bytes, name: name);
|
||||
}
|
||||
if (msgType == MessageTypes.Audio) {
|
||||
return MatrixAudioFile(bytes: bytes, name: name);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
String get sizeString {
|
||||
var size = this.size.toDouble();
|
||||
if (size < 1000000) {
|
||||
size = size / 1000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} KB';
|
||||
} else if (size < 1000000000) {
|
||||
size = size / 1000000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} MB';
|
||||
} else {
|
||||
size = size / 1000000000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} GB';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue