mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-13 23:49:29 +01:00
39 lines
1.0 KiB
Dart
39 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/event_extension.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) {
|
|
final String filename = event.content.containsKey('filename')
|
|
? event.content['filename']
|
|
: event.body;
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
TextButton.icon(
|
|
onPressed: () => event.saveFile(context),
|
|
icon: const Icon(Icons.download_outlined),
|
|
label: Text(filename),
|
|
),
|
|
if (event.sizeString != null)
|
|
Text(
|
|
event.sizeString,
|
|
style: TextStyle(
|
|
color: textColor,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|