mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 界面及无障碍调整
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'dart:async';
|
||||
|
||||
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:get/get.dart';
|
||||
import 'package:PiliPalaX/common/constants.dart';
|
||||
@@ -324,7 +326,8 @@ class _MemberPageState extends State<MemberPage>
|
||||
Image.asset(
|
||||
'assets/images/lv/lv${_memberController.memberInfo.value.level}.png',
|
||||
height: 11,
|
||||
semanticLabel: '等级${_memberController.memberInfo.value.level}',
|
||||
semanticLabel:
|
||||
'等级${_memberController.memberInfo.value.level}',
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
if (_memberController
|
||||
@@ -337,7 +340,8 @@ class _MemberPageState extends State<MemberPage>
|
||||
_memberController.memberInfo.value.vip!
|
||||
.label!['img_label_uri_hans'],
|
||||
height: 20,
|
||||
semanticLabel: _memberController.memberInfo.value.vip!.label!['text'],
|
||||
semanticLabel: _memberController
|
||||
.memberInfo.value.vip!.label!['text'],
|
||||
),
|
||||
] else if (_memberController
|
||||
.memberInfo.value.vip!.status ==
|
||||
@@ -349,9 +353,26 @@ class _MemberPageState extends State<MemberPage>
|
||||
_memberController.memberInfo.value.vip!
|
||||
.label!['img_label_uri_hans_static'],
|
||||
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
|
||||
|
||||
@@ -224,7 +224,7 @@ class ProfilePanel extends StatelessWidget {
|
||||
onPressed: () {
|
||||
Get.toNamed('/webview', parameters: {
|
||||
'url': 'https://account.bilibili.com/account/home',
|
||||
'pageTitle': '编辑资料(建议浏览器打开)',
|
||||
'pageTitle': '个人中心(建议浏览器打开)',
|
||||
'type': 'url'
|
||||
});
|
||||
},
|
||||
@@ -235,7 +235,7 @@ class ProfilePanel extends StatelessWidget {
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
child: const Text('编辑资料'),
|
||||
child: const Text('个人中心(web)'),
|
||||
)
|
||||
],
|
||||
if (ctr.ownerMid == -1) ...[
|
||||
|
||||
@@ -49,7 +49,7 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Text('他的投稿', style: Theme.of(context).textTheme.titleMedium),
|
||||
title: Text('Ta的投稿', style: Theme.of(context).textTheme.titleMedium),
|
||||
actions: [
|
||||
Obx(
|
||||
() => TextButton.icon(
|
||||
|
||||
@@ -58,7 +58,7 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage> {
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Text('他的动态', style: Theme.of(context).textTheme.titleMedium),
|
||||
title: Text('Ta的动态', style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
body: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
|
||||
@@ -43,7 +43,7 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Text('他的专栏', style: Theme.of(context).textTheme.titleMedium),
|
||||
title: Text('Ta的专栏', style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
|
||||
@@ -156,7 +156,7 @@ class _MinePageState extends State<MinePage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 13),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@@ -173,7 +173,7 @@ class _MinePageState extends State<MinePage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@@ -190,7 +190,7 @@ class _MinePageState extends State<MinePage> {
|
||||
]))
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
const SizedBox(height: 22),
|
||||
if (_mineController.userInfo.value.levelInfo != null) ...[
|
||||
LayoutBuilder(
|
||||
builder: (context, BoxConstraints box) {
|
||||
@@ -246,7 +246,7 @@ class _MinePageState extends State<MinePage> {
|
||||
},
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 30),
|
||||
const SizedBox(height: 26),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12, right: 12),
|
||||
child: LayoutBuilder(
|
||||
|
||||
@@ -279,6 +279,7 @@ class _ImagePreviewState extends State<ImagePreview>
|
||||
IconButton(
|
||||
onPressed: () => Get.back(),
|
||||
icon: const Icon(Icons.close, color: Colors.white),
|
||||
tooltip: '关闭',
|
||||
),
|
||||
],
|
||||
)),
|
||||
|
||||
@@ -75,7 +75,7 @@ class RcmdController extends GetxController {
|
||||
_currentPage += 1;
|
||||
// 若videoList数量太小,可能会影响翻页,此时再次请求
|
||||
// 为避免请求到的数据太少时还在反复请求,要求本次返回数据大于1条才触发
|
||||
if (res['data'].length > 1 && videoList.length < 10) {
|
||||
if (res['data'].length > 1 && videoList.length < 20) {
|
||||
queryRcmdFeed('onLoad');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,13 +149,15 @@ class _RcmdPageState extends State<RcmdPage>
|
||||
return SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
// 行间距
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
// 列间距
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
// 最大宽度
|
||||
maxCrossAxisExtent: Grid.maxRowWidth,
|
||||
mainAxisExtent: Grid.calculateActualWidth(context, Grid.maxRowWidth, StyleString.safeSpace) / StyleString.aspectRatio+
|
||||
MediaQuery.textScalerOf(context).scale(96),
|
||||
mainAxisExtent: Grid.calculateActualWidth(
|
||||
context, Grid.maxRowWidth, StyleString.safeSpace) /
|
||||
StyleString.aspectRatio +
|
||||
MediaQuery.textScalerOf(context).scale(92),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
|
||||
@@ -214,7 +214,7 @@ class ReplyItem extends StatelessWidget {
|
||||
margin: const EdgeInsets.only(top: 10, left: 45, right: 6, bottom: 4),
|
||||
child: Semantics(
|
||||
label: replyItem?.content?.message ?? "",
|
||||
excludeSemantics: true,
|
||||
// excludeSemantics: true,
|
||||
child: Text.rich(
|
||||
style: const TextStyle(height: 1.75),
|
||||
maxLines:
|
||||
@@ -231,6 +231,7 @@ class ReplyItem extends StatelessWidget {
|
||||
stack: 'normal',
|
||||
type: 'line',
|
||||
fs: 9,
|
||||
semanticsLabel: '置顶',
|
||||
),
|
||||
),
|
||||
buildContent(context, replyItem!, replyReply, null),
|
||||
@@ -389,7 +390,9 @@ class ReplyItemRow extends StatelessWidget {
|
||||
i == 0 && (extraRow == 1 || replies!.length > 1) ? 5 : 6,
|
||||
),
|
||||
child: Semantics(
|
||||
label: replies![i].member.uname + ' ' + replies![i].content.message,
|
||||
label: replies![i].member.uname +
|
||||
' ' +
|
||||
replies![i].content.message,
|
||||
excludeSemantics: true,
|
||||
child: Text.rich(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -538,11 +541,19 @@ InlineSpan buildContent(
|
||||
final RegExp pattern = RegExp(patternStr);
|
||||
List<String> matchedStrs = [];
|
||||
void addPlainTextSpan(str) {
|
||||
spanChilds.add(TextSpan(
|
||||
text: str,
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () =>
|
||||
replyReply?.call(replyItem.root == 0 ? replyItem : fReplyItem)));
|
||||
spanChilds.add(WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: ExcludeSemantics(
|
||||
child: Text(
|
||||
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'];
|
||||
spanChilds.add(WidgetSpan(
|
||||
child: NetworkImgLayer(
|
||||
child: ExcludeSemantics(
|
||||
child: NetworkImgLayer(
|
||||
src: content.emote[matchStr]['url'],
|
||||
type: 'emote',
|
||||
width: size * 20,
|
||||
height: size * 20,
|
||||
semanticsLabel: matchStr,
|
||||
),
|
||||
)),
|
||||
));
|
||||
} else if (matchStr.startsWith("@") &&
|
||||
content.atNameToMid.containsKey(matchStr.substring(1))) {
|
||||
@@ -836,6 +848,7 @@ InlineSpan buildContent(
|
||||
src: pictureItem['img_src'],
|
||||
width: box.maxWidth / 2,
|
||||
height: height,
|
||||
semanticsLabel: '图片1,共1张',
|
||||
),
|
||||
),
|
||||
height > Get.size.height * 0.9
|
||||
@@ -871,11 +884,13 @@ InlineSpan buildContent(
|
||||
);
|
||||
},
|
||||
child: NetworkImgLayer(
|
||||
src: content.pictures[i]['img_src'],
|
||||
width: box.maxWidth,
|
||||
height: box.maxWidth,
|
||||
origAspectRatio: content.pictures[i]['img_width'] /
|
||||
content.pictures[i]['img_height']),
|
||||
src: content.pictures[i]['img_src'],
|
||||
width: box.maxWidth,
|
||||
height: box.maxWidth,
|
||||
origAspectRatio: content.pictures[i]['img_width'] /
|
||||
content.pictures[i]['img_height'],
|
||||
semanticsLabel: '图片${i + 1},共$len张',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -883,31 +898,34 @@ InlineSpan buildContent(
|
||||
}
|
||||
spanChilds.add(
|
||||
WidgetSpan(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, BoxConstraints box) {
|
||||
double maxWidth = box.maxWidth;
|
||||
double crossCount = len < 3 ? 2 : 3;
|
||||
double height = maxWidth /
|
||||
crossCount *
|
||||
(len % crossCount == 0
|
||||
? len ~/ crossCount
|
||||
: len ~/ crossCount + 1) +
|
||||
6;
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
height: height,
|
||||
child: GridView.count(
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: crossCount.toInt(),
|
||||
mainAxisSpacing: 4.0,
|
||||
crossAxisSpacing: 4.0,
|
||||
childAspectRatio: 1,
|
||||
children: list,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
child: Semantics(
|
||||
explicitChildNodes: true,
|
||||
container: true,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, BoxConstraints box) {
|
||||
double maxWidth = box.maxWidth;
|
||||
double crossCount = len < 3 ? 2 : 3;
|
||||
double height = maxWidth /
|
||||
crossCount *
|
||||
(len % crossCount == 0
|
||||
? len ~/ crossCount
|
||||
: len ~/ crossCount + 1) +
|
||||
6;
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
height: height,
|
||||
child: GridView.count(
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: crossCount.toInt(),
|
||||
mainAxisSpacing: 4.0,
|
||||
crossAxisSpacing: 4.0,
|
||||
childAspectRatio: 1,
|
||||
children: list,
|
||||
),
|
||||
);
|
||||
},
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user