pushToViewerWithDelegate<A, P> static method

Future<List<A>?> pushToViewerWithDelegate<A, P>(
  1. BuildContext context, {
  2. required AssetPickerViewerBuilderDelegate<A, P> delegate,
})

Call the viewer with provided delegate and provider. 通过指定的 delegate 调用查看器

Implementation

static Future<List<A>?> pushToViewerWithDelegate<A, P>(
  BuildContext context, {
  required AssetPickerViewerBuilderDelegate<A, P> delegate,
}) async {
  await AssetPicker.permissionCheck();
  final Widget viewer = AssetPickerViewer<A, P>(builder: delegate);
  final PageRouteBuilder<List<A>> pageRoute = PageRouteBuilder<List<A>>(
    pageBuilder: (_, __, ___) => viewer,
    transitionsBuilder: (_, Animation<double> animation, __, Widget child) {
      return FadeTransition(opacity: animation, child: child);
    },
  );
  final List<A>? result = await Navigator.of(context).push<List<A>>(
    pageRoute,
  );
  return result;
}