pathEntityListWidget method
List widget for path entities. 路径选择列表组件
Implementation
@override
Widget pathEntityListWidget(BuildContext context) {
return Positioned.fill(
top: isAppleOS ? context.topPadding + kToolbarHeight : 0,
bottom: null,
child: ValueListenableBuilder<bool>(
valueListenable: isSwitchingPath,
builder: (_, bool isSwitchingPath, Widget? child) => Semantics(
hidden: isSwitchingPath ? null : true,
child: AnimatedAlign(
duration: switchingPathDuration,
curve: switchingPathCurve,
alignment: Alignment.bottomCenter,
heightFactor: isSwitchingPath ? 1 : 0,
child: AnimatedOpacity(
duration: switchingPathDuration,
curve: switchingPathCurve,
opacity: !isAppleOS || isSwitchingPath ? 1 : 0,
child: ClipRRect(
borderRadius: const BorderRadius.vertical(
bottom: Radius.circular(10),
),
child: Container(
constraints: BoxConstraints(
maxHeight:
context.mediaQuery.size.height * (isAppleOS ? .6 : .8),
),
color: theme.colorScheme.background,
child: child,
),
),
),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ValueListenableBuilder<PermissionState>(
valueListenable: permission,
builder: (_, PermissionState ps, Widget? child) => Semantics(
label: '${semanticsTextDelegate.viewingLimitedAssetsTip}, '
'${semanticsTextDelegate.changeAccessibleLimitedAssets}',
button: true,
onTap: PhotoManager.presentLimited,
hidden: !isPermissionLimited,
focusable: isPermissionLimited,
excludeSemantics: true,
child: isPermissionLimited ? child : const SizedBox.shrink(),
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 12,
),
child: Text.rich(
TextSpan(
children: <TextSpan>[
TextSpan(
text: textDelegate.viewingLimitedAssetsTip,
),
TextSpan(
text: ' '
'${textDelegate.changeAccessibleLimitedAssets}',
style: TextStyle(color: interactiveTextColor(context)),
recognizer: TapGestureRecognizer()
..onTap = PhotoManager.presentLimited,
),
],
),
style: context.themeData.textTheme.bodySmall?.copyWith(
fontSize: 14,
),
),
),
),
Flexible(
child: Selector<DefaultAssetPickerProvider,
List<PathWrapper<AssetPathEntity>>>(
selector: (_, DefaultAssetPickerProvider p) => p.paths,
builder: (_, List<PathWrapper<AssetPathEntity>> paths, __) {
final List<PathWrapper<AssetPathEntity>> filtered = paths
.where(
(PathWrapper<AssetPathEntity> p) => p.assetCount != 0,
)
.toList();
return ListView.separated(
padding: const EdgeInsetsDirectional.only(top: 1),
shrinkWrap: true,
itemCount: filtered.length,
itemBuilder: (BuildContext c, int i) => pathEntityWidget(
context: c,
list: filtered,
index: i,
),
separatorBuilder: (_, __) => Container(
margin: const EdgeInsetsDirectional.only(start: 60),
height: 1,
color: theme.canvasColor,
),
);
},
),
),
],
),
),
);
}