Fix image sending

parent b3d7800a
......@@ -13,7 +13,8 @@
android:label="Pattle"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false">
android:allowBackup="false"
android:requestLegacyExternalStorage="true">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
......
......@@ -59,8 +59,8 @@ class _PictureContentState extends State<PictureContent> {
var height = 0, width = 0;
if (event is ImageMessageEvent) {
height = event.content.info?.height;
width = event.content.info?.width;
height = event.content.info?.height ?? 0;
width = event.content.info?.width ?? 0;
_uri = event.content.url;
_isVideo = false;
......
......@@ -109,11 +109,13 @@ class InputBloc extends Bloc<InputEvent, InputState> {
}
Future<void> _sendImage(File file) async {
final message = ImageMessage(
url: Uri.file(file.path),
body: file.path.split(Platform.pathSeparator).last,
);
if (file != null) {
final message = ImageMessage(
url: Uri.file(file.path),
body: file.path.split(Platform.pathSeparator).last,
);
_room.send(message).forEach((_) {});
_room.send(message).forEach((_) {});
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment