Skip to content

Commit 3013f86

Browse files
committed
💄 Sync styles
1 parent b702fd6 commit 3013f86

File tree

2 files changed

+50
-27
lines changed

2 files changed

+50
-27
lines changed

example/lib/customs/pickers/directory_file_asset_picker.dart

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -506,15 +506,11 @@ class FileAssetPickerBuilder
506506
PreferredSizeWidget appBar(BuildContext context) {
507507
final AppBar appBar = AppBar(
508508
backgroundColor: theme.appBarTheme.backgroundColor,
509-
centerTitle: isAppleOS(context),
510-
title: pathEntitySelector(context),
509+
title: Semantics(
510+
onTapHint: semanticsTextDelegate.sActionSwitchPathLabel,
511+
child: pathEntitySelector(context),
512+
),
511513
leading: backButton(context),
512-
actions: !isAppleOS(context)
513-
? <Widget>[
514-
confirmButton(context),
515-
const SizedBox(width: 14.0),
516-
]
517-
: null,
518514
);
519515
appBarPreferredSize ??= appBar.preferredSize;
520516
return appBar;
@@ -1386,24 +1382,51 @@ class FileAssetPickerViewerBuilderDelegate
13861382
color: themeData.canvasColor.withOpacity(0.85),
13871383
child: Row(
13881384
children: <Widget>[
1389-
const BackButton(),
1390-
if (!isAppleOS(context))
1391-
StreamBuilder<int>(
1392-
initialData: currentIndex,
1393-
stream: pageStreamController.stream,
1394-
builder: (BuildContext _, AsyncSnapshot<int> snapshot) {
1395-
return Text(
1396-
'${snapshot.data! + 1}/${previewAssets.length}',
1397-
style: const TextStyle(
1398-
fontSize: 18.0,
1399-
fontWeight: FontWeight.bold,
1400-
),
1401-
);
1402-
},
1385+
Expanded(
1386+
child: Align(
1387+
alignment: AlignmentDirectional.centerStart,
1388+
child: Semantics(
1389+
sortKey: ordinalSortKey(0),
1390+
child: IconButton(
1391+
icon: const Icon(Icons.close),
1392+
tooltip: MaterialLocalizations.of(
1393+
context,
1394+
).backButtonTooltip,
1395+
onPressed: Navigator.of(context).maybePop,
1396+
),
1397+
),
1398+
),
1399+
),
1400+
Expanded(
1401+
child: Center(
1402+
child: StreamBuilder<int>(
1403+
initialData: currentIndex,
1404+
stream: pageStreamController.stream,
1405+
builder: (BuildContext _, AsyncSnapshot<int> snapshot) {
1406+
return Text(
1407+
'${snapshot.requireData + 1}/${previewAssets.length}',
1408+
style: const TextStyle(
1409+
fontSize: 18.0,
1410+
fontWeight: FontWeight.bold,
1411+
),
1412+
);
1413+
},
1414+
),
14031415
),
1404-
const Spacer(),
1405-
if (isAppleOS(context) && provider != null) selectButton(context),
1406-
if (!isAppleOS(context) && provider != null) confirmButton(context),
1416+
),
1417+
if (provider != null)
1418+
Expanded(
1419+
child: Container(
1420+
alignment: AlignmentDirectional.centerEnd,
1421+
padding: const EdgeInsetsDirectional.only(end: 14),
1422+
child: Semantics(
1423+
sortKey: ordinalSortKey(0.2),
1424+
child: selectButton(context),
1425+
),
1426+
),
1427+
)
1428+
else
1429+
const Spacer(),
14071430
],
14081431
),
14091432
),

lib/src/delegates/asset_picker_viewer_builder_delegate.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ class DefaultAssetPickerViewerBuilderDelegate
725725
),
726726
),
727727
),
728-
if (!isAppleOS(context) && specialPickerType == null)
728+
if (specialPickerType == null)
729729
Expanded(
730730
child: Center(
731731
child: Semantics(
@@ -734,7 +734,7 @@ class DefaultAssetPickerViewerBuilderDelegate
734734
initialData: currentIndex,
735735
stream: pageStreamController.stream,
736736
builder: (_, AsyncSnapshot<int> snapshot) => ScaleText(
737-
'${snapshot.data! + 1}/${previewAssets.length}',
737+
'${snapshot.requireData + 1}/${previewAssets.length}',
738738
style: const TextStyle(
739739
fontSize: 17,
740740
fontWeight: FontWeight.w500,

0 commit comments

Comments
 (0)