# Conflicts:
#	lib/ui/home/content_connect_page.dart
master
戴余标 2 years ago
commit c6d424ceaa

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<item android:drawable="@android:color/white" >
<!-- <bitmap android:src="@android/Start"></bitmap>-->
</item>
<!-- You can insert your own image assets here -->
<!-- <item>

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@ -47,6 +47,12 @@ class $AssetsIconsGen {
/// File path: assets/icons/zhifubao.png
AssetGenImage get zhifubao =>
const AssetGenImage('assets/icons/zhifubao.png');
/// File path: assets/icons/right.png
AssetGenImage get right =>
const AssetGenImage('assets/icons/right.png');
/// File path: assets/icons/horn.png
AssetGenImage get horn =>
const AssetGenImage('assets/icons/horn.png');
}
class $AssetsImagesGen {
@ -81,6 +87,8 @@ class $AssetsImagesGen {
/// File path: assets/images/vipbg.png
AssetGenImage get vipbg => const AssetGenImage('assets/images/vipbg.png');
/// File path: assets/images/Start.png
AssetGenImage get Start => const AssetGenImage('assets/images/Start.png');
}
class Assets {

@ -16,6 +16,7 @@ import 'package:power_logger/power_logger.dart';
import 'package:project_telephony/providers/user_provider.dart';
import 'package:project_telephony/ui/home/call.dart';
import 'package:project_telephony/ui/loading.dart';
import 'package:project_telephony/ui/tab_navigator.dart';
import 'package:provider/provider.dart';
@ -28,10 +29,19 @@ import 'package:project_telephony/utils/hive_store.dart';
void main() async {
FlutterError.onError = (details) {
LoggerData.addData(details);
FlutterError.presentError(details);
};
// SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( //
// statusBarColor: Colors.transparent,
// statusBarIconBrightness: Brightness.dark,
// ));
//
// WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();//
// FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
//
// await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp] );
// FlutterError.onError = (details) {
// LoggerData.addData(details);
// FlutterError.presentError(details);
// };
WidgetsFlutterBinding.ensureInitialized();
await initializeService();
// Workmanager().initialize(
@ -92,7 +102,11 @@ class _MyAppState extends State<MyApp> {
child: GetMaterialApp(
// get.testmode=true,
debugShowCheckedModeBanner: false,
home: const TabNavigator(),
initialRoute: "/",
routes: {
"/TabNavigator":(context)=>const TabNavigator()
},
home: Loading(),//const TabNavigator(),
builder: (context, child) {
// ScreenUtil.setContext(context);
return MediaQuery(

@ -0,0 +1,19 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'state_model.g.dart';
@JsonSerializable()
class StateModel extends Equatable{
bool sms;
bool phone;
factory StateModel.fromJson(Map<String, dynamic> json) =>_$StateModelFromJson(json);
StateModel({
required this.sms,
required this.phone,
});
@override
List<Object?> get props => [sms,phone];
}

@ -0,0 +1,12 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'state_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
StateModel _$StateModelFromJson(Map<String, dynamic> json) => StateModel(
sms: json['sms'] as bool,
phone: json['phone'] as bool,
);

@ -0,0 +1,7 @@
// import 'package:flutter/material.dart';
//
// class PhoneProvider extends ChangeNotifier{
// bool sms=false;
// bool phone=false;
//
// }

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:project_telephony/utils/user_tool.dart';
import 'package:provider/provider.dart';
import '../../base/base_style.dart';
@ -24,14 +25,14 @@ class AddSmsPage extends StatefulWidget {
class _AddSmsPageState extends State<AddSmsPage> {
late TextEditingController _controller;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
String contant="";
@override
void initState() {
super.initState();
_controller = TextEditingController();
}
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
@override
Widget build(BuildContext context) {
return Scaffold(
@ -70,6 +71,10 @@ class _AddSmsPageState extends State<AddSmsPage> {
color: BaseStyle.color333333,
fontSize: BaseStyle.fontSize28,
),
onChanged: (text) async{
contant=text;
setState((){});
},
controller: _controller,
decoration: const InputDecoration(
fillColor: Colors.transparent,
@ -84,8 +89,9 @@ class _AddSmsPageState extends State<AddSmsPage> {
),
bottomNavigationBar: PloneBottom(
border: _controller.text.isEmpty,
opacity: _controller.text.isNotEmpty ? 1 : 0.4,
opacity: contant.isEmpty ? 0.4 : 1,
onTap: () async {
BaseModel res = await apiClient.request(API.app.content, data: {
'content': _controller.text,
'status': widget.status,
@ -93,7 +99,8 @@ class _AddSmsPageState extends State<AddSmsPage> {
if (res.code == 0) {
setState(() {});
widget.ploneBack(_controller.text);
userProvider.updateUserInfo();
UserTool.userProvider.updateUserInfo();
// userProvider.updateUserInfo();
} else {
CloudToast.show(res.msg);
}

@ -3,8 +3,11 @@ import 'dart:async';
import 'dart:ui';
import 'package:call_log/call_log.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';
import 'package:telephony/telephony.dart';
@ -44,24 +47,30 @@ bool onIosBackground(ServiceInstance service) {
void onStart(ServiceInstance service ) async {
DartPluginRegistrant.ensureInitialized();
int flag = 0;
String phoneNum="";
String? phoneNum="";
String callState;
Timer.periodic(const Duration(seconds: 1), (timer) async {
CallState state = await Telephony.instance.callState;
callState = state.name;
// print(callState!+" $flag");
if (callState == "IDLE") {
if (flag != 0) {
flag = 0;
// print("object");
final Iterable<CallLogEntry> result = await CallLog.query();
phoneNum = result.first.number!;
if(phoneNum.isEmpty){
final Iterable<CallLogEntry> entry = await CallLog.query();
phoneNum = entry.first.number;
// print('DATE : ${DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)}');//
// print('DURATION : ${entry.first.duration}');///
if(phoneNum!.isEmpty){
print("At Least 1 Person or Message Required");
}else{
print("你好$phoneNum");
// final inbox = telephony.getInboxSms();
Telephony.backgroundInstance.sendSms(to: phoneNum, message: "啦啦啦啦啦");
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "啦啦啦啦啦");
// telephony.sendSms(to: phoneNum, message: "感谢来电");
// _sendSMS('',[phoneNum]);
// print("你好123123$phoneNum");

@ -6,6 +6,7 @@ import 'package:project_telephony/ui/home/add_sms_page.dart';
import 'package:project_telephony/ui/widget/centertipsalterwidget.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/user_tool.dart';
import 'package:provider/provider.dart';
import '../../constants/api.dart';
import '../../model/network/api_client.dart';
@ -26,7 +27,7 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
List<String> textListSMS = [];
int isCheck=0;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override
@ -42,11 +43,11 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
}
updateList() {
if (userProvider.isLogin) {
if (UserTool.userProvider.isLogin) {
textListSMS.clear();
smsIdList.clear();
int i=0;
userProvider.userInfo.contentCon?.forEach((model) {
UserTool.userProvider.userInfo.contentCon?.forEach((model) {
textListSMS.add(model.content);
smsIdList.add(model.id);
if(model.isChecked==1){
@ -88,7 +89,7 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
footer: MaterialFooter(),
controller: _easyRefreshController,
onRefresh: () async {
await userProvider.updateUserInfo();
await UserTool.userProvider.updateUserInfo();
updateList();
setState(() {});
},
@ -109,13 +110,13 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
data: {'id': smsIdList[index], 'status': 1});
if (res.code == 0) {
setState(() {});
userProvider.updateUserInfo();
UserTool.userProvider.updateUserInfo();
_easyRefreshController.callRefresh();
} else {
CloudToast.show(res.msg);
}
} else {
if (userProvider.isLogin) {
if (UserTool.userProvider.isLogin) {
if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else {

@ -1,11 +1,14 @@
import 'dart:async';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.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';
import 'package:project_telephony/utils/headers.dart';
import 'call.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@ -14,11 +17,25 @@ class HomePage extends StatefulWidget {
_HomePageState createState() => _HomePageState();
}
bool sms=false;
bool plone=false;
@override
class _HomePageState extends State<HomePage> {
@override
void initState() {
super.initState();
// initializeService();
_listenForPermissionStatus();
setState(() {
});
}
Future<void> _listenForPermissionStatus() async {
sms=await Permission.sms.request().isGranted;
plone =await Permission.phone.request().isGranted;
setState(() {});
}
@ -30,23 +47,64 @@ class _HomePageState extends State<HomePage> {
extendBody: true,
body: SafeArea(
child: Stack(
fit: StackFit.expand,
// fit: StackFit.expand,
children: [
Positioned(
top: 10.w,
child: Image.asset(
child:
// Container(
// height: 722.w,
// width: 722.w,
// decoration: BoxDecoration(image: DecorationImage(image:AssetImage(Assets.images.homeBg.path),fit:BoxFit.fill)),
// child: _warning(),)
Image.asset(
Assets.images.homeBg.path,
height: 722.w,
width: 722.w,
),
),
Positioned(bottom: 20.w, child: _getBody()),
Positioned(top: 48.w,child: _warning()),
Positioned(bottom: 64.w, child: _getBody()),
Align(child: SizedBox(width: double.infinity,height: 1600.w,),)
],
),
));
}
_getBody() {
bool _getPermissions() {
if(sms && plone){
return true;
}else{
return false;
}
}
_warning() {
return Offstage(offstage: (sms && plone) ,child:
GestureDetector(
onTap: (){
// print();
openAppSettings();
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 64.w),
padding: EdgeInsets.symmetric(horizontal: 32.w,vertical: 20.w),
height: 88.w,
decoration: BoxDecoration(
borderRadius:BorderRadius.circular(8.w),
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,)
],),
),),);
}
_getBody() {
return Container(
padding: EdgeInsets.symmetric(horizontal: 64.w),
child: Column(
@ -86,70 +144,44 @@ class _HomePageState extends State<HomePage> {
print("未接听");
}
},
child: Stack(
children: [
Align(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [cl1, cl2])),
width: 622.w,
height: 192.w,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [cl1, cl2])),
width: 622.w,
height: 192.w,
child: Row(children: [
Container(
padding: EdgeInsets.only(top: 40.w,left: 50.w
),
),
Positioned(
// top: 0,
// left: 0,
child: Container(
// height: 192.w,
// alignment: Alignment.centerLeft,
padding: EdgeInsets.only(
left: 48.w,
top: 38.w,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title,
style: TextStyle(
fontSize: 36.sp,
color: const Color(0xFFFFFFFF),
fontWeight: FontWeight.bold)),
16.hb,
Text(
text,
style: TextStyle(
fontSize: 27.sp,
color: const Color(0xFFFFFFFF).withOpacity(0.6)),
),
],
child:
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title,
style: TextStyle(
fontSize: 36.sp,
color: const Color(0xFFFFFFFF),
fontWeight: FontWeight.bold)),
16.hb,
Text(
text,
style: TextStyle(
fontSize: 27.sp,
color: const Color(0xFFFFFFFF).withOpacity(0.6)),
),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
image,
width: 166.w,
height: 152.w,
fit: BoxFit.fill,
),
)
],
)
// Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(16.w),
// gradient: LinearGradient(
// end: Alignment.centerLeft,
// begin: Alignment.centerRight,
// colors: [cl1, cl2])),
// child:
// ),
);
],
),),
const Spacer()
,Image.asset(
image,
width: 166.w,
height: 152.w,
fit: BoxFit.fill,
),],)));
}
}

@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:project_telephony/utils/headers.dart';
class Loading extends StatefulWidget {
Loading({Key? key}) : super(key: key);
@override
_LoadingState createState() => _LoadingState();
}
class _LoadingState extends State<Loading> {
@override
void initState() {
// TODO: implement initState
super.initState();
Future.delayed(const Duration(seconds: 3),(){
//3
Navigator.of(context).pushReplacementNamed("/TabNavigator");
});
}
@override
Widget build(BuildContext context) {
//
return Scaffold(
backgroundColor: Colors.white,
body:Padding(padding: EdgeInsets.only(left: 148.w,top:1318.w ),child: Image.asset(
Assets.images.Start.path,width:434.sp,height:148.sp , fit: BoxFit.fill),)
,);
}
}

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/user_tool.dart';
import 'package:provider/provider.dart';
import '../../base/base_style.dart';
@ -26,7 +27,7 @@ class ContentDetailsPage extends StatefulWidget {
class _ContentDetailsPageState extends State<ContentDetailsPage> {
late TextEditingController _controller;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
@override
@ -91,14 +92,15 @@ class _ContentDetailsPageState extends State<ContentDetailsPage> {
),
bottomNavigationBar: PloneBottom(
border: _controller.text.isEmpty,
opacity: _controller.text.isNotEmpty ? 1 : 0.4,
opacity: _controller.text.isEmpty ? 1 : 0.4,
onTap: () async {
// print(_controller.text);
BaseModel res =
await apiClient.request(API.app.addTag, data: {'tag': _controller.text});
if (res.code == 0) {
setState(() {});
widget.ploneBack(_controller.text);
userProvider.updateUserInfo();
UserTool.userProvider.updateUserInfo();
Get.back();
} else {
CloudToast.show(res.msg);

@ -81,6 +81,7 @@ dependencies:
shared_preferences: ^2.0.15
#刷新组件
flutter_easyrefresh: ^2.2.1
# flutter_gen_runner: ^4.3.0,
# # jdk
@ -92,25 +93,21 @@ dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
# test: ^1.21.4
#导入包整理
import_sorter: ^4.5.1
hive_generator: ^1.1.0
#model自动生成
#model自动生成
json_serializable: ^6.1.3
build_runner: ^2.0.2
yaml: ^3.1.0
pub_semver: ^2.1.0
flutter_gen_runner: ^4.1.3
flutter_gen_runner: ^4.3.0
flutter_lints: ^2.0.0
# patgh: ^1.8.1
#脚本工具
# 脚本工具
grinder: ^0.9.1
flutter_native_splash: ^1.1.8+4
@ -129,5 +126,5 @@ flutter:
- assets/
- assets/icons/
- assets/images/
# - assets/data/
# - assets/data/

Loading…
Cancel
Save