|
|
@ -1,5 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -7,9 +5,9 @@ import 'package:flutter/material.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';
|
|
|
|
|
|
|
|
import 'package:project_telephony/ui/user/privacy_rights_page.dart';
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class HomePage extends StatefulWidget {
|
|
|
|
class HomePage extends StatefulWidget {
|
|
|
|
const HomePage({Key? key}) : super(key: key);
|
|
|
|
const HomePage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
@ -17,12 +15,11 @@ class HomePage extends StatefulWidget {
|
|
|
|
_HomePageState createState() => _HomePageState();
|
|
|
|
_HomePageState createState() => _HomePageState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool sms=false;
|
|
|
|
bool sms = false;
|
|
|
|
bool plone=false;
|
|
|
|
bool plone = false;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
|
|
|
|
class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
|
|
|
|
class _HomePageState extends State<HomePage> with WidgetsBindingObserver{
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
@ -31,21 +28,25 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver{
|
|
|
|
_listenForPermissionStatus();
|
|
|
|
_listenForPermissionStatus();
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void dispose(){
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
//页面销毁时移出监听者
|
|
|
|
//页面销毁时移出监听者
|
|
|
|
WidgetsBinding.instance.removeObserver(this);
|
|
|
|
WidgetsBinding.instance.removeObserver(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _listenForPermissionStatus() async {
|
|
|
|
Future<void> _listenForPermissionStatus() async {
|
|
|
|
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;
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void didChangeAppLifecycleState(AppLifecycleState state){
|
|
|
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
|
|
|
super.didChangeAppLifecycleState(state);
|
|
|
|
super.didChangeAppLifecycleState(state);
|
|
|
|
switch (state){
|
|
|
|
switch (state) {
|
|
|
|
//应用状态处于闲置状态,并且没有用户的输入事件,
|
|
|
|
//应用状态处于闲置状态,并且没有用户的输入事件,
|
|
|
|
// 注意:这个状态切换到 前后台 会触发,所以流程应该是先冻结窗口,然后停止UI
|
|
|
|
// 注意:这个状态切换到 前后台 会触发,所以流程应该是先冻结窗口,然后停止UI
|
|
|
|
case AppLifecycleState.inactive:
|
|
|
|
case AppLifecycleState.inactive:
|
|
|
@ -63,6 +64,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver{
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
@ -87,9 +89,14 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver{
|
|
|
|
width: 722.w,
|
|
|
|
width: 722.w,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(top: 48.w,child: _warning()),
|
|
|
|
Positioned(top: 48.w, child: _warning()),
|
|
|
|
Positioned(bottom: 64.w, child: _getBody()),
|
|
|
|
Positioned(bottom: 64.w, child: _getBody()),
|
|
|
|
Align(child: SizedBox(width: double.infinity,height: 1600.w,),)
|
|
|
|
Align(
|
|
|
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
|
|
height: 1600.w,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
));
|
|
|
@ -102,33 +109,50 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver{
|
|
|
|
// return false;
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
_warning() {
|
|
|
|
_warning() {
|
|
|
|
return Offstage(offstage: (sms && plone) ,child:
|
|
|
|
return Offstage(
|
|
|
|
GestureDetector(
|
|
|
|
offstage: (sms && plone && callLog),
|
|
|
|
onTap: (){
|
|
|
|
child: GestureDetector(
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
// print();
|
|
|
|
// print();
|
|
|
|
openAppSettings();
|
|
|
|
openAppSettings();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 64.w),
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 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(
|
|
|
|
borderRadius:BorderRadius.circular(8.w),
|
|
|
|
borderRadius: BorderRadius.circular(8.w),
|
|
|
|
color: const Color(0xFFFFF2F2),
|
|
|
|
color: const Color(0xFFFFF2F2),
|
|
|
|
border: Border.all(width: 1.w,color: const Color(0xFFFFC8C8))
|
|
|
|
border: Border.all(width: 1.w, color: const Color(0xFFFFC8C8))),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Image(
|
|
|
|
|
|
|
|
image: AssetImage(Assets.icons.horn.path),
|
|
|
|
|
|
|
|
width: 48.w,
|
|
|
|
|
|
|
|
height: 48.w,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Row(children: [
|
|
|
|
|
|
|
|
Image(image: AssetImage(Assets.icons.horn.path),width: 48.w,height: 48.w
|
|
|
|
|
|
|
|
,),
|
|
|
|
|
|
|
|
16.wb,
|
|
|
|
16.wb,
|
|
|
|
Text("必须权限没有授予,本APP无法正常使用",style: TextStyle(color: const Color(0xFFFF3F3F),fontSize:24.sp ),)
|
|
|
|
Text(
|
|
|
|
,32.wb,
|
|
|
|
"必须权限没有授予,本APP无法正常使用",
|
|
|
|
Image(image: AssetImage(Assets.icons.right.path),width:28.w ,height: 28.w,fit:BoxFit.fill,)
|
|
|
|
style:
|
|
|
|
],),
|
|
|
|
TextStyle(color: const Color(0xFFFF3F3F), fontSize: 24.sp),
|
|
|
|
),),);
|
|
|
|
),
|
|
|
|
}
|
|
|
|
32.wb,
|
|
|
|
_getBody() {
|
|
|
|
Image(
|
|
|
|
|
|
|
|
image: AssetImage(Assets.icons.right.path),
|
|
|
|
|
|
|
|
width: 28.w,
|
|
|
|
|
|
|
|
height: 28.w,
|
|
|
|
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_getBody() {
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 64.w),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 64.w),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
@ -162,7 +186,6 @@ _getBody() {
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
print(title);
|
|
|
|
print(title);
|
|
|
|
if (title == "接听后") {
|
|
|
|
if (title == "接听后") {
|
|
|
|
|
|
|
|
|
|
|
|
Get.to(() => const ContentConnectPage());
|
|
|
|
Get.to(() => const ContentConnectPage());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Get.to(() => const ContentRefusePage());
|
|
|
|
Get.to(() => const ContentRefusePage());
|
|
|
@ -178,15 +201,13 @@ _getBody() {
|
|
|
|
colors: [cl1, cl2])),
|
|
|
|
colors: [cl1, cl2])),
|
|
|
|
width: 622.w,
|
|
|
|
width: 622.w,
|
|
|
|
height: 192.w,
|
|
|
|
height: 192.w,
|
|
|
|
child: Row(children: [
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(top: 40.w,left: 50.w
|
|
|
|
padding: EdgeInsets.only(top: 40.w, left: 50.w),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
child:
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
|
|
|
|
|
|
|
|
Text(title,
|
|
|
|
Text(title,
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 36.sp,
|
|
|
|
fontSize: 36.sp,
|
|
|
@ -200,14 +221,19 @@ _getBody() {
|
|
|
|
color: const Color(0xFFFFFFFF).withOpacity(0.6)),
|
|
|
|
color: const Color(0xFFFFFFFF).withOpacity(0.6)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
const Spacer(),
|
|
|
|
const Spacer(),
|
|
|
|
Padding(padding: EdgeInsets.only(top: 40.w),child: Image.asset(
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(top: 40.w),
|
|
|
|
|
|
|
|
child: Image.asset(
|
|
|
|
image,
|
|
|
|
image,
|
|
|
|
width: 166.w,
|
|
|
|
width: 166.w,
|
|
|
|
height: 152.w,
|
|
|
|
height: 152.w,
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
),)
|
|
|
|
),
|
|
|
|
,],)));
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|