@@ -209,6 +209,9 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
209
209
210
210
AssetPickerTextDelegate get textDelegate => Singleton .textDelegate;
211
211
212
+ AssetPickerTextDelegate get semanticsTextDelegate =>
213
+ Singleton .textDelegate.semanticsTextDelegate;
214
+
212
215
/// Keep a `initState` method to sync with [State] .
213
216
/// 保留一个 `initState` 方法与 [State] 同步。
214
217
@mustCallSuper
@@ -394,6 +397,7 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
394
397
fontSize: 13 ,
395
398
fontWeight: FontWeight .w500,
396
399
),
400
+ semanticsLabel: semanticsTextDelegate.gifIndicator,
397
401
strutStyle: const StrutStyle (forceStrutHeight: true , height: 1 ),
398
402
),
399
403
),
@@ -430,6 +434,7 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
430
434
return ScaleText (
431
435
textDelegate.emptyList,
432
436
maxScaleFactor: 1.5 ,
437
+ semanticsLabel: semanticsTextDelegate.emptyList,
433
438
);
434
439
}
435
440
return w! ;
@@ -450,6 +455,7 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
450
455
textDelegate.loadFailed,
451
456
textAlign: TextAlign .center,
452
457
style: const TextStyle (fontSize: 18 ),
458
+ semanticsLabel: semanticsTextDelegate.loadFailed,
453
459
),
454
460
);
455
461
}
@@ -496,6 +502,7 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
496
502
style: context.themeData.textTheme.caption? .copyWith (
497
503
fontSize: 14 ,
498
504
),
505
+ semanticsLabel: semanticsTextDelegate.accessAllTip,
499
506
),
500
507
),
501
508
Icon (
@@ -580,12 +587,14 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
580
587
textDelegate.unableToAccessAll,
581
588
style: const TextStyle (fontSize: 22 ),
582
589
textAlign: TextAlign .center,
590
+ semanticsLabel: semanticsTextDelegate.unableToAccessAll,
583
591
),
584
592
SizedBox (height: size.height / 30 ),
585
593
ScaleText (
586
594
textDelegate.accessAllTip,
587
595
style: const TextStyle (fontSize: 18 ),
588
596
textAlign: TextAlign .center,
597
+ semanticsLabel: semanticsTextDelegate.accessAllTip,
589
598
),
590
599
],
591
600
),
@@ -603,6 +612,7 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
603
612
child: ScaleText (
604
613
textDelegate.goToSystemSettings,
605
614
style: const TextStyle (fontSize: 17 ),
615
+ semanticsLabel: semanticsTextDelegate.goToSystemSettings,
606
616
),
607
617
onPressed: PhotoManager .openSetting,
608
618
materialTapTargetSize: MaterialTapTargetSize .shrinkWrap,
@@ -613,6 +623,7 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
613
623
child: ScaleText (
614
624
textDelegate.accessLimitedAssets,
615
625
style: TextStyle (color: interactiveTextColor (context)),
626
+ semanticsLabel: semanticsTextDelegate.accessLimitedAssets,
616
627
),
617
628
);
618
629
@@ -887,7 +898,7 @@ class DefaultAssetPickerBuilderDelegate
887
898
backgroundColor: theme.appBarTheme.backgroundColor,
888
899
centerTitle: isAppleOS,
889
900
title: Semantics (
890
- onTapHint: textDelegate .sActionSwitchPathLabel,
901
+ onTapHint: semanticsTextDelegate .sActionSwitchPathLabel,
891
902
child: pathEntitySelector (context),
892
903
),
893
904
leading: backButton (context),
@@ -1285,9 +1296,10 @@ class DefaultAssetPickerBuilderDelegate
1285
1296
String hint = '' ;
1286
1297
if (asset.type == AssetType .audio ||
1287
1298
asset.type == AssetType .video) {
1288
- hint += '${textDelegate .sNameDurationLabel }: ' ;
1289
- hint +=
1290
- textDelegate.durationIndicatorBuilder (asset.videoDuration);
1299
+ hint += '${semanticsTextDelegate .sNameDurationLabel }: ' ;
1300
+ hint += semanticsTextDelegate.durationIndicatorBuilder (
1301
+ asset.videoDuration,
1302
+ );
1291
1303
}
1292
1304
if (asset.title? .isNotEmpty == true ) {
1293
1305
hint += ', ${asset .title }' ;
@@ -1297,19 +1309,19 @@ class DefaultAssetPickerBuilderDelegate
1297
1309
enabled: ! isBanned,
1298
1310
excludeSemantics: true ,
1299
1311
focusable: ! isSwitchingPath,
1300
- label: '${textDelegate .semanticTypeLabel (asset .type )}'
1312
+ label: '${semanticsTextDelegate .semanticTypeLabel (asset .type )}'
1301
1313
'${semanticIndex (index )}, '
1302
1314
'${asset .createDateTime .toString ().replaceAll ('.000' , '' )}' ,
1303
1315
hidden: isSwitchingPath,
1304
1316
hint: hint,
1305
1317
image: asset.type == AssetType .image ||
1306
1318
asset.type == AssetType .video,
1307
1319
onTap: () => selectAsset (context, asset, isSelected),
1308
- onTapHint: textDelegate .sActionSelectHint,
1320
+ onTapHint: semanticsTextDelegate .sActionSelectHint,
1309
1321
onLongPress: isPreviewEnabled
1310
1322
? () => _pushAssetToViewer (context, index, asset)
1311
1323
: null ,
1312
- onLongPressHint: textDelegate .sActionPreviewHint,
1324
+ onLongPressHint: semanticsTextDelegate .sActionPreviewHint,
1313
1325
selected: isSelected,
1314
1326
sortKey: OrdinalSortKey (
1315
1327
semanticIndex (index).toDouble (),
@@ -1382,9 +1394,6 @@ class DefaultAssetPickerBuilderDelegate
1382
1394
1383
1395
@override
1384
1396
Widget audioIndicator (BuildContext context, AssetEntity asset) {
1385
- final String durationText = textDelegate.durationIndicatorBuilder (
1386
- Duration (seconds: asset.duration),
1387
- );
1388
1397
return Container (
1389
1398
width: double .maxFinite,
1390
1399
alignment: AlignmentDirectional .bottomStart,
@@ -1399,10 +1408,14 @@ class DefaultAssetPickerBuilderDelegate
1399
1408
child: Padding (
1400
1409
padding: const EdgeInsetsDirectional .only (start: 4 ),
1401
1410
child: ScaleText (
1402
- durationText,
1403
- semanticsLabel : '${ textDelegate . sNameDurationLabel }: '
1404
- '$ durationText ' ,
1411
+ textDelegate. durationIndicatorBuilder (
1412
+ Duration (seconds : asset.duration),
1413
+ ) ,
1405
1414
style: const TextStyle (fontSize: 16 ),
1415
+ semanticsLabel: '${semanticsTextDelegate .sNameDurationLabel }: '
1416
+ '${semanticsTextDelegate .durationIndicatorBuilder (
1417
+ Duration (seconds : asset .duration ),
1418
+ )}' ,
1406
1419
),
1407
1420
),
1408
1421
);
@@ -1470,6 +1483,10 @@ class DefaultAssetPickerBuilderDelegate
1470
1483
fontSize: 17 ,
1471
1484
fontWeight: FontWeight .normal,
1472
1485
),
1486
+ semanticsLabel: p.isSelectedNotEmpty && ! isSingleAssetMode
1487
+ ? '${semanticsTextDelegate .confirm }'
1488
+ ' (${p .selectedAssets .length }/${p .maxAssets })'
1489
+ : semanticsTextDelegate.confirm,
1473
1490
),
1474
1491
onPressed: p.isSelectedNotEmpty
1475
1492
? () => Navigator .of (context).maybePop (p.selectedAssets)
@@ -1525,6 +1542,7 @@ class DefaultAssetPickerBuilderDelegate
1525
1542
return ScaleText (
1526
1543
textDelegate.emptyList,
1527
1544
maxScaleFactor: 1.5 ,
1545
+ semanticsLabel: semanticsTextDelegate.emptyList,
1528
1546
);
1529
1547
}
1530
1548
return PlatformProgressIndicator (
@@ -1601,8 +1619,8 @@ class DefaultAssetPickerBuilderDelegate
1601
1619
ValueListenableBuilder <PermissionState >(
1602
1620
valueListenable: permission,
1603
1621
builder: (_, PermissionState ps, Widget ? child) => Semantics (
1604
- label: '${textDelegate .viewingLimitedAssetsTip }, '
1605
- '${textDelegate .changeAccessibleLimitedAssets }' ,
1622
+ label: '${semanticsTextDelegate .viewingLimitedAssetsTip }, '
1623
+ '${semanticsTextDelegate .changeAccessibleLimitedAssets }' ,
1606
1624
button: true ,
1607
1625
onTap: PhotoManager .presentLimited,
1608
1626
hidden: ! isPermissionLimited,
@@ -1700,6 +1718,9 @@ class DefaultAssetPickerBuilderDelegate
1700
1718
maxLines: 1 ,
1701
1719
overflow: TextOverflow .ellipsis,
1702
1720
maxScaleFactor: 1.2 ,
1721
+ semanticsLabel: isPermissionLimited && p.isAll
1722
+ ? semanticsTextDelegate.accessiblePathName
1723
+ : p.name,
1703
1724
),
1704
1725
),
1705
1726
w! ,
@@ -1765,20 +1786,23 @@ class DefaultAssetPickerBuilderDelegate
1765
1786
return ColoredBox (color: theme.colorScheme.primary.withOpacity (0.12 ));
1766
1787
}
1767
1788
1768
- final String semanticsName = isPermissionLimited && pathEntity.isAll
1789
+ final String name = isPermissionLimited && pathEntity.isAll
1769
1790
? textDelegate.accessiblePathName
1770
1791
: pathEntity.name;
1792
+ final String semanticsName = isPermissionLimited && pathEntity.isAll
1793
+ ? semanticsTextDelegate.accessiblePathName
1794
+ : pathEntity.name;
1771
1795
final String semanticsCount = '${pathEntity .assetCount }' ;
1772
1796
return Selector <DefaultAssetPickerProvider , AssetPathEntity ?>(
1773
1797
selector: (_, DefaultAssetPickerProvider p) => p.currentPath,
1774
1798
builder: (_, AssetPathEntity ? currentPathEntity, __) {
1775
1799
final bool isSelected = currentPathEntity == pathEntity;
1776
1800
return Semantics (
1777
1801
label: '$semanticsName , '
1778
- '${textDelegate .sUnitAssetCountLabel }: '
1802
+ '${semanticsTextDelegate .sUnitAssetCountLabel }: '
1779
1803
'$semanticsCount ' ,
1780
1804
selected: isSelected,
1781
- onTapHint: textDelegate .sActionSwitchPathLabel,
1805
+ onTapHint: semanticsTextDelegate .sActionSwitchPathLabel,
1782
1806
button: false ,
1783
1807
child: Material (
1784
1808
type: MaterialType .transparency,
@@ -1814,7 +1838,7 @@ class DefaultAssetPickerBuilderDelegate
1814
1838
end: 10 ,
1815
1839
),
1816
1840
child: ScaleText (
1817
- semanticsName ,
1841
+ name ,
1818
1842
style: const TextStyle (fontSize: 17 ),
1819
1843
maxLines: 1 ,
1820
1844
overflow: TextOverflow .ellipsis,
@@ -1887,7 +1911,7 @@ class DefaultAssetPickerBuilderDelegate
1887
1911
enabled: p.isSelectedNotEmpty,
1888
1912
focusable: ! isSwitchingPath,
1889
1913
hidden: isSwitchingPath,
1890
- onTapHint: textDelegate .sActionPreviewHint,
1914
+ onTapHint: semanticsTextDelegate .sActionPreviewHint,
1891
1915
child: child,
1892
1916
),
1893
1917
);
@@ -1910,6 +1934,8 @@ class DefaultAssetPickerBuilderDelegate
1910
1934
fontSize: 17 ,
1911
1935
),
1912
1936
maxScaleFactor: 1.2 ,
1937
+ semanticsLabel: '${semanticsTextDelegate .preview }'
1938
+ '${p .isSelectedNotEmpty ? ' (${p .selectedAssets .length })' : '' }' ,
1913
1939
),
1914
1940
),
1915
1941
),
@@ -2071,6 +2097,10 @@ class DefaultAssetPickerBuilderDelegate
2071
2097
),
2072
2098
maxLines: 1 ,
2073
2099
maxScaleFactor: 1.2 ,
2100
+ semanticsLabel:
2101
+ semanticsTextDelegate.durationIndicatorBuilder (
2102
+ Duration (seconds: asset.duration),
2103
+ ),
2074
2104
),
2075
2105
),
2076
2106
),
0 commit comments