fluffychat/lib/components/message_download_content.dart

55 lines
1.5 KiB
Dart
Raw Normal View History

2020-05-03 11:56:53 +02:00
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/material.dart';
import 'package:fluffychat/utils/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) {
2020-05-16 08:09:07 +02:00
final String filename = event.content.containsKey('filename')
? event.content['filename']
: event.body;
2020-05-03 11:56:53 +02:00
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
RaisedButton(
2020-11-22 16:43:45 +01:00
elevation: 7,
color: Theme.of(context).scaffoldBackgroundColor,
2020-05-16 08:09:07 +02:00
shape: RoundedRectangleBorder(
2020-11-22 16:43:45 +01:00
borderRadius: BorderRadius.circular(6),
2020-05-16 08:09:07 +02:00
),
2020-11-22 16:43:45 +01:00
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.download_outlined),
SizedBox(width: 8),
Text(
filename,
overflow: TextOverflow.fade,
softWrap: false,
maxLines: 1,
),
],
2020-05-16 08:02:33 +02:00
),
onPressed: () => event.openFile(context),
),
2020-05-03 11:56:53 +02:00
if (event.sizeString != null)
Text(
2020-05-16 08:09:07 +02:00
event.sizeString,
2020-05-03 11:56:53 +02:00
style: TextStyle(
color: textColor,
),
),
],
),
);
}
}