mod: 界面及无障碍调整

This commit is contained in:
orz12
2024-03-13 18:38:59 +08:00
parent cc6da716bc
commit 4d5f57b8d0
16 changed files with 277 additions and 222 deletions

View File

@@ -31,6 +31,7 @@ class StatDanMu extends StatelessWidget {
fontSize: size == 'medium' ? 12 : 11, fontSize: size == 'medium' ? 12 : 11,
color: color, color: color,
), ),
overflow: TextOverflow.clip,
semanticsLabel: '${Utils.numFormat(danmu!)}条弹幕', semanticsLabel: '${Utils.numFormat(danmu!)}条弹幕',
) )
], ],

View File

@@ -34,6 +34,7 @@ class StatView extends StatelessWidget {
fontSize: size == 'medium' ? 12 : 11, fontSize: size == 'medium' ? 12 : 11,
color: color, color: color,
), ),
overflow: TextOverflow.clip,
semanticsLabel: semanticsLabel:
'${Utils.numFormat(view!)}${goto == "picture" ? "浏览" : "播放"}', '${Utils.numFormat(view!)}${goto == "picture" ? "浏览" : "播放"}',
), ),

View File

@@ -38,96 +38,111 @@ class VideoCardH extends StatelessWidget {
final int aid = videoItem.aid; final int aid = videoItem.aid;
final String bvid = videoItem.bvid; final String bvid = videoItem.bvid;
final String heroTag = Utils.makeHeroTag(aid); final String heroTag = Utils.makeHeroTag(aid);
return Semantics( return Stack(children: [
label: Utils.videoItemSemantics(videoItem), Semantics(
excludeSemantics: true, label: Utils.videoItemSemantics(videoItem),
child: GestureDetector( excludeSemantics: true,
onLongPress: () { child: GestureDetector(
if (longPress != null) { onLongPress: () {
longPress!(); if (longPress != null) {
} longPress!();
},
// onLongPressEnd: (details) {
// if (longPressEnd != null) {
// longPressEnd!();
// }
// },
child: InkWell(
onTap: () async {
try {
final int cid = videoItem.cid ??
await SearchHttp.ab2c(aid: aid, bvid: bvid);
Get.toNamed('/video?bvid=$bvid&cid=$cid',
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
} catch (err) {
SmartDialog.showToast(err.toString());
} }
}, },
child: Padding( // onLongPressEnd: (details) {
padding: const EdgeInsets.fromLTRB( // if (longPressEnd != null) {
StyleString.safeSpace, 5, StyleString.safeSpace, 5), // longPressEnd!();
child: LayoutBuilder( // }
builder: (BuildContext context, BoxConstraints boxConstraints) { // },
final double width = (boxConstraints.maxWidth - child: InkWell(
StyleString.cardSpace * onTap: () async {
6 / try {
MediaQuery.textScalerOf(context).scale(1.0)) / final int cid = videoItem.cid ??
2; await SearchHttp.ab2c(aid: aid, bvid: bvid);
return Container( Get.toNamed('/video?bvid=$bvid&cid=$cid',
constraints: const BoxConstraints(minHeight: 88), arguments: {'videoItem': videoItem, 'heroTag': heroTag});
height: width / StyleString.aspectRatio, } catch (err) {
child: Row( SmartDialog.showToast(err.toString());
mainAxisAlignment: MainAxisAlignment.start, }
crossAxisAlignment: CrossAxisAlignment.start, },
children: <Widget>[ child: Padding(
AspectRatio( padding: const EdgeInsets.fromLTRB(
aspectRatio: StyleString.aspectRatio, StyleString.safeSpace, 5, StyleString.safeSpace, 5),
child: LayoutBuilder( child: LayoutBuilder(
builder: (BuildContext context, builder:
BoxConstraints boxConstraints) { (BuildContext context, BoxConstraints boxConstraints) {
final double maxWidth = boxConstraints.maxWidth; final double width = (boxConstraints.maxWidth -
final double maxHeight = boxConstraints.maxHeight; StyleString.cardSpace *
return Stack( 6 /
children: [ MediaQuery.textScalerOf(context).scale(1.0)) /
Hero( 2;
tag: heroTag, return Container(
child: NetworkImgLayer( constraints: const BoxConstraints(minHeight: 88),
src: videoItem.pic as String, height: width / StyleString.aspectRatio,
width: maxWidth, child: Row(
height: maxHeight, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints boxConstraints) {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight =
boxConstraints.maxHeight;
return Stack(
children: [
Hero(
tag: heroTag,
child: NetworkImgLayer(
src: videoItem.pic as String,
width: maxWidth,
height: maxHeight,
),
), ),
), PBadge(
PBadge( text:
text: Utils.timeFormat(videoItem.duration!), Utils.timeFormat(videoItem.duration!),
right: 6.0, right: 6.0,
bottom: 6.0, bottom: 6.0,
type: 'gray', type: 'gray',
), ),
// if (videoItem.rcmdReason != null && // if (videoItem.rcmdReason != null &&
// videoItem.rcmdReason.content != '') // videoItem.rcmdReason.content != '')
// pBadge(videoItem.rcmdReason.content, context, // pBadge(videoItem.rcmdReason.content, context,
// 6.0, 6.0, null, null), // 6.0, 6.0, null, null),
], ],
); );
}, },
),
), ),
), VideoContent(
VideoContent( videoItem: videoItem,
videoItem: videoItem, source: source,
source: source, showOwner: showOwner,
showOwner: showOwner, showView: showView,
showView: showView, showDanmaku: showDanmaku,
showDanmaku: showDanmaku, showPubdate: showPubdate,
showPubdate: showPubdate, )
) ],
], ),
), );
); },
}, ),
), ),
), ),
)),
if (source == 'normal')
Positioned(
bottom: 1,
right: 10,
child: VideoPopupMenu(
size: 30,
iconSize: 16,
videoItem: videoItem,
), ),
)); ),
]);
} }
} }
@@ -227,6 +242,7 @@ class VideoContent extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 4),
Row( Row(
children: [ children: [
if (showView) ...[ if (showView) ...[
@@ -242,18 +258,10 @@ class VideoContent extends StatelessWidget {
danmu: videoItem.stat.danmu as int, danmu: videoItem.stat.danmu as int,
), ),
const Spacer(), const Spacer(),
if (source == 'normal') if (source == 'normal') const SizedBox(width: 24),
SizedBox(
width: 24,
height: 24,
child: VideoPopupMenu(
size: 32,
iconSize: 18,
videoItem: videoItem,
),
),
], ],
), ),
const SizedBox(height: 2),
], ],
), ),
), ),

