pathEntityListWidget method

  1. @override
Widget pathEntityListWidget(
  1. BuildContext context
)
override

List widget for path entities. 路径选择列表组件

Implementation

@override
Widget pathEntityListWidget(BuildContext context) {
  final double appBarHeight = kToolbarHeight + Screens.topSafeHeight;
  final double maxHeight = Screens.height * 0.825;
  final bool isAudio = (provider as DefaultAssetPickerProvider).requestType ==
      RequestType.audio;
  return Selector<DefaultAssetPickerProvider, bool>(
    selector: (_, DefaultAssetPickerProvider p) => p.isSwitchingPath,
    builder: (_, bool isSwitchingPath, Widget? w) =>
        AnimatedPositionedDirectional(
      duration: switchingPathDuration,
      curve: switchingPathCurve,
      top: isAppleOS
          ? !isSwitchingPath
              ? -maxHeight
              : appBarHeight
          : -(!isSwitchingPath ? maxHeight : 1.0),
      child: AnimatedOpacity(
        duration: switchingPathDuration,
        curve: switchingPathCurve,
        opacity: !isAppleOS || isSwitchingPath ? 1.0 : 0.0,
        child: Container(
          width: Screens.width,
          height: maxHeight,
          decoration: BoxDecoration(
            borderRadius: isAppleOS
                ? const BorderRadius.vertical(bottom: Radius.circular(10.0))
                : null,
            color: theme.colorScheme.background,
          ),
          child: w,
        ),
      ),
    ),
    child: Selector<DefaultAssetPickerProvider, int>(
      selector: (_, DefaultAssetPickerProvider p) => p.validPathThumbCount,
      builder: (_, int count, __) => Selector<DefaultAssetPickerProvider,
          Map<AssetPathEntity, Uint8List?>>(
        selector: (_, DefaultAssetPickerProvider p) => p.pathEntityList,
        builder: (BuildContext c, Map<AssetPathEntity, Uint8List?> list, __) {
          return ListView.separated(
            padding: const EdgeInsetsDirectional.only(top: 1.0),
            itemCount: list.length,
            itemBuilder: (_, int index) => pathEntityWidget(
              context: c,
              list: list,
              index: index,
              isAudio: isAudio,
            ),
            separatorBuilder: (BuildContext _, int __) => Container(
              margin: const EdgeInsetsDirectional.only(start: 60.0),
              height: 1.0,
              color: theme.canvasColor,
            ),
          );
        },
      ),
    ),
  );
}