|
|
@ -10,8 +10,14 @@ import '../../utils/resize_image.dart';
|
|
|
|
class SendFileDialog extends StatefulWidget {
|
|
|
|
class SendFileDialog extends StatefulWidget {
|
|
|
|
final Room room;
|
|
|
|
final Room room;
|
|
|
|
final MatrixFile file;
|
|
|
|
final MatrixFile file;
|
|
|
|
|
|
|
|
final L10n l10n;
|
|
|
|
|
|
|
|
|
|
|
|
const SendFileDialog({this.room, this.file, Key key}) : super(key: key);
|
|
|
|
const SendFileDialog({
|
|
|
|
|
|
|
|
this.room,
|
|
|
|
|
|
|
|
@required this.l10n,
|
|
|
|
|
|
|
|
this.file,
|
|
|
|
|
|
|
|
Key key,
|
|
|
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_SendFileDialogState createState() => _SendFileDialogState();
|
|
|
|
_SendFileDialogState createState() => _SendFileDialogState();
|
|
|
@ -34,13 +40,13 @@ class _SendFileDialogState extends State<SendFileDialog> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
var sendStr = L10n.of(context).sendFile;
|
|
|
|
var sendStr = widget.l10n.sendFile;
|
|
|
|
if (widget.file is MatrixImageFile) {
|
|
|
|
if (widget.file is MatrixImageFile) {
|
|
|
|
sendStr = L10n.of(context).sendImage;
|
|
|
|
sendStr = widget.l10n.sendImage;
|
|
|
|
} else if (widget.file is MatrixAudioFile) {
|
|
|
|
} else if (widget.file is MatrixAudioFile) {
|
|
|
|
sendStr = L10n.of(context).sendAudio;
|
|
|
|
sendStr = widget.l10n.sendAudio;
|
|
|
|
} else if (widget.file is MatrixVideoFile) {
|
|
|
|
} else if (widget.file is MatrixVideoFile) {
|
|
|
|
sendStr = L10n.of(context).sendVideo;
|
|
|
|
sendStr = widget.l10n.sendVideo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Widget contentWidget;
|
|
|
|
Widget contentWidget;
|
|
|
|
if (widget.file is MatrixImageFile) {
|
|
|
|
if (widget.file is MatrixImageFile) {
|
|
|
@ -60,8 +66,8 @@ class _SendFileDialogState extends State<SendFileDialog> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
InkWell(
|
|
|
|
onTap: () => setState(() => origImage = !origImage),
|
|
|
|
onTap: () => setState(() => origImage = !origImage),
|
|
|
|
child: Text(L10n.of(context).sendOriginal +
|
|
|
|
child: Text(
|
|
|
|
' (${widget.file.sizeString})'),
|
|
|
|
widget.l10n.sendOriginal + ' (${widget.file.sizeString})'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -74,14 +80,14 @@ class _SendFileDialogState extends State<SendFileDialog> {
|
|
|
|
content: contentWidget,
|
|
|
|
content: contentWidget,
|
|
|
|
actions: <Widget>[
|
|
|
|
actions: <Widget>[
|
|
|
|
FlatButton(
|
|
|
|
FlatButton(
|
|
|
|
child: Text(L10n.of(context).cancel),
|
|
|
|
child: Text(widget.l10n.cancel),
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
// just close the dialog
|
|
|
|
// just close the dialog
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
FlatButton(
|
|
|
|
FlatButton(
|
|
|
|
child: Text(L10n.of(context).send),
|
|
|
|
child: Text(widget.l10n.send),
|
|
|
|
onPressed: _isSending
|
|
|
|
onPressed: _isSending
|
|
|
|
? null
|
|
|
|
? null
|
|
|
|
: () async {
|
|
|
|
: () async {
|
|
|
|