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.
project_telephony/lib/ui/user/privacy_rights_page.dart

159 lines
4.5 KiB

2 years ago
import 'package:flutter/material.dart';
2 years ago
import 'package:permission_handler/permission_handler.dart';
2 years ago
import 'package:project_telephony/base/base_style.dart';
2 years ago
// import 'package:project_telephony/main.dart';
2 years ago
import 'package:project_telephony/ui/widget/plone_back_button.dart';
2 years ago
import 'package:project_telephony/ui/widget/plone_bottom.dart';
2 years ago
import 'package:project_telephony/utils/headers.dart';
2 years ago
// import 'package:telephony/telephony.dart';
2 years ago
class PrivacyRightsPage extends StatefulWidget {
final String name;
const PrivacyRightsPage({Key? key, required this.name}) : super(key: key);
@override
_PrivacyRightsPageState createState() => _PrivacyRightsPageState();
}
2 years ago
// final Telephony telephony = Telephony.instance;
2 years ago
// late final bool permissionsGranted;
// String body = "";
// @override
2 years ago
// initState() async {
// // initPlatformState();
2 years ago
// }
2 years ago
bool? pd;
2 years ago
2 years ago
class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
2 years ago
@override
void initState() {
Future.delayed(const Duration(seconds: 2), () async {
await _refresh();
});
setState(() {});
super.initState();
}
_refresh() async {
var status = await Permission.camera.status;
pd = status.isDenied;
setState(() {});
}
2 years ago
@override
Widget build(BuildContext context) {
return Scaffold(
2 years ago
appBar: AppBar(
elevation: 0,
title: Text(
widget.name,
style: TextStyle(
fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
titleSpacing: 162.w,
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor),
backgroundColor: Colors.white,
body: widget.name == "隐私政策"
? null
: Column(
children: [
2 years ago
_getRights(pd!),
2 years ago
],
));
2 years ago
}
2 years ago
// onMessage(SmsMessage message) async {
// setState(() {
// body = message.body ?? "error reading message body.";
// print(body);
// });
// }
//
// onSendStatus(SendStatus status) {
// setState(() {
// body = status == SendStatus.SENT ? "sent" : "delivered";
// });
// }
//
// Future<void> initPlatformState() async {
// final bool? result = await telephony.requestPhoneAndSmsPermissions;
// if (result != null && result) {
// telephony.listenIncomingSms(
// onNewMessage: onMessage,
// onBackgroundMessage: onBackgroundMessage,
// listenInBackground: true);
// }
// if (!mounted) return;
// }
2 years ago
_getRights(bool pd) {
return GestureDetector(
onTap: () {},
child: Container(
height: 144.w,
width: 750.w,
padding: EdgeInsets.symmetric(horizontal: 64.w, vertical: 17.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'获取设备来电',
style: TextStyle(
fontSize: 32.sp,
color: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
16.hb,
2 years ago
Text('用于获取设备',
2 years ago
style: TextStyle(
fontSize: 28.sp, color: BaseStyle.color999999)),
],
),
269.wb,
Text(pd ? "未允许" : "已允许",
style: TextStyle(
fontSize: 24.sp,
color: pd
? const Color(0xFFFF4D4D)
: BaseStyle.color999999)),
SizedBox(
width: 48.w,
height: 48.w,
child: const Icon(
Icons.keyboard_arrow_right,
),
),
],
)),
);
}
2 years ago
_getA() {
return PloneBottom(
onTap: () async {
var status = await Permission.camera.status;
if (status.isDenied) {
// openAppSettings();//返回后台
// print(status.isDenied);
// print("已允许");
} else {
print("未允许");
}
},
);
// var status = await Permission.camera.status;
// if (status.isDenied) {
// return Text("已允许");
// } else {
// return Text("未允许");
// }
}
2 years ago
}