|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_background_service/flutter_background_service.dart';
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
import 'package:project_telephony/ui/home/content_connect_page.dart';
|
|
|
|
|
import 'package:project_telephony/ui/home/content_refuse_page.dart';
|
|
|
|
@ -9,6 +11,7 @@ import 'package:project_telephony/ui/user/privacy_rights_page.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
|
|
|
|
|
|
import '../tab_navigator.dart';
|
|
|
|
|
import '../user/privacy_rights_page.dart';
|
|
|
|
|
|
|
|
|
|
class HomePage extends StatefulWidget {
|
|
|
|
@ -20,7 +23,8 @@ class HomePage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
bool sms = false;
|
|
|
|
|
bool plone = false;
|
|
|
|
|
|
|
|
|
|
bool kg=false;
|
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
|
@override
|
|
|
|
|
class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
|
|
|
|
|
@override
|
|
|
|
@ -43,6 +47,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
|
|
|
|
|
sms = await Permission.sms.request().isGranted;
|
|
|
|
|
plone = await Permission.phone.request().isGranted;
|
|
|
|
|
callLog = await Permission.callLog.request().isGranted;
|
|
|
|
|
kg = await service.isRunning();
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -90,16 +95,38 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// String _text(){
|
|
|
|
|
// if(!(sms && plone && callLog && kg)){
|
|
|
|
|
// if(!(sms && plone && callLog )){
|
|
|
|
|
// return "";
|
|
|
|
|
// // return "必须权限没有授予,本APP无法正常使用";
|
|
|
|
|
// }if(!kg){
|
|
|
|
|
// return "功能开关未开启";
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// return "";
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
_warning() {
|
|
|
|
|
return Offstage(
|
|
|
|
|
offstage: (sms && plone && callLog),
|
|
|
|
|
offstage: (sms && plone && callLog && kg),
|
|
|
|
|
child: GestureDetector(
|
|
|
|
|
onTap: () {
|
|
|
|
|
if(!(sms && plone && callLog && kg)){
|
|
|
|
|
if(!kg){
|
|
|
|
|
BotToast.showText(text: '功能开关未开启');
|
|
|
|
|
Get.to(()=>const TabNavigator(index: 1,));
|
|
|
|
|
}else{
|
|
|
|
|
Get.to(()=>const PrivacyRightsPage(name: "权限说明"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// print();
|
|
|
|
|
openAppSettings();
|
|
|
|
|
// openAppSettings();
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 64.w),
|
|
|
|
|
child:
|
|
|
|
|
Container(
|
|
|
|
|
// width: 622.w,
|
|
|
|
|
margin: EdgeInsets.only(left:!kg? 200.w:64.w,right: 64.w),
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
|
|
|
|
|
height: 88.w,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
@ -115,7 +142,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
|
|
|
|
|
),
|
|
|
|
|
16.wb,
|
|
|
|
|
Text(
|
|
|
|
|
"必须权限没有授予,本APP无法正常使用",
|
|
|
|
|
!kg ? "功能开关未开启":"必须权限没有授予,本APP无法正常使用",
|
|
|
|
|
style:
|
|
|
|
|
TextStyle(color: const Color(0xFFFF3F3F), fontSize: 24.sp),
|
|
|
|
|
),
|
|
|
|
|