diff --git a/lib/common/widgets/html_render.dart b/lib/common/widgets/html_render.dart
index 3e016f76..a4269d71 100644
--- a/lib/common/widgets/html_render.dart
+++ b/lib/common/widgets/html_render.dart
@@ -32,7 +32,7 @@ Widget htmlRender({
final bool isEmote = imgUrl.contains('/emote/');
final bool isMall = imgUrl.contains('/mall/');
if (isMall) {
- return const SizedBox();
+ return const SizedBox.shrink();
}
// bool inTable =
// extensionContext.element!.previousElementSibling == null ||
@@ -43,6 +43,18 @@ Widget htmlRender({
// width: isEmote ? 22 : null,
// height: isEmote ? 22 : null,
// );
+ String? height = RegExp(r'max-height:(\d+)px')
+ .firstMatch('${attributes['style']}')
+ ?.group(1);
+ if (height != null) {
+ return NetworkImgLayer(
+ width: constrainedWidth,
+ height: double.parse(height),
+ src: imgUrl,
+ type: 'emote',
+ boxFit: BoxFit.contain,
+ );
+ }
return Hero(
tag: imgUrl,
child: GestureDetector(
diff --git a/lib/common/widgets/network_img_layer.dart b/lib/common/widgets/network_img_layer.dart
index 7637cffc..f7531cc4 100644
--- a/lib/common/widgets/network_img_layer.dart
+++ b/lib/common/widgets/network_img_layer.dart
@@ -22,6 +22,7 @@ class NetworkImgLayer extends StatelessWidget {
this.isLongPic,
this.callback,
this.getPlaceHolder,
+ this.boxFit,
});
final String? src;
@@ -38,6 +39,7 @@ class NetworkImgLayer extends StatelessWidget {
final Function? isLongPic;
final Function? callback;
final Function? getPlaceHolder;
+ final BoxFit? boxFit;
@override
Widget build(BuildContext context) {
@@ -68,7 +70,7 @@ class NetworkImgLayer extends StatelessWidget {
height: ignoreHeight == null || ignoreHeight == false ? height : null,
memCacheWidth: memCacheWidth,
memCacheHeight: memCacheHeight,
- fit: BoxFit.cover,
+ fit: boxFit ?? BoxFit.cover,
alignment:
isLongPic?.call() == true ? Alignment.topCenter : Alignment.center,
fadeOutDuration: fadeOutDuration ?? const Duration(milliseconds: 120),
diff --git a/lib/pages/webview/webview_page.dart b/lib/pages/webview/webview_page.dart
index 50575c13..aa5e7fc9 100644
--- a/lib/pages/webview/webview_page.dart
+++ b/lib/pages/webview/webview_page.dart
@@ -203,8 +203,7 @@ class _WebviewPageNewState extends State {
window.flutter_inappwebview.callHandler('finishButtonClicked');
});
""");
- }
- if (url.toString().startsWith('https://live.bilibili.com')) {
+ } else if (url.toString().startsWith('https://live.bilibili.com')) {
_webViewController?.evaluateJavascript(
source: '''
document.styleSheets[0].insertRule('div.open-app-btn.bili-btn-warp {display:none;}', 0);