|
|
@ -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,23 +28,27 @@ 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:
|
|
|
|
print("应用处于闲置状态,这种状态的应用应该假设他们可能在任何时候暂停 切换到后台会触发======");
|
|
|
|
print("应用处于闲置状态,这种状态的应用应该假设他们可能在任何时候暂停 切换到后台会触发======");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -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(
|
|
|
@ -76,20 +78,25 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver{
|
|
|
|
Positioned(
|
|
|
|
Positioned(
|
|
|
|
top: 10.w,
|
|
|
|
top: 10.w,
|
|
|
|
child:
|
|
|
|
child:
|
|
|
|
// Container(
|
|
|
|
// Container(
|
|
|
|
// height: 722.w,
|
|
|
|
// height: 722.w,
|
|
|
|
// width: 722.w,
|
|
|
|
// width: 722.w,
|
|
|
|
// decoration: BoxDecoration(image: DecorationImage(image:AssetImage(Assets.images.homeBg.path),fit:BoxFit.fill)),
|
|
|
|
// decoration: BoxDecoration(image: DecorationImage(image:AssetImage(Assets.images.homeBg.path),fit:BoxFit.fill)),
|
|
|
|
// child: _warning(),)
|
|
|
|
// child: _warning(),)
|
|
|
|
Image.asset(
|
|
|
|
Image.asset(
|
|
|
|
Assets.images.homeBg.path,
|
|
|
|
Assets.images.homeBg.path,
|
|
|
|
height: 722.w,
|
|
|
|
height: 722.w,
|
|
|
|
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(
|
|
|
|
// print();
|
|
|
|
onTap: () {
|
|
|
|
openAppSettings();
|
|
|
|
// print();
|
|
|
|
},
|
|
|
|
openAppSettings();
|
|
|
|
child: Container(
|
|
|
|
},
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 64.w),
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 32.w,vertical: 20.w),
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 64.w),
|
|
|
|
height: 88.w,
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
height: 88.w,
|
|
|
|
borderRadius:BorderRadius.circular(8.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: const Color(0xFFFFF2F2),
|
|
|
|
borderRadius: BorderRadius.circular(8.w),
|
|
|
|
border: Border.all(width: 1.w,color: const Color(0xFFFFC8C8))
|
|
|
|
color: const Color(0xFFFFF2F2),
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
16.wb,
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
"必须权限没有授予,本APP无法正常使用",
|
|
|
|
|
|
|
|
style:
|
|
|
|
|
|
|
|
TextStyle(color: const Color(0xFFFF3F3F), fontSize: 24.sp),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
32.wb,
|
|
|
|
|
|
|
|
Image(
|
|
|
|
|
|
|
|
image: AssetImage(Assets.icons.right.path),
|
|
|
|
|
|
|
|
width: 28.w,
|
|
|
|
|
|
|
|
height: 28.w,
|
|
|
|
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Row(children: [
|
|
|
|
);
|
|
|
|
Image(image: AssetImage(Assets.icons.horn.path),width: 48.w,height: 48.w
|
|
|
|
}
|
|
|
|
,),
|
|
|
|
|
|
|
|
16.wb,
|
|
|
|
_getBody() {
|
|
|
|
Text("必须权限没有授予,本APP无法正常使用",style: TextStyle(color: const Color(0xFFFF3F3F),fontSize:24.sp ),)
|
|
|
|
|
|
|
|
,32.wb,
|
|
|
|
|
|
|
|
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());
|
|
|
@ -170,44 +193,47 @@ _getBody() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(16.w),
|
|
|
|
borderRadius: BorderRadius.circular(16.w),
|
|
|
|
gradient: LinearGradient(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
end: Alignment.centerRight,
|
|
|
|
end: Alignment.centerRight,
|
|
|
|
colors: [cl1, cl2])),
|
|
|
|
colors: [cl1, cl2])),
|
|
|
|
width: 622.w,
|
|
|
|
width: 622.w,
|
|
|
|
height: 192.w,
|
|
|
|
height: 192.w,
|
|
|
|
child: Row(children: [
|
|
|
|
child: Row(
|
|
|
|
Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(top: 40.w,left: 50.w
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child:
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Container(
|
|
|
|
Text(title,
|
|
|
|
padding: EdgeInsets.only(top: 40.w, left: 50.w),
|
|
|
|
style: TextStyle(
|
|
|
|
child: Column(
|
|
|
|
fontSize: 36.sp,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
color: const Color(0xFFFFFFFF),
|
|
|
|
children: [
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
Text(title,
|
|
|
|
16.hb,
|
|
|
|
style: TextStyle(
|
|
|
|
Text(
|
|
|
|
fontSize: 36.sp,
|
|
|
|
text,
|
|
|
|
color: const Color(0xFFFFFFFF),
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
fontSize: 27.sp,
|
|
|
|
16.hb,
|
|
|
|
color: const Color(0xFFFFFFFF).withOpacity(0.6)),
|
|
|
|
Text(
|
|
|
|
|
|
|
|
text,
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 27.sp,
|
|
|
|
|
|
|
|
color: const Color(0xFFFFFFFF).withOpacity(0.6)),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const Spacer(),
|
|
|
|
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(top: 40.w),
|
|
|
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
|
|
|
image,
|
|
|
|
|
|
|
|
width: 166.w,
|
|
|
|
|
|
|
|
height: 152.w,
|
|
|
|
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),),
|
|
|
|
)));
|
|
|
|
const Spacer(),
|
|
|
|
|
|
|
|
Padding(padding: EdgeInsets.only(top: 40.w),child: Image.asset(
|
|
|
|
|
|
|
|
image,
|
|
|
|
|
|
|
|
width: 166.w,
|
|
|
|
|
|
|
|
height: 152.w,
|
|
|
|
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
|
|
|
|
),)
|
|
|
|
|
|
|
|
,],)));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|