mod: 无障碍语义适配

This commit is contained in:
orz12
2024-02-29 21:00:53 +08:00
parent 19117a041a
commit f8e6ec00f9
65 changed files with 683 additions and 390 deletions

View File

@@ -25,12 +25,15 @@ class _ActionPanelState extends State<ActionPanel> {
late ModuleStatModel stat;
bool isProcessing = false;
void Function()? handleState(Future Function() action) {
return isProcessing ? null : () async {
setState(() => isProcessing = true);
await action();
setState(() => isProcessing = false);
};
return isProcessing
? null
: () async {
setState(() => isProcessing = true);
await action();
setState(() => isProcessing = false);
};
}
@override
void initState() {
super.initState();
@@ -83,12 +86,13 @@ class _ActionPanelState extends State<ActionPanel> {
icon: const Icon(
FontAwesomeIcons.shareFromSquare,
size: 16,
semanticLabel: "转发",
),
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
foregroundColor: Theme.of(context).colorScheme.outline,
),
label: Text(stat.forward!.count ?? '转发'),
label: Text(stat.forward!.count ?? ''),
),
),
Expanded(
@@ -99,12 +103,13 @@ class _ActionPanelState extends State<ActionPanel> {
icon: const Icon(
FontAwesomeIcons.comment,
size: 16,
semanticLabel: "评论",
),
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
foregroundColor: Theme.of(context).colorScheme.outline,
),
label: Text(stat.comment!.count ?? '评论'),
label: Text(stat.comment!.count ?? ''),
),
),
Expanded(
@@ -117,6 +122,7 @@ class _ActionPanelState extends State<ActionPanel> {
: FontAwesomeIcons.thumbsUp,
size: 16,
color: stat.like!.status! ? primary : color,
semanticLabel: stat.like!.status! ? "已赞": "点赞",
),
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
@@ -128,7 +134,7 @@ class _ActionPanelState extends State<ActionPanel> {
return ScaleTransition(scale: animation, child: child);
},
child: Text(
stat.like!.count ?? '点赞',
stat.like!.count ?? '',
key: ValueKey<String>(stat.like!.count ?? '点赞'),
style: TextStyle(
color: stat.like!.status! ? primary : color,

View File

@@ -48,6 +48,7 @@ class AuthorPanel extends StatelessWidget {
children: [
Text(
item.modules.moduleAuthor.name,
// semanticsLabel: "Up主${item.modules.moduleAuthor.name}",
style: TextStyle(
color: item.modules.moduleAuthor!.vip != null &&
item.modules.moduleAuthor!.vip['status'] > 0
@@ -81,6 +82,7 @@ class AuthorPanel extends StatelessWidget {
width: 32,
height: 32,
child: IconButton(
tooltip: '更多',
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),

View File

@@ -87,6 +87,7 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
width: width,
height: width / StyleString.aspectRatio,
src: content.cover,
semanticsLabel: content.title,
),
),
if (content.badge != null && type == 'pgc')
@@ -133,7 +134,7 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
const SizedBox(width: 10),
Text(content.stat.play + '次围观'),
const SizedBox(width: 10),
Text(content.stat.danmaku + '条弹幕')
Text(content.stat.danmu + '条弹幕')
],
),
),