mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-02 10:09:29 +01:00
61 lines
1.8 KiB
Dart
61 lines
1.8 KiB
Dart
|
import 'package:famedlysdk/famedlysdk.dart';
|
||
|
import 'package:fluffychat/i18n/i18n.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:fluffychat/utils/matrix_file_extension.dart';
|
||
|
import 'package:fluffychat/utils/event_extension.dart';
|
||
|
import 'dialogs/simple_dialogs.dart';
|
||
|
|
||
|
class MessageDownloadContent extends StatelessWidget {
|
||
|
final Event event;
|
||
|
final Color textColor;
|
||
|
|
||
|
const MessageDownloadContent(this.event, this.textColor, {Key key})
|
||
|
: super(key: key);
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Container(
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
mainAxisSize: MainAxisSize.min,
|
||
|
children: <Widget>[
|
||
|
RaisedButton(
|
||
|
color: Colors.blueGrey,
|
||
|
child: Text(
|
||
|
I18n.of(context).downloadFile,
|
||
|
overflow: TextOverflow.fade,
|
||
|
softWrap: false,
|
||
|
maxLines: 1,
|
||
|
style: TextStyle(color: Colors.white),
|
||
|
),
|
||
|
onPressed: () async {
|
||
|
final MatrixFile matrixFile =
|
||
|
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||
|
event.downloadAndDecryptAttachment(),
|
||
|
);
|
||
|
matrixFile.open();
|
||
|
}),
|
||
|
Text(
|
||
|
"- " +
|
||
|
(event.content.containsKey("filename")
|
||
|
? event.content["filename"]
|
||
|
: event.body),
|
||
|
style: TextStyle(
|
||
|
color: textColor,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
),
|
||
|
),
|
||
|
if (event.sizeString != null)
|
||
|
Text(
|
||
|
"- " + event.sizeString,
|
||
|
style: TextStyle(
|
||
|
color: textColor,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|