View File

@@ -128,63 +128,74 @@ class VideoCardV extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String heroTag = Utils.makeHeroTag(videoItem.id); String heroTag = Utils.makeHeroTag(videoItem.id);
return Semantics( return Stack(children: [
label: Utils.videoItemSemantics(videoItem), Semantics(
excludeSemantics: true, label: Utils.videoItemSemantics(videoItem),
child: Card( excludeSemantics: true,
elevation: 0, child: Card(
clipBehavior: Clip.hardEdge, elevation: 0,
margin: EdgeInsets.zero, clipBehavior: Clip.hardEdge,
child: GestureDetector( margin: EdgeInsets.zero,
onLongPress: () { child: GestureDetector(
if (longPress != null) { onLongPress: () {
longPress!(); if (longPress != null) {
} longPress!();
}, }
// onLongPressEnd: (details) { },
// if (longPressEnd != null) { // onLongPressEnd: (details) {
// longPressEnd!(); // if (longPressEnd != null) {
// } // longPressEnd!();
// }, // }
child: InkWell( // },
onTap: () async => onPushDetail(heroTag), child: InkWell(
child: Column( onTap: () async => onPushDetail(heroTag),
children: [ child: Column(
AspectRatio( children: [
aspectRatio: StyleString.aspectRatio, AspectRatio(
child: LayoutBuilder(builder: (context, boxConstraints) { aspectRatio: StyleString.aspectRatio,
double maxWidth = boxConstraints.maxWidth; child: LayoutBuilder(builder: (context, boxConstraints) {
double maxHeight = boxConstraints.maxHeight; double maxWidth = boxConstraints.maxWidth;
return Stack( double maxHeight = boxConstraints.maxHeight;
children: [ return Stack(
Hero( children: [
tag: heroTag, Hero(
child: NetworkImgLayer( tag: heroTag,
src: videoItem.pic, child: NetworkImgLayer(
width: maxWidth, src: videoItem.pic,
height: maxHeight, width: maxWidth,
height: maxHeight,
),
), ),
), if (videoItem.duration > 0)
if (videoItem.duration > 0) PBadge(
PBadge( bottom: 6,
bottom: 6, right: 7,
right: 7, size: 'small',
size: 'small', type: 'gray',
type: 'gray', text: Utils.timeFormat(videoItem.duration),
text: Utils.timeFormat(videoItem.duration), // semanticsLabel:
// semanticsLabel: // '时长${Utils.durationReadFormat(Utils.timeFormat(videoItem.duration))}',
// '时长${Utils.durationReadFormat(Utils.timeFormat(videoItem.duration))}', )
) ],
], );
); }),
}), ),
), VideoContent(videoItem: videoItem)
VideoContent(videoItem: videoItem) ],
], ),
), ),
), )),
)), ),
); if (videoItem.goto == 'av')
Positioned(
right: 0,
bottom: 1,
child: VideoPopupMenu(
size: 30,
iconSize: 16,
videoItem: videoItem,
)),
]);
} }
} }
@@ -203,7 +214,7 @@ class VideoContent extends StatelessWidget {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: Text(videoItem.title, child: Text(videoItem.title + "\n",
// semanticsLabel: "${videoItem.title}", // semanticsLabel: "${videoItem.title}",
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -260,23 +271,17 @@ class VideoContent extends StatelessWidget {
videoItem.owner.name, videoItem.owner.name,
// semanticsLabel: "Up主${videoItem.owner.name}", // semanticsLabel: "Up主${videoItem.owner.name}",
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.clip,
style: TextStyle( style: TextStyle(
height: 1.5,
fontSize: fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize, Theme.of(context).textTheme.labelMedium!.fontSize,
color: Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
), ),
), ),
), ),
if (videoItem.goto == 'av') ...[ if (videoItem.goto == 'av')
VideoPopupMenu( const SizedBox(width: 24)
size: 24,
iconSize: 14,
videoItem: videoItem,
),
] else ...[
const SizedBox(height: 24)
]
], ],
), ),
], ],

