import 'package:flutter/material.dart'; import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/main.dart'; import 'package:project_telephony/ui/widget/plone_back_button.dart'; import 'package:project_telephony/utils/headers.dart'; import 'package:telephony/telephony.dart'; class PrivacyRightsPage extends StatefulWidget { final String name; const PrivacyRightsPage({Key? key, required this.name}) : super(key: key); @override _PrivacyRightsPageState createState() => _PrivacyRightsPageState(); } final Telephony telephony = Telephony.instance; // late final bool permissionsGranted; // String body = ""; // @override // void initState() async { // initPlatformState(); // } class _PrivacyRightsPageState extends State { @override Widget build(BuildContext context) { return Scaffold( 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 : _getRights(true), ); } // 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 initPlatformState() async { // final bool? result = await telephony.requestPhoneAndSmsPermissions; // if (result != null && result) { // telephony.listenIncomingSms( // onNewMessage: onMessage, // onBackgroundMessage: onBackgroundMessage, // listenInBackground: true); // } // if (!mounted) return; // } _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, Text('用于获取设备1', 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, ), ), ], )), ); } }