mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-01 00:39:34 +01:00
Minor tweaks
This commit is contained in:
parent
01b1b56852
commit
4900137e2a
@ -59,65 +59,45 @@ class MessageContent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
case MessageTypes.Audio:
|
case MessageTypes.Audio:
|
||||||
return Container(
|
|
||||||
width: 200,
|
|
||||||
child: RaisedButton(
|
|
||||||
color: Colors.blueGrey,
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Icon(Icons.play_arrow, color: Colors.white),
|
|
||||||
Text(
|
|
||||||
I18n.of(context).play(event.body),
|
|
||||||
overflow: TextOverflow.fade,
|
|
||||||
softWrap: false,
|
|
||||||
maxLines: 1,
|
|
||||||
style: TextStyle(color: Colors.white),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onPressed: () => launch(MxContent(event.content["url"])
|
|
||||||
.getDownloadLink(event.room.client)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case MessageTypes.Video:
|
case MessageTypes.Video:
|
||||||
|
case MessageTypes.File:
|
||||||
return Container(
|
return Container(
|
||||||
width: 200,
|
child: Column(
|
||||||
child: RaisedButton(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
color: Colors.blueGrey,
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(Icons.play_arrow, color: Colors.white),
|
RaisedButton(
|
||||||
Text(
|
color: Colors.blueGrey,
|
||||||
I18n.of(context).play(event.body),
|
child: Text(
|
||||||
|
I18n.of(context).downloadFile,
|
||||||
overflow: TextOverflow.fade,
|
overflow: TextOverflow.fade,
|
||||||
softWrap: false,
|
softWrap: false,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
onPressed: () => launch(
|
onPressed: () => launch(
|
||||||
MxContent(event.content["url"])
|
MxContent(event.content["url"])
|
||||||
.getDownloadLink(event.room.client),
|
.getDownloadLink(event.room.client),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
if (event.sizeString != null)
|
||||||
case MessageTypes.File:
|
Text(
|
||||||
return Container(
|
event.sizeString,
|
||||||
width: 200,
|
style: TextStyle(
|
||||||
child: RaisedButton(
|
color: textColor,
|
||||||
color: Colors.blueGrey,
|
fontStyle: FontStyle.italic,
|
||||||
child: Text(
|
|
||||||
I18n.of(context).download(event.body),
|
|
||||||
overflow: TextOverflow.fade,
|
|
||||||
softWrap: false,
|
|
||||||
maxLines: 1,
|
|
||||||
style: TextStyle(color: Colors.white),
|
|
||||||
),
|
),
|
||||||
onPressed: () => launch(
|
|
||||||
MxContent(event.content["url"])
|
|
||||||
.getDownloadLink(Matrix.of(context).client),
|
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
|
(event.content.containsKey("filename")
|
||||||
|
? event.content["filename"]
|
||||||
|
: event.body),
|
||||||
|
style: TextStyle(
|
||||||
|
color: textColor,
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case MessageTypes.BadEncrypted:
|
case MessageTypes.BadEncrypted:
|
||||||
|
@ -272,11 +272,7 @@ class I18n {
|
|||||||
String get displaynameHasBeenChanged =>
|
String get displaynameHasBeenChanged =>
|
||||||
Intl.message("Displayname has been changed");
|
Intl.message("Displayname has been changed");
|
||||||
|
|
||||||
String download(String fileName) => Intl.message(
|
String get downloadFile => Intl.message("Download file");
|
||||||
"Download $fileName",
|
|
||||||
name: "download",
|
|
||||||
args: [fileName],
|
|
||||||
);
|
|
||||||
|
|
||||||
String get editDisplayname => Intl.message("Edit displayname");
|
String get editDisplayname => Intl.message("Edit displayname");
|
||||||
|
|
||||||
@ -296,6 +292,10 @@ class I18n {
|
|||||||
|
|
||||||
String get enterAUsername => Intl.message("Enter a username");
|
String get enterAUsername => Intl.message("Enter a username");
|
||||||
|
|
||||||
|
String get fileName => Intl.message("File name");
|
||||||
|
|
||||||
|
String get fileSize => Intl.message("File size");
|
||||||
|
|
||||||
String get fluffychat => Intl.message("FluffyChat");
|
String get fluffychat => Intl.message("FluffyChat");
|
||||||
|
|
||||||
String get forward => Intl.message('Forward');
|
String get forward => Intl.message('Forward');
|
||||||
|
@ -260,4 +260,22 @@ extension LocalizedBody on Event {
|
|||||||
return Icons.done;
|
return Icons.done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get sizeString {
|
||||||
|
if (content["info"] is Map<String, dynamic> &&
|
||||||
|
content["info"].containsKey("size")) {
|
||||||
|
num size = content["info"]["size"];
|
||||||
|
if (size < 1000000) {
|
||||||
|
size = size / 1000;
|
||||||
|
return "${size.toString()}kb";
|
||||||
|
} else if (size < 1000000000) {
|
||||||
|
size = size / 1000000;
|
||||||
|
return "${size.toString()}mb";
|
||||||
|
} else {
|
||||||
|
size = size / 1000000000;
|
||||||
|
return "${size.toString()}gb";
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user