View File

@@ -7,5 +7,5 @@ enum DynamicsType {
extension BusinessTypeExtension on DynamicsType { extension BusinessTypeExtension on DynamicsType {
String get values => ['all', 'video', 'pgc', 'article'][index]; String get values => ['all', 'video', 'pgc', 'article'][index];
String get labels => ['全部', '视频', '', '专栏'][index]; String get labels => ['全部', '投稿', '', '专栏'][index];
} }

View File

@@ -68,12 +68,10 @@ class RecVideoItemAppModel {
? RcmdReason.fromJson(json['rcmd_reason_style']) ? RcmdReason.fromJson(json['rcmd_reason_style'])
: null; : null;
// 由于app端api并不会直接返回与owner的关注状态 // 由于app端api并不会直接返回与owner的关注状态
// 所以借用推荐原因是否为“已关注”、“新关注”判别关注状态从而与web端接口等效 // 所以借用推荐原因是否为“已关注”、“新关注”判别关注状态从而与web端接口等效
isFollowed = rcmdReason != null && String rcmdReasonContent = rcmdReason?.content ?? '';
rcmdReason!.content != null && isFollowed =
rcmdReason!.content!.contains('关注') (rcmdReasonContent == '已关注') || (rcmdReasonContent == '关注') ? 1 : 0;
? 1
: 0;
// 如果是就无需再显示推荐原因交由view统一处理即可 // 如果是就无需再显示推荐原因交由view统一处理即可
if (isFollowed == 1) { if (isFollowed == 1) {
rcmdReason = null; rcmdReason = null;

View File

@@ -1,6 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:PiliPalaX/common/constants.dart'; import 'package:PiliPalaX/common/constants.dart';
@@ -324,7 +326,8 @@ class _MemberPageState extends State<MemberPage>
Image.asset( Image.asset(
'assets/images/lv/lv${_memberController.memberInfo.value.level}.png', 'assets/images/lv/lv${_memberController.memberInfo.value.level}.png',
height: 11, height: 11,
semanticLabel: '等级${_memberController.memberInfo.value.level}', semanticLabel:
'等级${_memberController.memberInfo.value.level}',
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
if (_memberController if (_memberController
@@ -337,7 +340,8 @@ class _MemberPageState extends State<MemberPage>
_memberController.memberInfo.value.vip! _memberController.memberInfo.value.vip!
.label!['img_label_uri_hans'], .label!['img_label_uri_hans'],
height: 20, height: 20,
semanticLabel: _memberController.memberInfo.value.vip!.label!['text'], semanticLabel: _memberController
.memberInfo.value.vip!.label!['text'],
), ),
] else if (_memberController ] else if (_memberController
.memberInfo.value.vip!.status == .memberInfo.value.vip!.status ==
@@ -349,9 +353,26 @@ class _MemberPageState extends State<MemberPage>
_memberController.memberInfo.value.vip! _memberController.memberInfo.value.vip!
.label!['img_label_uri_hans_static'], .label!['img_label_uri_hans_static'],
height: 20, height: 20,
semanticLabel: _memberController.memberInfo.value.vip!.label!['text'], semanticLabel: _memberController
.memberInfo.value.vip!.label!['text'],
), ),
] ],
TextButton(
child: Text("UID ${_memberController.mid}",
style: TextStyle(
color: Theme.of(context)
.colorScheme.secondary.withOpacity(0.5),
fontSize: 12,
// fontWeight: FontWeight.w200,
)),
onPressed: () {
Clipboard.setData(
ClipboardData(
text: _memberController.mid.toString()),
);
SmartDialog.showToast(
'已复制${_memberController.mid}至剪贴板');
}),
], ],
), ),
if (_memberController if (_memberController

View File

@@ -224,7 +224,7 @@ class ProfilePanel extends StatelessWidget {
onPressed: () { onPressed: () {
Get.toNamed('/webview', parameters: { Get.toNamed('/webview', parameters: {
'url': 'https://account.bilibili.com/account/home', 'url': 'https://account.bilibili.com/account/home',
'pageTitle': '编辑资料(建议浏览器打开)', 'pageTitle': '个人中心(建议浏览器打开)',
'type': 'url' 'type': 'url'
}); });
}, },
@@ -235,7 +235,7 @@ class ProfilePanel extends StatelessWidget {
backgroundColor: backgroundColor:
Theme.of(context).colorScheme.primary, Theme.of(context).colorScheme.primary,
), ),
child: const Text('编辑资料'), child: const Text('个人中心(web)'),
) )
], ],
if (ctr.ownerMid == -1) ...[ if (ctr.ownerMid == -1) ...[

View File

@@ -49,7 +49,7 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
appBar: AppBar( appBar: AppBar(
titleSpacing: 0, titleSpacing: 0,
centerTitle: false, centerTitle: false,
title: Text('的投稿', style: Theme.of(context).textTheme.titleMedium), title: Text('Ta的投稿', style: Theme.of(context).textTheme.titleMedium),
actions: [ actions: [
Obx( Obx(
() => TextButton.icon( () => TextButton.icon(

View File

@@ -58,7 +58,7 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage> {
appBar: AppBar( appBar: AppBar(
titleSpacing: 0, titleSpacing: 0,
centerTitle: false, centerTitle: false,
title: Text('的动态', style: Theme.of(context).textTheme.titleMedium), title: Text('Ta的动态', style: Theme.of(context).textTheme.titleMedium),
), ),
body: CustomScrollView( body: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),

View File

@@ -43,7 +43,7 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
appBar: AppBar( appBar: AppBar(
titleSpacing: 0, titleSpacing: 0,
centerTitle: false, centerTitle: false,
title: Text('的专栏', style: Theme.of(context).textTheme.titleMedium), title: Text('Ta的专栏', style: Theme.of(context).textTheme.titleMedium),
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(

View File

@@ -156,7 +156,7 @@ class _MinePageState extends State<MinePage> {
), ),
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 13),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@@ -173,7 +173,7 @@ class _MinePageState extends State<MinePage> {
), ),
], ],
), ),
const SizedBox(height: 5), const SizedBox(height: 8),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@@ -190,7 +190,7 @@ class _MinePageState extends State<MinePage> {
])) ]))
], ],
), ),
const SizedBox(height: 25), const SizedBox(height: 22),
if (_mineController.userInfo.value.levelInfo != null) ...[ if (_mineController.userInfo.value.levelInfo != null) ...[
LayoutBuilder( LayoutBuilder(
builder: (context, BoxConstraints box) { builder: (context, BoxConstraints box) {
@@ -246,7 +246,7 @@ class _MinePageState extends State<MinePage> {
}, },
), ),
], ],
const SizedBox(height: 30), const SizedBox(height: 26),
Padding( Padding(
padding: const EdgeInsets.only(left: 12, right: 12), padding: const EdgeInsets.only(left: 12, right: 12),
child: LayoutBuilder( child: LayoutBuilder(

View File

@@ -279,6 +279,7 @@ class _ImagePreviewState extends State<ImagePreview>
IconButton( IconButton(
onPressed: () => Get.back(), onPressed: () => Get.back(),
icon: const Icon(Icons.close, color: Colors.white), icon: const Icon(Icons.close, color: Colors.white),
tooltip: '关闭',
), ),
], ],
)), )),

