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