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: ClipRRect(
borderRadius: const BorderRadius.vertical(
bottom: Radius.circular(10),
),
child: Selector<DefaultAssetPickerProvider, bool>(
selector: (_, DefaultAssetPickerProvider p) => p.isSwitchingPath,
builder: (_, bool isSwitchingPath, Widget? w) => AnimatedAlign(
duration: switchingPathDuration,
curve: switchingPathCurve,
alignment: Alignment.bottomCenter,
heightFactor: isSwitchingPath ? 1 : 0,
child: AnimatedOpacity(
duration: switchingPathDuration,
curve: switchingPathCurve,
opacity: !isAppleOS || isSwitchingPath ? 1 : 0,
child: Container(
constraints: BoxConstraints(
maxHeight:
context.mediaQuery.size.height * (isAppleOS ? .6 : .8),
),
color: theme.colorScheme.background,
child: w,
),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ValueListenableBuilder<PermissionState>(
valueListenable: permission,
builder: (_, PermissionState ps, Widget? child) {
if (isPermissionLimited) {
return child!;
}
return const SizedBox.shrink();
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 12,
),
child: Text.rich(
TextSpan(
children: <TextSpan>[
TextSpan(
text: Constants.textDelegate.viewingLimitedAssetsTip,
),
TextSpan(
text: ' '
'${Constants.textDelegate.changeAccessibleLimitedAssets}',
style:
TextStyle(color: interactiveTextColor(context)),
recognizer: TapGestureRecognizer()
..onTap = PhotoManager.presentLimited,
),
],
),
style: context.themeData.textTheme.caption?.copyWith(
fontSize: 14,
),
),
),
),
Flexible(
child: Selector<DefaultAssetPickerProvider, int>(
selector: (_, DefaultAssetPickerProvider p) =>
p.validPathThumbCount,
builder: (_, int count, __) => Selector<
DefaultAssetPickerProvider,
Map<AssetPathEntity, Uint8List?>>(
selector: (_, DefaultAssetPickerProvider p) =>
p.pathEntityList,
builder: (_, Map<AssetPathEntity, Uint8List?> list, __) {
return ListView.separated(
padding: const EdgeInsetsDirectional.only(top: 1),
shrinkWrap: true,
itemCount: list.length,
itemBuilder: (BuildContext c, int i) =>
pathEntityWidget(
context: c,
list: list,
index: i,
isAudio: (provider as DefaultAssetPickerProvider)
.requestType ==
RequestType.audio,
),
separatorBuilder: (_, __) => Container(
margin: const EdgeInsetsDirectional.only(start: 60),
height: 1,
color: theme.canvasColor,
),
);
},
),
),
),
],
),
),
),
);
}