戴余标 2 years ago
parent 155d2f3fbe
commit 8c7b93df1d

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/home/home_page.dart'; import 'package:project_telephony/ui/home/home_page.dart';
import 'package:project_telephony/ui/login/login_page.dart'; import 'package:project_telephony/ui/login/login_page.dart';
@ -9,6 +10,8 @@ import 'package:project_telephony/ui/widget/image_scaffold.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart'; import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import '../../permission.dart';
class UserPage extends StatefulWidget { class UserPage extends StatefulWidget {
const UserPage({Key? key}) : super(key: key); const UserPage({Key? key}) : super(key: key);
@ -45,7 +48,8 @@ class _UserPageState extends State<UserPage> {
PloneBottom( PloneBottom(
border: false, border: false,
onTap: () { onTap: () {
Get.to(() => const HomePage()); PermissionUtils.requestAllPermission()
// Get.to(() => const HomePage());
}, },
textColor: const Color(0xFF1890FF), textColor: const Color(0xFF1890FF),
color1: const Color(0xFFEBF5FF), color1: const Color(0xFFEBF5FF),
@ -220,6 +224,19 @@ class _UserPageState extends State<UserPage> {
? Switch( ? Switch(
value: vle, value: vle,
onChanged: (value) { onChanged: (value) {
List<Permission> permissions = [
Permission.sms,
Permission.phone,
];
PermissionHelper.check(permissions,
onSuccess: () {
print('onSuccess');
}, onFailed: () {
print('onFailed');
}, onOpenSetting: () {
print('onOpenSetting');
openAppSettings();
});
setState(() { setState(() {
vle = value; vle = value;
}); });

Loading…
Cancel
Save