FurryChat/lib/components/message_download_content.dart

49 lines
1.4 KiB
Dart
Raw Normal View History

2020-05-03 09:56:53 +00:00
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/material.dart';
2020-10-06 19:59:36 +00:00
import 'package:furrychat/utils/event_extension.dart';
2020-05-03 09:56:53 +00:00
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 06:09:07 +00:00
final String filename = event.content.containsKey('filename')
? event.content['filename']
: event.body;
2020-05-03 09:56:53 +00:00
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
RaisedButton(
2020-05-16 06:09:07 +00:00
color: textColor,
elevation: 10,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
2020-05-16 06:02:33 +00:00
child: Text(
2020-05-16 06:09:07 +00:00
filename,
2020-05-16 06:02:33 +00:00
overflow: TextOverflow.fade,
softWrap: false,
maxLines: 1,
2020-05-16 06:09:07 +00:00
style: TextStyle(color: Theme.of(context).primaryColor),
2020-05-16 06:02:33 +00:00
),
onPressed: () => event.openFile(context),
),
2020-05-03 09:56:53 +00:00
if (event.sizeString != null)
Text(
2020-05-16 06:09:07 +00:00
event.sizeString,
2020-05-03 09:56:53 +00:00
style: TextStyle(
color: textColor,
),
),
],
),
);
}
}