permission_guard

Last updated:

0 purchases

permission_guard Image
permission_guard Images
Add to Cart

Description:

permission guard

permission_guard #
UI wrapper around permission_handler package that makes handling permission states easy.
Setup #
Before requesting/checking any permissions, you need to setup each platform individually.
Instructions: see setup section of permission_handler.
Preview #



Widget
Dialog









Example usage #
How to use #
Widget
...
PermissionGuard(
permission: Permission.camera,
child: _PermissionGrantedBody(),
),
...
copied to clipboard
Dialog
...
onPressed: () async {
final status = await Permission.photos.requestGuarded(context);
debugPrint('$status');
},
...
copied to clipboard
Customizations
Both PermissionGuard widget & requestGuarded method accepts
PermissionGuardOptions that allows customization of almost every element
PermissionGuardOptions({
// Useful to customize the behavior of the guardian.
bool requestOnInit,
bool skipInitialChange,
List<PermissionStatus> validStatuses,
// Useful to customize loader appearance & behavior.
bool displayLoader,
Widget loader,
// Useful to override the default dimensions.
EdgeInsets? padding,
double? iconSpacing,
double? titleSpacing,
double? descriptionSpacing,
// Useful to override default icon.
Widget? icon,
// Useful to override default strings with translated ones based on status.
String Function(PermissionStatus status)? title,
String Function(PermissionStatus status)? description,
String Function(PermissionStatus status)? action,
// Useful to provide custom widgets based on status.
Widget Function(PermissionStatus status)? titleBuilder,
Widget Function(PermissionStatus status)? descriptionBuilder,
// (Provides action `call` method so it can be used in a custom widget)
Widget Function(PermissionStatus status, VoidCallback call)? actionBuilder,
});
copied to clipboard
Full example #
Source code
An example showing how to set up and use permission_guard package.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.