Merge branch 'soru/update-html-render' into 'main'

chore: Update flutter_matrix_html

See merge request ChristianPauly/fluffychat-flutter!248
This commit is contained in:
Christian Pauly 2020-10-28 09:43:11 +00:00
commit 4e2f489a52
4 changed files with 28 additions and 6 deletions

View File

@ -33,6 +33,8 @@ class HtmlMessage extends StatelessWidget {
// there is no need to pre-validate the html, as we validate it while rendering // there is no need to pre-validate the html, as we validate it while rendering
final matrix = Matrix.of(context);
final themeData = Theme.of(context); final themeData = Theme.of(context);
return Html( return Html(
data: renderHtml, data: renderHtml,
@ -50,12 +52,18 @@ class HtmlMessage extends StatelessWidget {
getMxcUrl: (String mxc, double width, double height) { getMxcUrl: (String mxc, double width, double height) {
final ratio = MediaQuery.of(context).devicePixelRatio; final ratio = MediaQuery.of(context).devicePixelRatio;
return Uri.parse(mxc)?.getThumbnail( return Uri.parse(mxc)?.getThumbnail(
Matrix.of(context).client, matrix.client,
width: (width ?? 800) * ratio, width: (width ?? 800) * ratio,
height: (height ?? 800) * ratio, height: (height ?? 800) * ratio,
method: ThumbnailMethod.scale, method: ThumbnailMethod.scale,
); );
}, },
setCodeLanguage: (String key, String value) async {
await matrix.store.setItem('code_language.$key', value);
},
getCodeLanguage: (String key) async {
return await matrix.store.getItem('code_language.$key');
},
getPillInfo: (String identifier) async { getPillInfo: (String identifier) async {
if (room == null) { if (room == null) {
return null; return null;

View File

@ -62,7 +62,7 @@ class Store {
if (!PlatformInfos.isMobile) { if (!PlatformInfos.isMobile) {
await _setupLocalStorage(); await _setupLocalStorage();
try { try {
return await storage.getItem(key).toString(); return await storage.getItem(key)?.toString();
} catch (_) { } catch (_) {
return null; return null;
} }

View File

@ -309,6 +309,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
flutter_highlight:
dependency: transitive
description:
name: flutter_highlight
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.0"
flutter_keyboard_visibility: flutter_keyboard_visibility:
dependency: transitive dependency: transitive
description: description:
@ -348,7 +355,7 @@ packages:
name: flutter_matrix_html name: flutter_matrix_html
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.9" version: "0.1.10"
flutter_olm: flutter_olm:
dependency: "direct main" dependency: "direct main"
description: description:
@ -408,6 +415,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
highlight:
dependency: transitive
description:
name: highlight
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.0"
html: html:
dependency: transitive dependency: transitive
description: description:
@ -540,7 +554,7 @@ packages:
name: matrix_link_text name: matrix_link_text
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.1" version: "0.3.2"
meta: meta:
dependency: transitive dependency: transitive
description: description:

View File

@ -37,7 +37,7 @@ dependencies:
firebase_messaging: ^7.0.2 firebase_messaging: ^7.0.2
flutter_local_notifications: ^1.4.3 flutter_local_notifications: ^1.4.3
# desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5 # desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5
matrix_link_text: ^0.3.1 matrix_link_text: ^0.3.2
path_provider: ^1.5.1 path_provider: ^1.5.1
downloads_path_provider_28: ^0.1.0 downloads_path_provider_28: ^0.1.0
permission_handler: ^5.0.1+1 permission_handler: ^5.0.1+1
@ -53,7 +53,7 @@ dependencies:
open_file: ^3.0.1 open_file: ^3.0.1
mime_type: ^0.3.0 mime_type: ^0.3.0
bot_toast: ^3.0.0 bot_toast: ^3.0.0
flutter_matrix_html: ^0.1.9 flutter_matrix_html: ^0.1.10
moor: ^3.3.1 moor: ^3.3.1
sqlite3_flutter_libs: ^0.2.0 sqlite3_flutter_libs: ^0.2.0
sqlite3: ^0.1.4 sqlite3: ^0.1.4