mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 动态页图片、图片预览页无障碍适配
This commit is contained in:
@@ -59,7 +59,9 @@ class _ContentState extends State<Content> {
|
|||||||
(pictureItem.height != null && pictureItem.width != null
|
(pictureItem.height != null && pictureItem.width != null
|
||||||
? pictureItem.height! / pictureItem.width!
|
? pictureItem.height! / pictureItem.width!
|
||||||
: 1);
|
: 1);
|
||||||
return GestureDetector(
|
return Semantics(
|
||||||
|
label: '图片1,共1张',
|
||||||
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
useSafeArea: false,
|
useSafeArea: false,
|
||||||
@@ -92,7 +94,7 @@ class _ContentState extends State<Content> {
|
|||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -106,7 +108,9 @@ class _ContentState extends State<Content> {
|
|||||||
LayoutBuilder(
|
LayoutBuilder(
|
||||||
builder: (context, BoxConstraints box) {
|
builder: (context, BoxConstraints box) {
|
||||||
double maxWidth = box.maxWidth.truncateToDouble();
|
double maxWidth = box.maxWidth.truncateToDouble();
|
||||||
return GestureDetector(
|
return Semantics(
|
||||||
|
label: '图片${i + 1},共$len张',
|
||||||
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
useSafeArea: false,
|
useSafeArea: false,
|
||||||
@@ -123,7 +127,7 @@ class _ContentState extends State<Content> {
|
|||||||
origAspectRatio:
|
origAspectRatio:
|
||||||
pics[i].width!.toInt() / pics[i].height!.toInt(),
|
pics[i].width!.toInt() / pics[i].height!.toInt(),
|
||||||
),
|
),
|
||||||
);
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -201,7 +205,7 @@ class _ContentState extends State<Content> {
|
|||||||
if (hasPics) ...[
|
if (hasPics) ...[
|
||||||
Text.rich(
|
Text.rich(
|
||||||
picsNodes(),
|
picsNodes(),
|
||||||
semanticsLabel: '动态图片',
|
// semanticsLabel: '动态图片',
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -135,14 +135,17 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
),
|
),
|
||||||
body: Stack(
|
body: Stack(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
Semantics(
|
||||||
|
label: '双指缩放、长按保存、左右滑动切换图片',
|
||||||
|
child: GestureDetector(
|
||||||
onLongPress: () => onOpenMenu(),
|
onLongPress: () => onOpenMenu(),
|
||||||
child: ExtendedImageGesturePageView.builder(
|
child: ExtendedImageGesturePageView.builder(
|
||||||
controller: ExtendedPageController(
|
controller: ExtendedPageController(
|
||||||
initialPage: _previewController.initialPage.value,
|
initialPage: _previewController.initialPage.value,
|
||||||
pageSpacing: 0,
|
pageSpacing: 0,
|
||||||
),
|
),
|
||||||
onPageChanged: (int index) => _previewController.onChange(index),
|
onPageChanged: (int index) =>
|
||||||
|
_previewController.onChange(index),
|
||||||
canScrollPage: (GestureDetails? gestureDetails) =>
|
canScrollPage: (GestureDetails? gestureDetails) =>
|
||||||
gestureDetails!.totalScale! <= 1.0,
|
gestureDetails!.totalScale! <= 1.0,
|
||||||
itemCount: widget.imgList!.length,
|
itemCount: widget.imgList!.length,
|
||||||
@@ -234,6 +237,7 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user