View File

@@ -75,7 +75,7 @@ class RcmdController extends GetxController {
_currentPage += 1; _currentPage += 1;
// 若videoList数量太小可能会影响翻页此时再次请求 // 若videoList数量太小可能会影响翻页此时再次请求
// 为避免请求到的数据太少时还在反复请求要求本次返回数据大于1条才触发 // 为避免请求到的数据太少时还在反复请求要求本次返回数据大于1条才触发
if (res['data'].length > 1 && videoList.length < 10) { if (res['data'].length > 1 && videoList.length < 20) {
queryRcmdFeed('onLoad'); queryRcmdFeed('onLoad');
} }
} }

View File

@@ -149,13 +149,15 @@ class _RcmdPageState extends State<RcmdPage>
return SliverGrid( return SliverGrid(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
// 行间距 // 行间距
mainAxisSpacing: StyleString.safeSpace, mainAxisSpacing: StyleString.cardSpace,
// 列间距 // 列间距
crossAxisSpacing: StyleString.safeSpace, crossAxisSpacing: StyleString.safeSpace,
// 最大宽度 // 最大宽度
maxCrossAxisExtent: Grid.maxRowWidth, maxCrossAxisExtent: Grid.maxRowWidth,
mainAxisExtent: Grid.calculateActualWidth(context, Grid.maxRowWidth, StyleString.safeSpace) / StyleString.aspectRatio+ mainAxisExtent: Grid.calculateActualWidth(
MediaQuery.textScalerOf(context).scale(96), context, Grid.maxRowWidth, StyleString.safeSpace) /
StyleString.aspectRatio +
MediaQuery.textScalerOf(context).scale(92),
), ),
delegate: SliverChildBuilderDelegate( delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {

View File

@@ -214,7 +214,7 @@ class ReplyItem extends StatelessWidget {
margin: const EdgeInsets.only(top: 10, left: 45, right: 6, bottom: 4), margin: const EdgeInsets.only(top: 10, left: 45, right: 6, bottom: 4),
child: Semantics( child: Semantics(
label: replyItem?.content?.message ?? "", label: replyItem?.content?.message ?? "",
excludeSemantics: true, // excludeSemantics: true,
child: Text.rich( child: Text.rich(
style: const TextStyle(height: 1.75), style: const TextStyle(height: 1.75),
maxLines: maxLines:
@@ -231,6 +231,7 @@ class ReplyItem extends StatelessWidget {
stack: 'normal', stack: 'normal',
type: 'line', type: 'line',
fs: 9, fs: 9,
semanticsLabel: '置顶',
), ),
), ),
buildContent(context, replyItem!, replyReply, null), buildContent(context, replyItem!, replyReply, null),
@@ -389,7 +390,9 @@ class ReplyItemRow extends StatelessWidget {
i == 0 && (extraRow == 1 || replies!.length > 1) ? 5 : 6, i == 0 && (extraRow == 1 || replies!.length > 1) ? 5 : 6,
), ),
child: Semantics( child: Semantics(
label: replies![i].member.uname + ' ' + replies![i].content.message, label: replies![i].member.uname +
' ' +
replies![i].content.message,
excludeSemantics: true, excludeSemantics: true,
child: Text.rich( child: Text.rich(
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -538,11 +541,19 @@ InlineSpan buildContent(
final RegExp pattern = RegExp(patternStr); final RegExp pattern = RegExp(patternStr);
List<String> matchedStrs = []; List<String> matchedStrs = [];
void addPlainTextSpan(str) { void addPlainTextSpan(str) {
spanChilds.add(TextSpan( spanChilds.add(WidgetSpan(
text: str, alignment: PlaceholderAlignment.middle,
recognizer: TapGestureRecognizer() child: ExcludeSemantics(
..onTap = () => child: Text(
replyReply?.call(replyItem.root == 0 ? replyItem : fReplyItem))); str,
style: const TextStyle(height: 1.75),
))));
// TextSpan(
//
// text: str,
// recognizer: TapGestureRecognizer()
// ..onTap = () => replyReply
// ?.call(replyItem.root == 0 ? replyItem : fReplyItem)))));
} }
// 分割文本并处理每个部分 // 分割文本并处理每个部分
@@ -554,13 +565,14 @@ InlineSpan buildContent(
// 处理表情 // 处理表情
final int size = content.emote[matchStr]['meta']['size']; final int size = content.emote[matchStr]['meta']['size'];
spanChilds.add(WidgetSpan( spanChilds.add(WidgetSpan(
child: NetworkImgLayer( child: ExcludeSemantics(
child: NetworkImgLayer(
src: content.emote[matchStr]['url'], src: content.emote[matchStr]['url'],
type: 'emote', type: 'emote',
width: size * 20, width: size * 20,
height: size * 20, height: size * 20,
semanticsLabel: matchStr, semanticsLabel: matchStr,
), )),
)); ));
} else if (matchStr.startsWith("@") && } else if (matchStr.startsWith("@") &&
content.atNameToMid.containsKey(matchStr.substring(1))) { content.atNameToMid.containsKey(matchStr.substring(1))) {
@@ -836,6 +848,7 @@ InlineSpan buildContent(
src: pictureItem['img_src'], src: pictureItem['img_src'],
width: box.maxWidth / 2, width: box.maxWidth / 2,
height: height, height: height,
semanticsLabel: '图片1共1张',
), ),
), ),
height > Get.size.height * 0.9 height > Get.size.height * 0.9
@@ -871,11 +884,13 @@ InlineSpan buildContent(
); );
}, },
child: NetworkImgLayer( child: NetworkImgLayer(
src: content.pictures[i]['img_src'], src: content.pictures[i]['img_src'],
width: box.maxWidth, width: box.maxWidth,
height: box.maxWidth, height: box.maxWidth,
origAspectRatio: content.pictures[i]['img_width'] / origAspectRatio: content.pictures[i]['img_width'] /
content.pictures[i]['img_height']), content.pictures[i]['img_height'],
semanticsLabel: '图片${i + 1},共$len张',
),
); );
}, },
), ),
@@ -883,31 +898,34 @@ InlineSpan buildContent(
} }
spanChilds.add( spanChilds.add(
WidgetSpan( WidgetSpan(
child: LayoutBuilder( child: Semantics(
builder: (context, BoxConstraints box) { explicitChildNodes: true,
double maxWidth = box.maxWidth; container: true,
double crossCount = len < 3 ? 2 : 3; child: LayoutBuilder(
double height = maxWidth / builder: (context, BoxConstraints box) {
crossCount * double maxWidth = box.maxWidth;
(len % crossCount == 0 double crossCount = len < 3 ? 2 : 3;
? len ~/ crossCount double height = maxWidth /
: len ~/ crossCount + 1) + crossCount *
6; (len % crossCount == 0
return Container( ? len ~/ crossCount
padding: const EdgeInsets.only(top: 6), : len ~/ crossCount + 1) +
height: height, 6;
child: GridView.count( return Container(
padding: EdgeInsets.zero, padding: const EdgeInsets.only(top: 6),
physics: const NeverScrollableScrollPhysics(), height: height,
crossAxisCount: crossCount.toInt(), child: GridView.count(
mainAxisSpacing: 4.0, padding: EdgeInsets.zero,
crossAxisSpacing: 4.0, physics: const NeverScrollableScrollPhysics(),
childAspectRatio: 1, crossAxisCount: crossCount.toInt(),
children: list, mainAxisSpacing: 4.0,
), crossAxisSpacing: 4.0,
); childAspectRatio: 1,
}, children: list,
), ),
);
},
)),
), ),
); );
} }