pushToViewerWithDelegate<A, P> static method
Future<List<A> ?>
pushToViewerWithDelegate<A, P>(
- BuildContext context, {
- required AssetPickerViewerBuilderDelegate<
A, P> delegate, - PermissionRequestOption permissionRequestOption = const PermissionRequestOption(),
Call the viewer with provided delegate and provider.
通过指定的 delegate
调用查看器
Implementation
static Future<List<A>?> pushToViewerWithDelegate<A, P>(
BuildContext context, {
required AssetPickerViewerBuilderDelegate<A, P> delegate,
PermissionRequestOption permissionRequestOption =
const PermissionRequestOption(),
}) async {
await AssetPicker.permissionCheck(requestOption: permissionRequestOption);
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.maybeOf(context)?.push<List<A>>(pageRoute);
return result;
}