permission_toggle_button 1.0.0 copy "permission_toggle_button: ^1.0.0" to clipboard
permission_toggle_button: ^1.0.0 copied to clipboard

A Flutter package for managing permissions with toggle buttons.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:permission_toggle_button/my_flutter_package.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Permission Toggle Example',
      home: Scaffold(
        appBar: AppBar(title: const Text('Permission Toggle Example')),
        body: Center(
          child: PermissionToggle(
            key: const ValueKey('permission_toggle'), // Named key parameter
            icon: Icons.location_on,
            value: true,
            title: 'Location Access',
            subTitle: 'Allow this app to access your location',
            activeColor: Colors.green,
            activeTrackColor: Colors.lightGreen,
            onChanged: (bool newValue) {
              // Handle the change
              if (newValue) {
              } else {
              }
            },
          ),
        ),
      ),
    );
  }
}
2
likes
115
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for managing permissions with toggle buttons.

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on permission_toggle_button