You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.0 KiB
67 lines
2.0 KiB
import 'package:flutter/material.dart';
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
class PermissionGroup {
|
|
final String titleKey;
|
|
final IconData icon;
|
|
final List<Permission> permissions;
|
|
|
|
const PermissionGroup({
|
|
required this.titleKey,
|
|
required this.icon,
|
|
required this.permissions,
|
|
});
|
|
|
|
static List<PermissionGroup> getPlatformGroups() {
|
|
return [
|
|
// 通讯权限组 - 仅Android(包含联系人权限)
|
|
const PermissionGroup(
|
|
titleKey: 'communicationPermissions',
|
|
icon: Icons.phone_android,
|
|
permissions: [Permission.phone, Permission.sms, Permission.contacts],
|
|
),
|
|
// 蓝牙权限组 - Android 12+
|
|
const PermissionGroup(
|
|
titleKey: 'bluetoothPermissions',
|
|
icon: Icons.bluetooth,
|
|
permissions: [Permission.bluetoothScan, Permission.bluetoothConnect],
|
|
),
|
|
// 通知权限组
|
|
const PermissionGroup(
|
|
titleKey: 'notificationPermissions',
|
|
icon: Icons.notifications,
|
|
permissions: [Permission.notification],
|
|
),
|
|
// 闹钟权限组 - 仅Android
|
|
const PermissionGroup(
|
|
titleKey: 'alarmPermissions',
|
|
icon: Icons.alarm,
|
|
permissions: [Permission.scheduleExactAlarm],
|
|
),
|
|
// 日历权限组
|
|
const PermissionGroup(
|
|
titleKey: 'calendarPermissions',
|
|
icon: Icons.calendar_today,
|
|
permissions: [Permission.calendarFullAccess],
|
|
),
|
|
// 位置权限组
|
|
const PermissionGroup(
|
|
titleKey: 'locationPermissions',
|
|
icon: Icons.location_on,
|
|
permissions: [Permission.location],
|
|
),
|
|
// 存储权限组
|
|
const PermissionGroup(
|
|
titleKey: 'storagePermissions',
|
|
icon: Icons.storage,
|
|
permissions: [Permission.storage],
|
|
),
|
|
// 麦克风权限组
|
|
const PermissionGroup(
|
|
titleKey: 'microphonePermissions',
|
|
icon: Icons.mic,
|
|
permissions: [Permission.microphone],
|
|
),
|
|
];
|
|
}
|
|
}
|
|
|