# defaultPermissionUI method

Widget defaultPermissionUI(

1. BuildContext context,
2. Future requestPermission(
   1. BuildContext
   )

)

A default UI widget for handling permission requests.

This widget displays a UI that prompts the user to grant a specific permission. It takes a BuildContext and a `requestPermission` function that handles the permission request logic.

- Parameters:

  - context: The build context in which the widget is built.
  - requestPermission: A function that takes a BuildContext and returns a Future that handles the permission request.

- Returns: A Widget that displays the permission request UI.

## Implementation

    Widget defaultPermissionUI(
      BuildContext context,
      Future<dynamic> Function(BuildContext) requestPermission,
    ) {
      return Scaffold(
        appBar: AppBar(
          title: const Text('Permission Required'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const Text('Camera permission is required to use this feature'),
              const SizedBox(height: 16),
              ElevatedButton(
                onPressed: () async {
                  final permissionStatus = await requestPermission(context);
                  switch (permissionStatus.toString()) {
                    case 'PermissionStatus.denied':
                      WidgetsBinding.instance.addPostFrameCallback((_) {
                        ScaffoldMessenger.of(context).showSnackBar(
                          const SnackBar(
                            content: Text('You need to grant permission to use this feature'),
                          ),
                        );
                      });
                      break;
                    case 'PermissionStatus.permanentlyDenied':
                      WidgetsBinding.instance.addPostFrameCallback((_) {
                        ScaffoldMessenger.of(context).showSnackBar(
                          const SnackBar(
                            content: Text('You need to grant permission from settings'),
                          ),
                        );
                      });
                      break;
                    default:
                      break;
                  }
                },
                child: const Text('Grant Camera Permission'),
              ),
            ],
          ),
        ),
      );
    }