appleOSLayout method
Layout for Apple OS devices. 苹果系列设备的选择器布局
Implementation
@override
Widget appleOSLayout(BuildContext context) {
Widget _gridLayout(BuildContext context) {
return ValueListenableBuilder<bool>(
valueListenable: isSwitchingPath,
builder: (_, bool isSwitchingPath, __) => Semantics(
excludeSemantics: isSwitchingPath,
child: RepaintBoundary(
child: Stack(
children: <Widget>[
Positioned.fill(child: assetsGridBuilder(context)),
if (!isSingleAssetMode || isPreviewEnabled)
Positioned.fill(
top: null,
child: bottomActionBar(context),
),
],
),
),
),
);
}
Widget _layout(BuildContext context) {
return Stack(
children: <Widget>[
Positioned.fill(
child: Consumer<DefaultAssetPickerProvider>(
builder: (_, DefaultAssetPickerProvider p, __) {
final Widget child;
final bool shouldDisplayAssets =
p.hasAssetsToDisplay || shouldBuildSpecialItem;
if (shouldDisplayAssets) {
child = Stack(
children: <Widget>[
_gridLayout(context),
pathEntityListBackdrop(context),
pathEntityListWidget(context),
],
);
} else {
child = loadingIndicator(context);
}
return AnimatedSwitcher(
duration: switchingPathDuration,
child: child,
);
},
),
),
appBar(context),
],
);
}
return ValueListenableBuilder<bool>(
valueListenable: permissionOverlayDisplay,
builder: (_, bool value, Widget? child) {
if (value) {
return ExcludeSemantics(child: child);
}
return child!;
},
child: _layout(context),
);
}