master
王亚玲 3 years ago
parent f9b48743ca
commit 88891266f6

@ -2,6 +2,7 @@
import 'dart:async'; import 'dart:async';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:call_log/call_log.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -42,7 +43,7 @@ class MyApp extends StatefulWidget {
_MyAppState createState() => _MyAppState(); _MyAppState createState() => _MyAppState();
} }
class _MyAppState extends State<MyApp> { class _MyAppState extends State<MyApp> {
final telephony = Telephony.instance; final telephony = Telephony.instance;
final prefs = SharedPreferences.getInstance(); final prefs = SharedPreferences.getInstance();
Future<void> _Getpermission() async{ Future<void> _Getpermission() async{
@ -58,9 +59,6 @@ class _MyAppState extends State<MyApp> {
// universalLink:"http://api.dxbs.vip/ " // universalLink:"http://api.dxbs.vip/ "
); );
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MultiProvider( return MultiProvider(

@ -1,22 +1,22 @@
import 'package:equatable/equatable.dart'; // import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart'; // import 'package:json_annotation/json_annotation.dart';
//
part 'contant_list_model.g.dart'; // part 'contant_list_model.g.dart';
//
//
@JsonSerializable() // @JsonSerializable()
class ContantListModel extends Equatable{ // class ContantListModel extends Equatable{
final int id; // final int id;
final String content; // final String content;
final int isChecked; // final int isChecked;
factory ContantListModel.fromJson(Map<String, dynamic> json) =>_$ContantListModelFromJson(json); // factory ContantListModel.fromJson(Map<String, dynamic> json) =>_$ContantListModelFromJson(json);
//
//
const ContantListModel({ // const ContantListModel({
required this.id, // required this.id,
required this.content, // required this.content,
required this.isChecked, // required this.isChecked,
}); // });
@override // @override
List<Object?> get props => [id,content,isChecked]; // List<Object?> get props => [id,content,isChecked];
} // }

@ -1,14 +1,14 @@
// GENERATED CODE - DO NOT MODIFY BY HAND // // GENERATED CODE - DO NOT MODIFY BY HAND
//
part of 'contant_list_model.dart'; // part of 'contant_list_model.dart';
//
// ************************************************************************** // // **************************************************************************
// JsonSerializableGenerator // // JsonSerializableGenerator
// ************************************************************************** // // **************************************************************************
//
ContantListModel _$ContantListModelFromJson(Map<String, dynamic> json) => // ContantListModel _$ContantListModelFromJson(Map<String, dynamic> json) =>
ContantListModel( // ContantListModel(
id: json['id'] as int, // id: json['id'] as int,
content: json['content'] as String, // content: json['content'] as String,
isChecked: json['is_checked'] as int, // isChecked: json['is_checked'] as int,
); // );

@ -1,24 +1,24 @@
import 'package:equatable/equatable.dart'; // import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart'; // import 'package:json_annotation/json_annotation.dart';
//
part 'phone_num_model.g.dart'; // part 'phone_num_model.g.dart';
//
@JsonSerializable() // @JsonSerializable()
//
class PhoneNumModel extends Equatable{ // class PhoneNumModel extends Equatable{
final String? num; // final String? num;
final int? time; // final int? time;
final String? name; // final String? name;
bool state ; // bool state ;
factory PhoneNumModel.fromJson(Map<String, dynamic> json) =>_$PhoneNumModelFromJson(json); // factory PhoneNumModel.fromJson(Map<String, dynamic> json) =>_$PhoneNumModelFromJson(json);
//
//
PhoneNumModel({ // PhoneNumModel({
required this.name, // required this.name,
required this.num, // required this.num,
required this.time, // required this.time,
required this.state, // required this.state,
}); // });
@override // @override
List<Object?> get props => [num,time,name,state]; // List<Object?> get props => [num,time,name,state];
} // }

@ -1,15 +1,15 @@
// GENERATED CODE - DO NOT MODIFY BY HAND // // GENERATED CODE - DO NOT MODIFY BY HAND
//
part of 'phone_num_model.dart'; // part of 'phone_num_model.dart';
//
// ************************************************************************** // // **************************************************************************
// JsonSerializableGenerator // // JsonSerializableGenerator
// ************************************************************************** // // **************************************************************************
//
PhoneNumModel _$PhoneNumModelFromJson(Map<String, dynamic> json) => // PhoneNumModel _$PhoneNumModelFromJson(Map<String, dynamic> json) =>
PhoneNumModel( // PhoneNumModel(
num: json['num'] as String, // num: json['num'] as String,
time: json['time'] as int, // time: json['time'] as int,
name: json['name'] as String, // name: json['name'] as String,
state: json['state']as bool, // state: json['state']as bool,
); // );

@ -5,36 +5,24 @@ part 'update_model.g.dart';
@JsonSerializable() @JsonSerializable()
class UpdateModel extends Equatable { class UpdateModel extends Equatable {
final int updateStatus; final String versionCode;
final int versionCode;
final String versionName; final String versionName;
final String modifyContent; final String modifyContent;
final String downloadUrl;
final String apkSize;
final String apkMd5;
factory UpdateModel.fromJson(Map<String, dynamic> json) => factory UpdateModel.fromJson(Map<String, dynamic> json) =>
_$UpdateModelFromJson(json); _$UpdateModelFromJson(json);
const UpdateModel({ const UpdateModel({
required this.updateStatus,
required this.versionCode, required this.versionCode,
required this.versionName, required this.versionName,
required this.modifyContent, required this.modifyContent,
required this.downloadUrl,
required this.apkSize,
required this.apkMd5,
}); });
@override @override
List<Object?> get props => [ List<Object?> get props => [
updateStatus,
versionCode, versionCode,
versionName, versionName,
modifyContent, modifyContent,
downloadUrl,
apkSize,
apkMd5,
]; ];
} }

@ -7,11 +7,7 @@ part of 'update_model.dart';
// ************************************************************************** // **************************************************************************
UpdateModel _$UpdateModelFromJson(Map<String, dynamic> json) => UpdateModel( UpdateModel _$UpdateModelFromJson(Map<String, dynamic> json) => UpdateModel(
updateStatus: json['updateStatus'] as int, versionCode: json['versionCode'] as String,
versionCode: json['versionCode'] as int,
versionName: json['versionName'] as String, versionName: json['versionName'] as String,
modifyContent: json['modifyContent'] as String, modifyContent: json['modifyContent'] as String,
downloadUrl: json['downloadUrl'] as String,
apkSize: json['apkSize'] as String,
apkMd5: json['apkMd5'] as String,
); );

@ -6,6 +6,8 @@ import 'package:project_telephony/utils/user_tool.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../constants/api.dart'; import '../constants/api.dart';
import '../model/exclude_phone_model.dart';
import '../model/hive/phone_model.dart';
import '../model/login_info_model.dart'; import '../model/login_info_model.dart';
import '../model/network/api_client.dart'; import '../model/network/api_client.dart';
import '../model/user_info_model.dart'; import '../model/user_info_model.dart';
@ -35,10 +37,10 @@ class UserProvider extends ChangeNotifier {
_isLogin = true; _isLogin = true;
apiClient.setToken(token); apiClient.setToken(token);
await updateUserInfo(); await updateUserInfo();
updateConSms(); // updateConSms();
updateRefSms(); // updateRefSms();
updateCallSms(); // updateCallSms();
updateIdleSms(); // updateIdleSms();
return true; return true;
} else { } else {
_isLogin = false; _isLogin = false;
@ -57,23 +59,24 @@ class UserProvider extends ChangeNotifier {
apiClient.setToken(token); apiClient.setToken(token);
await HiveStore.appBox!.put('token', token); await HiveStore.appBox!.put('token', token);
_isLogin = true; _isLogin = true;
//app // app
await updateUserInfo(); updateUserInfo();
prefs.setInt("numIndex", 0); prefs.setInt("numIndex", 0);//
_viewLoading();
UserTool.phoneNumProvider.init(); // _viewLoading();//
prefs.setStringList("dxText", [ // UserTool.phoneNumProvider.init();
"祝你万事顺心", // prefs.setStringList("dxText", [
"欢迎你的来电,祝你生活愉快", // "祝你万事顺心",
"感谢您的来电,我们会尽快处理", // "欢迎你的来电,祝你生活愉快",
]); // "感谢您的来电,我们会尽快处理",
// ]);
// prefs.setStringList("dxText",["祝你万事顺心","欢迎你的来电,祝你生活愉快","感谢您的来电,我们会尽快处理",]); // prefs.setStringList("dxText",["祝你万事顺心","欢迎你的来电,祝你生活愉快","感谢您的来电,我们会尽快处理",]);
updateConSms(); // updateConSms();
updateRefSms(); // updateRefSms();
updateCallSms(); // updateCallSms();
updateIdleSms(); // updateIdleSms();
viewLoading(); // viewLoading();
getExclude(); // getExclude();
} }
Future logout() async { Future logout() async {
@ -120,112 +123,131 @@ class UserProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future updateRefSms() async { // Future updateRefSms() async {
final prefs = await SharedPreferences.getInstance(); // final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService(); // final service = FlutterBackgroundService();
var base = await apiClient.request(API.content.find, data: {'status': 2}); // var base = await apiClient.request(API.content.find, data: {'status': 2});
if (base.code == 0) { // if (base.code == 0) {
await prefs.remove('refSms'); // await prefs.remove('refSms');
await prefs.setString( // await prefs.setString(
'refSms', // 'refSms',
(UserTool.userProvider.userInfo.tag) == "" // (UserTool.userProvider.userInfo.tag) == ""
? "${base.data['content']}" // ? "${base.data['content']}"
: "${UserTool.userProvider.userInfo.tag}${base.data['content']}"); // : "${UserTool.userProvider.userInfo.tag}${base.data['content']}");
service.invoke("stopService"); // service.invoke("stopService");
if (prefs.getBool('kg') ?? false) { // if (prefs.getBool('kg') ?? false) {
Future.delayed(const Duration(seconds: 1), () async { // Future.delayed(const Duration(seconds: 1), () async {
service.startService(); // service.startService();
}); // });
} // }
} else { // } else {
CloudToast.show(base.msg); // CloudToast.show(base.msg);
} // }
notifyListeners(); // notifyListeners();
} // }
//
// Future updateCallSms() async {
// final prefs = await SharedPreferences.getInstance();
// final service = FlutterBackgroundService();//
// var base = await apiClient.request(API.content.find, data: {'status': 3});
// if (base.code == 0) {
// await prefs.remove('callSms');
// await prefs.setString(
// 'callSms',
// (UserTool.userProvider.userInfo.tag) == ""
// ? "${base.data['content']}"
// : "${UserTool.userProvider.userInfo.tag}${base.data['content']}");
// service.invoke("stopService");
// if (prefs.getBool('kg') ?? false) {
// Future.delayed(const Duration(seconds: 1), () async {
// service.startService();
// });
// }
// } else {
// CloudToast.show(base.msg);
// }
// notifyListeners();
// }
//
// Future updateIdleSms() async {
// final prefs = await SharedPreferences.getInstance();
// final service = FlutterBackgroundService();
// var base = await apiClient.request(API.content.find, data: {'status': 4});
// if (base.code == 0) {
// await prefs.remove('idleSms');
// await prefs.setString(
// 'idleSms',
// (UserTool.userProvider.userInfo.tag) == ""
// ? "${base.data['content']}"
// : "${UserTool.userProvider.userInfo.tag}${base.data['content']}");
// service.invoke("stopService");
// if (prefs.getBool('kg') ?? false) {
// Future.delayed(const Duration(seconds: 1), () async {
// service.startService();
// });
// }
// } else {
// CloudToast.show(base.msg);
// }
// notifyListeners();
// }
//
// Future getExclude() async {
// final prefs = await SharedPreferences.getInstance();
// final service = FlutterBackgroundService();
// var base = await apiClient.request(API.exclude.find);
// if (base.code == 0) {
// await prefs.remove('exclude');
// prefs.setStringList('exclude', base.data);
// service.invoke("stopService");
// if (prefs.getBool('kg') ?? false) {
// Future.delayed(const Duration(seconds: 1), () async {
// service.startService();
// });
// }
// } else {
// CloudToast.show(base.msg);
// }
// notifyListeners();
// }
Future updateCallSms() async {
final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService();
var base = await apiClient.request(API.content.find, data: {'status': 3});
if (base.code == 0) {
await prefs.remove('callSms');
await prefs.setString(
'callSms',
(UserTool.userProvider.userInfo.tag) == ""
? "${base.data['content']}"
: "${UserTool.userProvider.userInfo.tag}${base.data['content']}");
service.invoke("stopService");
if (prefs.getBool('kg') ?? false) {
Future.delayed(const Duration(seconds: 1), () async {
service.startService();
});
}
} else {
CloudToast.show(base.msg);
}
notifyListeners();
}
Future updateIdleSms() async {
final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService();
var base = await apiClient.request(API.content.find, data: {'status': 4});
if (base.code == 0) {
await prefs.remove('idleSms');
await prefs.setString(
'idleSms',
(UserTool.userProvider.userInfo.tag) == ""
? "${base.data['content']}"
: "${UserTool.userProvider.userInfo.tag}${base.data['content']}");
service.invoke("stopService");
if (prefs.getBool('kg') ?? false) {
Future.delayed(const Duration(seconds: 1), () async {
service.startService();
});
}
} else {
CloudToast.show(base.msg);
}
notifyListeners();
}
Future getExclude() async {
final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService();
var base = await apiClient.request(API.exclude.find);
if (base.code == 0) {
await prefs.remove('exclude');
await prefs.setStringList('exclude', base.data ?? []);
service.invoke("stopService");
if (prefs.getBool('kg') ?? false) {
Future.delayed(const Duration(seconds: 1), () async {
service.startService();
});
}
} else {
CloudToast.show(base.msg);
}
notifyListeners();
}
Future viewLoading( ) async { Future viewLoading( ) async {
List<String>? numList=[]; List<String> numList=[];
List<String>? numbers=[]; List<String> numbers=[];
List<String> nameList=[];
List<PhoneModel> massList = [];
List<PhoneNum> phoneList = [];
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
final SharedPreferences prefs = await SharedPreferences.getInstance(); final SharedPreferences prefs = await SharedPreferences.getInstance();
var contact = await FlutterContacts.getContacts(); var numberList = await ExcludeFunc.getContacts() ;
for (var element in contact) { List<Contact> contact = await FlutterContacts.getContacts();//
for (var element in contact ) {
final full = await FlutterContacts.getContact(element.id); final full = await FlutterContacts.getContact(element.id);
numbers.add(full!.phones.first.number.replaceAll(" ", "")); if(full?.phones.length==0){
numbers.add('');
}else{
numbers.add(full!.phones.first.number.replaceAll(" ", ""));
nameList.add(full.displayName);
numbers.add(full.phones.first.number);
phoneList.add(PhoneNum(name: full.displayName, phone: full.phones.first.number,state: false));
// phoneList.add(PhoneNumModel(time: 0, name: full!.displayName, state: false, num: full.phones.first.number));
// numbers.add(full!.phones.first.number);
}
// status.add(false); // status.add(false);
} }
var numberList = await ExcludeFunc.getContacts(); // print("numbersList$numberList");
for (int i = 0; i < numberList.length; i++) { for (int i = 0; i < numberList.length; i++) {
numList.add(numberList[i].phone); numList.add(numberList[i].phone);
} }
await prefs.setStringList("specified", numList); await HiveStore.dataBox!.put("pl",phoneList) ;
await prefs.setStringList("addressList", numbers); massList.add(PhoneModel(title:"未分组联系人",time: "本机通讯录",phoneList:HiveStore.dataBox!.get("pl"),state: false));
HiveStore.dataBox?.put("ml",massList) ;
prefs.setStringList("specified", numList);
prefs.setStringList("addressList", numbers);
prefs.setStringList("nameList",nameList );
prefs.setStringList("number", numbers);
service.invoke("stopService"); service.invoke("stopService");
// print("指定不发送${prefs.getStringList("specified")}");
if (prefs.getBool('kg') ?? false) { if (prefs.getBool('kg') ?? false) {
Future.delayed(const Duration(seconds: 1), () async { Future.delayed(const Duration(seconds: 1), () async {
service.startService(); service.startService();
@ -234,27 +256,27 @@ class UserProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future _viewLoading() async { // Future _viewLoading() async {
List<Contact>? contacts; // List<Contact>? contacts;
List<String> numbers=[]; // List<String> numbers=[];
List<String> nameList=[]; // List<String> nameList=[];
final SharedPreferences prefs = await SharedPreferences.getInstance(); // final SharedPreferences prefs = await SharedPreferences.getInstance();
contacts = await FlutterContacts.getContacts(); // contacts = await FlutterContacts.getContacts();
for (var element in contacts) { // for (var element in contacts) {
final full = await FlutterContacts.getContact(element.id); // final full = await FlutterContacts.getContact(element.id);
if(full?.phones.length==0){ // if(full?.phones.length==0){
numbers.add(''); // numbers.add('');
}else{ // }else{
nameList.add(full!.displayName); // nameList.add(full!.displayName);
numbers.add(full.phones.first.number); // numbers.add(full.phones.first.number);
// phoneList.add(PhoneNumModel(time: 0, name: full!.displayName, state: false, num: full.phones.first.number)); // // phoneList.add(PhoneNumModel(time: 0, name: full!.displayName, state: false, num: full.phones.first.number));
// numbers.add(full!.phones.first.number); // // numbers.add(full!.phones.first.number);
} // }
} // }
await prefs.setStringList("nameList",nameList ); // prefs.setStringList("nameList",nameList );
prefs.setStringList("number", numbers); // prefs.setStringList("number", numbers);
// print(contacts.length); // // print(contacts.length);
notifyListeners(); // notifyListeners();
} // }
} }

@ -1,243 +1,243 @@
import 'package:flutter/cupertino.dart'; // import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/model/hive/phone_model.dart'; // import 'package:project_telephony/model/hive/phone_model.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/hive_store.dart'; // import 'package:project_telephony/utils/hive_store.dart';
//
import '../../base/base_style.dart'; // import '../../base/base_style.dart';
import '../widget/plone_back_button.dart'; // import '../widget/plone_back_button.dart';
import '../widget/plone_bottom.dart'; // import '../widget/plone_bottom.dart';
import 'call_list_page.dart'; // import 'call_list_page.dart';
//
typedef NumList = Function(List<String> content); // typedef NumList = Function(List<String> content);
//
class AddressBook extends StatefulWidget { // class AddressBook extends StatefulWidget {
final NumList number; // final NumList number;
//
const AddressBook({Key? key, required this.number}) : super(key: key); // const AddressBook({Key? key, required this.number}) : super(key: key);
//
@override // @override
_AddressBookState createState() => _AddressBookState(); // _AddressBookState createState() => _AddressBookState();
} // }
//
class _AddressBookState extends State<AddressBook> { // class _AddressBookState extends State<AddressBook> {
final EasyRefreshController _easyRefreshController = EasyRefreshController(); // final EasyRefreshController _easyRefreshController = EasyRefreshController();
String phoneName = ""; // String phoneName = "";
List<PhoneModel> massList = []; // List<PhoneModel> massList = [];
List<PhoneNum> phoneList = []; // List<PhoneNum> phoneList = [];
List<String> NumList = []; // List<String> NumList = [];
bool state=false; // bool state=false;
//
@override // @override
void initState() { // void initState() {
// print("这是我的第二个类型${massList.runtimeType}"); // // print("这是我的第二个类型${massList.runtimeType}");
// print(HiveStore.dataBox?.get("ml")); // // print(HiveStore.dataBox?.get("ml"));
massList = HiveStore.dataBox?.get("ml").cast<PhoneModel>(); // massList = HiveStore.dataBox?.get("ml").cast<PhoneModel>();
// UserTool.phoneNumProvider.init(); // // UserTool.phoneNumProvider.init();
// massList=HiveStore.dataBox?.get("ml").cast<PhoneModel>(); // // massList=HiveStore.dataBox?.get("ml").cast<PhoneModel>();
// List<dynamic> list<PhoneModel> // // List<dynamic> list<PhoneModel>
// massList= HiveStore.dataBox?.get("ml"); // // massList= HiveStore.dataBox?.get("ml");
super.initState(); // super.initState();
} // }
//
@override // @override
void dispose() { // void dispose() {
_easyRefreshController.dispose(); // _easyRefreshController.dispose();
super.dispose(); // super.dispose();
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return Scaffold( // return Scaffold(
resizeToAvoidBottomInset: false, // resizeToAvoidBottomInset: false,
appBar: AppBar( // appBar: AppBar(
elevation: 0, // elevation: 0,
centerTitle: true, // centerTitle: true,
title: Text( // title: Text(
'通讯录', // '通讯录',
style: TextStyle( // style: TextStyle(
fontSize: BaseStyle.fontSize34, // fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
// titleSpacing: 185.w, // // titleSpacing: 185.w,
actions: [ // actions: [
GestureDetector( // GestureDetector(
onTap: () { // onTap: () {
showDialog( // showDialog(
context: context, // context: context,
builder: (context) { // builder: (context) {
return CupertinoAlertDialog( // return CupertinoAlertDialog(
title: Text( // title: Text(
"添加分组", // "添加分组",
style: TextStyle( // style: TextStyle(
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontSize: 34.sp), // fontSize: 34.sp),
), // ),
content: Column( // content: Column(
children: [ // children: [
Column( // Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
CupertinoTextField( // CupertinoTextField(
padding: EdgeInsets.symmetric( // padding: EdgeInsets.symmetric(
horizontal: 24.w, vertical: 20.w), // horizontal: 24.w, vertical: 20.w),
decoration: BoxDecoration( // decoration: BoxDecoration(
border: // border:
Border.all(color: Colors.white), // Border.all(color: Colors.white),
// borderRadius: BorderRadius.all( // // borderRadius: BorderRadius.all(
// Radius.circular(4.w) // // Radius.circular(4.w)
// ), // // ),
color: const Color(0xFFF9F9F9)), // color: const Color(0xFFF9F9F9)),
placeholderStyle: TextStyle( // placeholderStyle: TextStyle(
fontSize: 28.sp, // fontSize: 28.sp,
color: BaseStyle.color999999), // color: BaseStyle.color999999),
placeholder: "请输入分组名称10个字以内", // placeholder: "请输入分组名称10个字以内",
onChanged: (value) { // onChanged: (value) {
phoneName = value; // phoneName = value;
setState(() {}); // setState(() {});
}, // },
), // ),
//
82.hb, // 82.hb,
// _getUpdate("爸爸", "123123123"), // // _getUpdate("爸爸", "123123123"),
PloneBottom( // PloneBottom(
blM: false, // blM: false,
border: true, // border: true,
color1: const Color(0xFF1890FF), // color1: const Color(0xFF1890FF),
color2: const Color(0xFF74BCFF), // color2: const Color(0xFF74BCFF),
onTap: () async { // onTap: () async {
DateTime now = DateTime.now(); // DateTime now = DateTime.now();
String nowTime = // String nowTime =
"${now.year}-${now.month}-${now // "${now.year}-${now.month}-${now
.day} ${now.hour}:${now // .day} ${now.hour}:${now
.minute}:${now.millisecond}"; // .minute}:${now.millisecond}";
massList.add(PhoneModel( // massList.add(PhoneModel(
time: nowTime, // time: nowTime,
phoneList: [], // phoneList: [],
state: false, // state: false,
title: phoneName)); // title: phoneName));
await HiveStore.dataBox // await HiveStore.dataBox
?.put("ml", massList); // ?.put("ml", massList);
// massList.add(MassListModel( // // massList.add(MassListModel(
// state: false, // // state: false,
// list: [], // // list: [],
// title: phoneName, // // title: phoneName,
// time: nowTime)); // // time: nowTime));
// // await // // // await
// Navigator.pop(context); // // Navigator.pop(context);
Get.back(); // Get.back();
_easyRefreshController.callRefresh(); // _easyRefreshController.callRefresh();
}, // },
text: "保存", // text: "保存",
) // )
], // ],
), // ),
], // ],
), // ),
); // );
}); // });
}, // },
child: Padding( // child: Padding(
padding: EdgeInsets.only(top: 40.w, right: 32.w), // padding: EdgeInsets.only(top: 40.w, right: 32.w),
child: SizedBox( // child: SizedBox(
height: 28.w, // height: 28.w,
width: 120.w, // width: 120.w,
child: Text( // child: Text(
"添加分组", // "添加分组",
style: TextStyle( // style: TextStyle(
color: BaseStyle.color333333, fontSize: 28.sp), // color: BaseStyle.color333333, fontSize: 28.sp),
), // ),
))) // )))
], // ],
leading: const CloudBackButton(isSpecial: true), // leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor), // backgroundColor: kForeGroundColor),
backgroundColor: Colors.white, // backgroundColor: Colors.white,
body: EasyRefresh( // body: EasyRefresh(
firstRefresh: true, // firstRefresh: true,
header: MaterialHeader(), // header: MaterialHeader(),
controller: _easyRefreshController, // controller: _easyRefreshController,
onRefresh: () async { // onRefresh: () async {
// UserTool.phoneNumProvider.init(); // // UserTool.phoneNumProvider.init();
// massList=HiveStore.dataBox?.get("ml"); // // massList=HiveStore.dataBox?.get("ml");
// massList=HiveStore.dataBox?.get("ml").cast<PhoneModel>(); // // massList=HiveStore.dataBox?.get("ml").cast<PhoneModel>();
// massList=HiveStore.dataBox?.get("ml").cast<List<PhoneModel>>(); // // massList=HiveStore.dataBox?.get("ml").cast<List<PhoneModel>>();
setState(() {}); // setState(() {});
}, // },
child: ListView.builder( // child: ListView.builder(
itemBuilder: (context, index) { // itemBuilder: (context, index) {
return _getBox( // return _getBox(
massList[index], index, massList[index].phoneList!.length); // massList[index], index, massList[index].phoneList!.length);
}, // },
itemCount: massList.length, // itemCount: massList.length,
), // ),
), // ),
bottomNavigationBar: Padding( // bottomNavigationBar: Padding(
padding: EdgeInsets.only(bottom: 24.w), // padding: EdgeInsets.only(bottom: 24.w),
child: PloneBottom( // child: PloneBottom(
onTap: () { // onTap: () {
widget.number(NumList); // widget.number(NumList);
Get.back(); // Get.back();
}, // },
// border: state, // // border: state,
opacity: 1, // opacity: 1,
text: "确定", // text: "确定",
), // ),
)); // ));
} // }
//
_getBox(PhoneModel item, int index, int num) { // _getBox(PhoneModel item, int index, int num) {
return CheckboxListTile( // return CheckboxListTile(
onChanged: (bool? value) { // onChanged: (bool? value) {
setState(() { // setState(() {
item.state = value!; // item.state = value!;
state=value; // state=value;
if (item.state!) { // if (item.state!) {
item.phoneList?.forEach((element) { // item.phoneList?.forEach((element) {
NumList.add(element.phone ?? ""); // NumList.add(element.phone ?? "");
}); // });
// item.phoneList!.map((e) => NumList.add(e.phone ??"")); // // item.phoneList!.map((e) => NumList.add(e.phone ??""));
} else { // } else {
item.phoneList?.forEach((element) { // item.phoneList?.forEach((element) {
NumList.remove(element.phone ?? ""); // NumList.remove(element.phone ?? "");
}); // });
// item.phoneList!.map((e) => NumList.remove(e.phone ??"")); // // item.phoneList!.map((e) => NumList.remove(e.phone ??""));
// phoneNum3.remove({"phone":num,"remark":name}); // // phoneNum3.remove({"phone":num,"remark":name});
// phoneNum3.remove(ExcludePnModel(phone: num, remark: name)) ; // // phoneNum3.remove(ExcludePnModel(phone: num, remark: name)) ;
} // }
}); // });
}, // },
value: item.state, // value: item.state,
title: GestureDetector( // title: GestureDetector(
onTap: () { // onTap: () {
Navigator.of(context) // Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => // .push(MaterialPageRoute(builder: (_) =>
CallListPage( // CallListPage(
phoneNum: item.phoneList ?? [], // phoneNum: item.phoneList ?? [],
title: item.title ?? "", // title: item.title ?? "",
index: index, // index: index,
))).then((value) => _easyRefreshController.callRefresh()); // ))).then((value) => _easyRefreshController.callRefresh());
print(index); // print(index);
}, // },
child: Text( // child: Text(
"${item.title}($num)", // "${item.title}($num)",
style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold), // style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold),
), // ),
), // ),
subtitle: Row( // subtitle: Row(
children: [ // children: [
Text( // Text(
item.time ?? "", // item.time ?? "",
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
), // ),
// 30.wb, // // 30.wb,
// Text( // // Text(
// item.name == null ? "" : item.name!, // // item.name == null ? "" : item.name!,
// style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), // // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
// ) // // )
], // ],
), // ),
); // );
} // }
} // }

@ -1,234 +1,234 @@
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/hive_store.dart'; // import 'package:project_telephony/utils/hive_store.dart';
//
import '../../base/base_style.dart'; // import '../../base/base_style.dart';
import '../../model/hive/phone_model.dart'; // import '../../model/hive/phone_model.dart';
import '../exclude/exclude_contacts_page.dart'; // import '../exclude/exclude_contacts_page.dart';
import '../exclude/exclude_single_page.dart'; // import '../exclude/exclude_single_page.dart';
import '../widget/plone_back_button.dart'; // import '../widget/plone_back_button.dart';
//
class CallListPage extends StatefulWidget { // class CallListPage extends StatefulWidget {
final String title; // final String title;
final List<PhoneNum> phoneNum; // final List<PhoneNum> phoneNum;
final int index; // final int index;
const CallListPage({Key? key, required this.title, required this.phoneNum,required this.index}) // const CallListPage({Key? key, required this.title, required this.phoneNum,required this.index})
: super(key: key); // : super(key: key);
//
@override // @override
_CallListPageState createState() => _CallListPageState(); // _CallListPageState createState() => _CallListPageState();
} // }
//
class _CallListPageState extends State<CallListPage> { // class _CallListPageState extends State<CallListPage> {
final EasyRefreshController _refreshController = EasyRefreshController(); // final EasyRefreshController _refreshController = EasyRefreshController();
List<PhoneModel> messList = []; // List<PhoneModel> messList = [];
List<PhoneNum> numList = []; // List<PhoneNum> numList = [];
//
@override // @override
void dispose() { // void dispose() {
_refreshController.dispose(); // _refreshController.dispose();
super.dispose(); // super.dispose();
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return Scaffold( // return Scaffold(
resizeToAvoidBottomInset: false, // resizeToAvoidBottomInset: false,
appBar: AppBar( // appBar: AppBar(
centerTitle: true, // centerTitle: true,
elevation: 0, // elevation: 0,
title: Text( // title: Text(
widget.title, // widget.title,
style: TextStyle( // style: TextStyle(
fontSize: BaseStyle.fontSize34, // fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
// titleSpacing: 150.w, // // titleSpacing: 150.w,
leading: const CloudBackButton( // leading: const CloudBackButton(
isSpecial: true, // isSpecial: true,
isSpecials: false, // isSpecials: false,
), // ),
backgroundColor: kForeGroundColor), // backgroundColor: kForeGroundColor),
backgroundColor: Colors.white, // backgroundColor: Colors.white,
body: EasyRefresh( // body: EasyRefresh(
firstRefresh: true, // firstRefresh: true,
controller: _refreshController, // controller: _refreshController,
header: MaterialHeader(), // header: MaterialHeader(),
// footer: MaterialFooter(), // // footer: MaterialFooter(),
onRefresh: () async { // onRefresh: () async {
// await userProvider.updateUserInfo(); // // await userProvider.updateUserInfo();
//
setState(() {}); // setState(() {});
}, // },
child: widget.phoneNum.isEmpty // child: widget.phoneNum.isEmpty
? _getNullList() // ? _getNullList()
: _getNum(widget.phoneNum) // : _getNum(widget.phoneNum)
//
// ListView( // // ListView(
// children: [findList.isEmpty ? _getNullList() : _getNum()], // // children: [findList.isEmpty ? _getNullList() : _getNum()],
// ) // // )
//
), // ),
bottomNavigationBar: Row( // bottomNavigationBar: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ // children: [
62.wb, // 62.wb,
_getBottom("号码添加", const Color(0xFF1890FF), () { // _getBottom("号码添加", const Color(0xFF1890FF), () {
Navigator.of(context) // Navigator.of(context)
.push( // .push(
MaterialPageRoute(builder: (_) => ExcludeSinglePage( qf: true,index: widget.index,)), // MaterialPageRoute(builder: (_) => ExcludeSinglePage( qf: true,index: widget.index,)),
) // )
.then((value) => _refreshController.callRefresh()); // .then((value) => _refreshController.callRefresh());
}, Colors.white, Colors.white, 2, const Color(0xFF1890FF), 58, 24), // }, Colors.white, Colors.white, 2, const Color(0xFF1890FF), 58, 24),
32.wb, // 32.wb,
_getBottom("通讯录中添加", Colors.white, () { // _getBottom("通讯录中添加", Colors.white, () {
Navigator.of(context) // Navigator.of(context)
.push( // .push(
MaterialPageRoute( // MaterialPageRoute(
builder: (_) => ExcludeContactsPage( // builder: (_) => ExcludeContactsPage(
qf: true, // qf: true,
index: widget.index, // index: widget.index,
)), // )),
) // )
.then((val) => _refreshController.callRefresh()); // .then((val) => _refreshController.callRefresh());
}, const Color(0xFF74BCFF), const Color(0xFF1890FF), 0, Colors.white, // }, const Color(0xFF74BCFF), const Color(0xFF1890FF), 0, Colors.white,
96, 24), // 96, 24),
62.wb, // 62.wb,
], // ],
), // ),
); // );
} // }
//
_getBottom(String text, Color textColor, VoidCallback ontap, Color color1, // _getBottom(String text, Color textColor, VoidCallback ontap, Color color1,
Color color2, int border, Color borderColor, int h, int v) { // Color color2, int border, Color borderColor, int h, int v) {
return GestureDetector( // return GestureDetector(
onTap: ontap, // onTap: ontap,
child: Container( // child: Container(
padding: EdgeInsets.symmetric(horizontal: h.w, vertical: v.w), // padding: EdgeInsets.symmetric(horizontal: h.w, vertical: v.w),
margin: EdgeInsets.only(bottom: 32.w), // margin: EdgeInsets.only(bottom: 32.w),
decoration: BoxDecoration( // decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w), // borderRadius: BorderRadius.circular(8.w),
gradient: LinearGradient( // gradient: LinearGradient(
colors: [color1, color2], // colors: [color1, color2],
end: Alignment.centerRight, // end: Alignment.centerRight,
begin: Alignment.centerLeft), // begin: Alignment.centerLeft),
border: Border.all(width: border.w, color: borderColor)), // border: Border.all(width: border.w, color: borderColor)),
child: Text( // child: Text(
text, // text,
style: TextStyle( // style: TextStyle(
fontSize: 28.sp, color: textColor, fontWeight: FontWeight.w500), // fontSize: 28.sp, color: textColor, fontWeight: FontWeight.w500),
), // ),
), // ),
); // );
} // }
//
_getNullList() { // _getNullList() {
return Column( // return Column(
mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center, // // crossAxisAlignment: CrossAxisAlignment.center,
children: [ // children: [
490.hb, // 490.hb,
Image.asset( // Image.asset(
Assets.icons.nullphonelist.path, // Assets.icons.nullphonelist.path,
width: 240.w, // width: 240.w,
height: 212.w, // height: 212.w,
fit: BoxFit.fill, // fit: BoxFit.fill,
), // ),
48.hb, // 48.hb,
Text( // Text(
"这里是空的", // "这里是空的",
style: TextStyle( // style: TextStyle(
color: const Color(0xFF999999), // color: const Color(0xFF999999),
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
fontSize: 36.sp), // fontSize: 36.sp),
), // ),
16.hb, // 16.hb,
Text( // Text(
"还没有添加指定号码", // "还没有添加指定号码",
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp), // style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
), // ),
490.hb, // 490.hb,
], // ],
); // );
} // }
//
_getNum(List<PhoneNum> item) { // _getNum(List<PhoneNum> item) {
return ListView.builder( // return ListView.builder(
itemBuilder: (context, index) { // itemBuilder: (context, index) {
return Container( // return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w), // margin: EdgeInsets.symmetric(horizontal: 16.w),
child: ListTile( // child: ListTile(
onTap: () async {}, // onTap: () async {},
title: Text( // title: Text(
item[index].name ?? "", // item[index].name ?? "",
style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold), // style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold),
), // ),
subtitle: Text( // subtitle: Text(
item[index].phone ?? "", // item[index].phone ?? "",
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
), // ),
trailing: TextButton( // trailing: TextButton(
style: ButtonStyle( // style: ButtonStyle(
side: MaterialStateProperty.all( // side: MaterialStateProperty.all(
BorderSide(width: 2.w, color: const Color(0xFFE8E8E8)))), // BorderSide(width: 2.w, color: const Color(0xFFE8E8E8)))),
onPressed: () async { // onPressed: () async {
// print("123"); // // print("123");
messList = // messList =
await HiveStore.dataBox?.get("ml").cast<PhoneModel>(); // await HiveStore.dataBox?.get("ml").cast<PhoneModel>();
// numList = HiveStore.dataBox?.get("pl").cast<PhoneNum>(); // // numList = HiveStore.dataBox?.get("pl").cast<PhoneNum>();
// print(item[index]); // // print(item[index]);
// messList.removeWhere((element) => (element.phoneList)!.contains(item[index])); // // messList.removeWhere((element) => (element.phoneList)!.contains(item[index]));
// numList.remove(item[index]); // // numList.remove(item[index]);
messList[widget.index].phoneList!.remove(item[index]); // messList[widget.index].phoneList!.remove(item[index]);
HiveStore.dataBox?.put("ml", messList); // HiveStore.dataBox?.put("ml", messList);
print(HiveStore.dataBox?.get("ml")); // print(HiveStore.dataBox?.get("ml"));
_refreshController.callRefresh(); // _refreshController.callRefresh();
// print(HiveStore.dataBox?.get("pl")); // // print(HiveStore.dataBox?.get("pl"));
}, // },
child: Text( // child: Text(
"删除", // "删除",
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color333333), // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color333333),
), // ),
), // ),
), // ),
); // );
//
// CheckboxListTile( // // CheckboxListTile(
// onChanged: (bool? value) { // // onChanged: (bool? value) {
// setState(() { // // setState(() {
// item[index].state = value!; // // item[index].state = value!;
// if (item[index].state!) { // // if (item[index].state!) {
// // phoneNum3.add({"phone":num,"remark":name}); // // // phoneNum3.add({"phone":num,"remark":name});
// // phoneNum3.add((phone: num, remark: name)); // // // phoneNum3.add((phone: num, remark: name));
// } else { // // } else {
// // phoneNum3.remove({"phone":num,"remark":name}); // // // phoneNum3.remove({"phone":num,"remark":name});
// // phoneNum3.remove(ExcludePnModel(phone: num, remark: name)) ; // // // phoneNum3.remove(ExcludePnModel(phone: num, remark: name)) ;
// } // // }
// }); // // });
// }, // // },
// value: item[index].state, // // value: item[index].state,
// title: Text( // // title: Text(
// item[index].name ?? "", // // item[index].name ?? "",
// style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold), // // style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold),
// ), // // ),
// subtitle: Row( // // subtitle: Row(
// children: [ // // children: [
// Text( // // Text(
// item[index].phone ?? "", // // item[index].phone ?? "",
// style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), // // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
// ), // // ),
// // 30.wb, // // // 30.wb,
// // Text( // // // Text(
// // item.name == null ? "" : item.name!, // // // item.name == null ? "" : item.name!,
// // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), // // // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
// // ) // // // )
// ], // // ],
// ), // // ),
// ); // // );
}, // },
itemCount: widget.phoneNum.length, // itemCount: widget.phoneNum.length,
); // );
} // }
} // }

@ -1,280 +1,280 @@
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_sms/flutter_sms.dart'; // import 'package:flutter_sms/flutter_sms.dart';
import 'package:project_telephony/base/base_style.dart'; // import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/TextMe/text_template.dart'; // import 'package:project_telephony/ui/TextMe/text_template.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart'; // import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/toast/cloud_toast.dart'; // import 'package:project_telephony/utils/toast/cloud_toast.dart';
import 'package:velocity_x/velocity_x.dart'; // import 'package:velocity_x/velocity_x.dart';
//
import '../../utils/user_tool.dart'; // import '../../utils/user_tool.dart';
import '../widget/plone_back_button.dart'; // import '../widget/plone_back_button.dart';
import 'address_book.dart'; // import 'address_book.dart';
//
class TextMePage extends StatefulWidget { // class TextMePage extends StatefulWidget {
const TextMePage({Key? key}) : super(key: key); // const TextMePage({Key? key}) : super(key: key);
//
@override // @override
_TextMePageState createState() => _TextMePageState(); // _TextMePageState createState() => _TextMePageState();
} // }
//
class _TextMePageState extends State<TextMePage> { // class _TextMePageState extends State<TextMePage> {
// String contentText = ""; // // String contentText = "";
// String phoneText = ""; // // String phoneText = "";
String signatureText = ""; // String signatureText = "";
late TextEditingController _controller; // late TextEditingController _controller;
late TextEditingController _phoneController; // late TextEditingController _phoneController;
List<String> list = []; // List<String> list = [];
//
@override // @override
void initState() { // void initState() {
_controller = TextEditingController(); // _controller = TextEditingController();
_phoneController = TextEditingController(); // _phoneController = TextEditingController();
_controller.text = ""; // _controller.text = "";
_phoneController.text = ""; // _phoneController.text = "";
/* Future.delayed(const Duration(seconds: 0),(){ // /* Future.delayed(const Duration(seconds: 0),(){
if (UserTool.userProvider.isLogin) { // if (UserTool.userProvider.isLogin) {
_controller = TextEditingController(); // _controller = TextEditingController();
_phoneController = TextEditingController(); // _phoneController = TextEditingController();
_controller.text = ""; // _controller.text = "";
_phoneController.text = ""; // _phoneController.text = "";
} else { // } else {
Get.to(() => const LoginPage()); // Get.to(() => const LoginPage());
} // }
});*/ // });*/
super.initState(); // super.initState();
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return Scaffold( // return Scaffold(
resizeToAvoidBottomInset: false, // resizeToAvoidBottomInset: false,
appBar: AppBar( // appBar: AppBar(
elevation: 0, // elevation: 0,
title: Text( // title: Text(
"群发短信", // "群发短信",
style: TextStyle( // style: TextStyle(
fontSize: BaseStyle.fontSize34, // fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
titleSpacing: 200.w, // titleSpacing: 200.w,
leading: const CloudBackButton( // leading: const CloudBackButton(
isSpecial: true, // isSpecial: true,
isSpecials: false, // isSpecials: false,
), // ),
backgroundColor: kForeGroundColor), // backgroundColor: kForeGroundColor),
backgroundColor: Colors.white, // backgroundColor: Colors.white,
body: ListView( // body: ListView(
children: [ // children: [
_getBox('短信内容', "选择短信模版", () { // _getBox('短信内容', "选择短信模版", () {
Get.to(() => TextTemplate( // Get.to(() => TextTemplate(
callback: (String content) { // callback: (String content) {
_controller.text = content; // _controller.text = content;
}, // },
)); // ));
}, "请输入短信内容...", _controller), // }, "请输入短信内容...", _controller),
32.hb, // 32.hb,
_getBox('收信号码', "通讯录中选择", () { // _getBox('收信号码', "通讯录中选择", () {
_phoneController.text=""; // _phoneController.text="";
Get.to(() => AddressBook( // Get.to(() => AddressBook(
number: (List<String> content) { // number: (List<String> content) {
for (int i = 0; i < content.length; i++) { // for (int i = 0; i < content.length; i++) {
_phoneController.text += "${content[i]},"; // _phoneController.text += "${content[i]},";
} // }
}, // },
)); // ));
}, "请输入收信号码多个号码请用逗号隔开例如136xxxx6666132xxxx8888", _phoneController), // }, "请输入收信号码多个号码请用逗号隔开例如136xxxx6666132xxxx8888", _phoneController),
32.hb, // 32.hb,
_getBox2(), // _getBox2(),
64.hb, // 64.hb,
PloneBottom( // PloneBottom(
onTap: () async { // onTap: () async {
// final Telephony telephony = Telephony.instance; // // final Telephony telephony = Telephony.instance;
if(UserTool.userProvider.userInfo.isVip ==1){ // if(UserTool.userProvider.userInfo.isVip ==1){
if (_controller.text.isEmpty && // if (_controller.text.isEmpty &&
_phoneController.text.isEmpty && // _phoneController.text.isEmpty &&
signatureText.isEmpty) { // signatureText.isEmpty) {
CloudToast.show("内容不可为空"); // CloudToast.show("内容不可为空");
} else { // } else {
print(_controller.text); // print(_controller.text);
print(_phoneController.text); // print(_phoneController.text);
print(signatureText); // print(signatureText);
await sendSMS( // await sendSMS(
message: "$signatureText${_controller.text}", // message: "$signatureText${_controller.text}",
recipients: _phoneController.text.split(","), // recipients: _phoneController.text.split(","),
sendDirect: true); // sendDirect: true);
// print("asd${_phoneController.text.split(",")}"); // // print("asd${_phoneController.text.split(",")}");
// await telephony.sendSms( // // await telephony.sendSms(
// to: "13486828191;13395740386;18815060992;18294841148", // // to: "13486828191;13395740386;18815060992;18294841148",
// message: "$signatureText${_controller.text}" // // message: "$signatureText${_controller.text}"
// ); // // );
CloudToast.show("发送成功"); // CloudToast.show("发送成功");
// Telephony.sendSms(to: phoneNum!, message: idle); // // Telephony.sendSms(to: phoneNum!, message: idle);
} // }
}else{ // }else{
CloudToast.show("您还未开通会员"); // CloudToast.show("您还未开通会员");
} // }
}, // },
border: _controller.text.isEmpty || // border: _controller.text.isEmpty ||
_phoneController.text.isEmpty || // _phoneController.text.isEmpty ||
signatureText.isEmpty, // signatureText.isEmpty,
opacity: _controller.text.isEmpty || // opacity: _controller.text.isEmpty ||
_phoneController.text.isEmpty || // _phoneController.text.isEmpty ||
signatureText.isEmpty // signatureText.isEmpty
? 0.4 // ? 0.4
: 1, // : 1,
text: "发送", // text: "发送",
) // )
], // ],
), // ),
); // );
} // }
//
_getBox(String title, String onTapText, VoidCallback onTap, String hitText, // _getBox(String title, String onTapText, VoidCallback onTap, String hitText,
TextEditingController controller) { // TextEditingController controller) {
return Column( // return Column(
children: [ // children: [
GestureDetector( // GestureDetector(
onTap: onTap, // onTap: onTap,
child: Container( // child: Container(
height: 100.w, // height: 100.w,
margin: EdgeInsets.symmetric(horizontal: 64.w), // margin: EdgeInsets.symmetric(horizontal: 64.w),
child: Row( // child: Row(
children: [ // children: [
Text( // Text(
title, // title,
style: TextStyle( // style: TextStyle(
fontSize: 28.sp, // fontSize: 28.sp,
color: BaseStyle.color999999, // color: BaseStyle.color999999,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
290.wb, // 290.wb,
Text( // Text(
onTapText, // onTapText,
style: TextStyle( // style: TextStyle(
fontSize: 28.sp, color: const Color(0xFF1890FF)), // fontSize: 28.sp, color: const Color(0xFF1890FF)),
), // ),
const Icon( // const Icon(
Icons.keyboard_arrow_right, // Icons.keyboard_arrow_right,
color: Color(0xFF1890FF), // color: Color(0xFF1890FF),
), // ),
], // ],
), // ),
), // ),
), // ),
16.hb, // 16.hb,
Container( // Container(
height: 240.w, // height: 240.w,
decoration: BoxDecoration( // decoration: BoxDecoration(
color: const Color(0xFFF9F9F9), // color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.circular(8.w), // borderRadius: BorderRadius.circular(8.w),
), // ),
padding: EdgeInsets.all(30.w), // padding: EdgeInsets.all(30.w),
margin: EdgeInsets.symmetric( // margin: EdgeInsets.symmetric(
horizontal: 64.w, // horizontal: 64.w,
), // ),
child: TextField( // child: TextField(
// focusNode: verifyNode, // // focusNode: verifyNode,
maxLines: 100, // maxLines: 100,
keyboardType: TextInputType.text, // keyboardType: TextInputType.text,
// onChanged: (text) { // // onChanged: (text) {
// if (title == "短信内容") { // // if (title == "短信内容") {
// _controller.text = text; // // _controller.text = text;
// } else { // // } else {
// _phoneController.text = text; // // _phoneController.text = text;
// } // // }
// setState(() {}); // // setState(() {});
// }, // // },
onSubmitted: (text) { // onSubmitted: (text) {
if (title == "短信内容") { // if (title == "短信内容") {
_controller.text = text; // _controller.text = text;
} else { // } else {
_phoneController.text = text; // _phoneController.text = text;
} // }
setState(() {}); // setState(() {});
}, // },
onEditingComplete: () { // onEditingComplete: () {
setState(() {}); // setState(() {});
// _refreshController.callRefresh(); // // _refreshController.callRefresh();
}, // },
style: TextStyle( // style: TextStyle(
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontSize: BaseStyle.fontSize28, // fontSize: BaseStyle.fontSize28,
), // ),
controller: controller, // controller: controller,
decoration: InputDecoration( // decoration: InputDecoration(
contentPadding: EdgeInsets.zero, // contentPadding: EdgeInsets.zero,
filled: true, // filled: true,
isDense: true, // isDense: true,
fillColor: Colors.transparent, // fillColor: Colors.transparent,
hintText: hitText, // hintText: hitText,
hintStyle: TextStyle( // hintStyle: TextStyle(
color: BaseStyle.color999999, // color: BaseStyle.color999999,
fontSize: 28.sp, // fontSize: 28.sp,
), // ),
border: InputBorder.none, // border: InputBorder.none,
), // ),
), // ),
), // ),
], // ],
); // );
} // }
//
_getBox2() { // _getBox2() {
return Container( // return Container(
margin: EdgeInsets.symmetric(horizontal: 64.w), // margin: EdgeInsets.symmetric(horizontal: 64.w),
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
Text( // Text(
"短信签名", // "短信签名",
style: TextStyle( // style: TextStyle(
fontSize: 28.sp, // fontSize: 28.sp,
color: const Color(0xFF999999), // color: const Color(0xFF999999),
fontWeight: FontWeight.w600, // fontWeight: FontWeight.w600,
), // ),
), // ),
15.heightBox, // 15.heightBox,
TextField( // TextField(
// controller: controller, // // controller: controller,
onChanged: (value) { // onChanged: (value) {
signatureText = value; // signatureText = value;
setState(() {}); // setState(() {});
}, // },
decoration: InputDecoration( // decoration: InputDecoration(
contentPadding: EdgeInsets.all(30.w), // contentPadding: EdgeInsets.all(30.w),
hintText: "请输入短信签名", // hintText: "请输入短信签名",
hintStyle: TextStyle( // hintStyle: TextStyle(
fontSize: 28.sp, // fontSize: 28.sp,
// fontWeight: FontWeight.w600, // // fontWeight: FontWeight.w600,
color: const Color(0xFF999999), // color: const Color(0xFF999999),
), // ),
fillColor: const Color(0xFFF9F9F9), // fillColor: const Color(0xFFF9F9F9),
filled: true, // filled: true,
enabledBorder: const OutlineInputBorder( // enabledBorder: const OutlineInputBorder(
/*边角*/ // /*边角*/
borderRadius: BorderRadius.all( // borderRadius: BorderRadius.all(
Radius.circular(5), //5 // Radius.circular(5), //5
), // ),
borderSide: BorderSide( // borderSide: BorderSide(
color: Colors.white, //线 // color: Colors.white, //线
width: 1, //线2 // width: 1, //线2
), // ),
), // ),
focusedBorder: const OutlineInputBorder( // focusedBorder: const OutlineInputBorder(
borderSide: BorderSide( // borderSide: BorderSide(
color: Colors.white, // // color: Colors.white, //
width: 1, //5 // width: 1, //5
), // ),
borderRadius: BorderRadius.all( // borderRadius: BorderRadius.all(
Radius.circular(5), //30 // Radius.circular(5), //30
), // ),
), // ),
), // ),
), // ),
], // ],
), // ),
); // );
} // }
} // }

@ -1,191 +1,191 @@
import 'package:bot_toast/bot_toast.dart'; // import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; // import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/user_tool.dart'; // import 'package:project_telephony/utils/user_tool.dart';
import 'package:shared_preferences/shared_preferences.dart'; // import 'package:shared_preferences/shared_preferences.dart';
//
import '../../base/base_style.dart'; // import '../../base/base_style.dart';
import '../home/add_sms_page.dart'; // import '../home/add_sms_page.dart';
import '../widget/plone_back_button.dart'; // import '../widget/plone_back_button.dart';
//
typedef TextCallback = Function(String content); // typedef TextCallback = Function(String content);
class TextTemplate extends StatefulWidget { // class TextTemplate extends StatefulWidget {
final TextCallback callback; // final TextCallback callback;
const TextTemplate({Key? key,required this.callback}) : super(key: key); // const TextTemplate({Key? key,required this.callback}) : super(key: key);
//
@override // @override
_TextTemplateState createState() => _TextTemplateState(); // _TextTemplateState createState() => _TextTemplateState();
} // }
//
class _TextTemplateState extends State<TextTemplate> { // class _TextTemplateState extends State<TextTemplate> {
EasyRefreshController refreshController = EasyRefreshController(); // EasyRefreshController refreshController = EasyRefreshController();
//
List<String> textList = []; // List<String> textList = [];
//
@override // @override
void initState() { // void initState() {
addText(); // addText();
super.initState(); // super.initState();
} // }
//
addText() async { // addText() async {
final prefs = await SharedPreferences.getInstance(); // final prefs = await SharedPreferences.getInstance();
if (textList.length == 1) { // if (textList.length == 1) {
prefs.setStringList("dxText", [ // prefs.setStringList("dxText", [
"祝你万事顺心", // "祝你万事顺心",
"欢迎你的来电,祝你生活愉快", // "欢迎你的来电,祝你生活愉快",
"感谢您的来电,我们会尽快处理", // "感谢您的来电,我们会尽快处理",
]); // ]);
} // }
} // }
//
@override // @override
void dispose() { // void dispose() {
// TODO: implement dispose // // TODO: implement dispose
refreshController.dispose(); // refreshController.dispose();
super.dispose(); // super.dispose();
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return Scaffold( // return Scaffold(
resizeToAvoidBottomInset: false, // resizeToAvoidBottomInset: false,
appBar: AppBar( // appBar: AppBar(
elevation: 0, // elevation: 0,
title: Text( // title: Text(
'短信模版', // '短信模版',
style: TextStyle( // style: TextStyle(
fontSize: BaseStyle.fontSize34, // fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
titleSpacing: 162.w, // titleSpacing: 162.w,
leading: const CloudBackButton(isSpecial: true), // leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor), // backgroundColor: kForeGroundColor),
backgroundColor: Colors.white, // backgroundColor: Colors.white,
body: EasyRefresh( // body: EasyRefresh(
firstRefresh: true, // firstRefresh: true,
controller: refreshController, // controller: refreshController,
header: MaterialHeader(), // header: MaterialHeader(),
footer: MaterialFooter(), // footer: MaterialFooter(),
onRefresh: () async { // onRefresh: () async {
final prefs = await SharedPreferences.getInstance(); // final prefs = await SharedPreferences.getInstance();
textList = prefs.getStringList("dxText") ?? []; // textList = prefs.getStringList("dxText") ?? [];
textList.add("自定义短信模版"); // textList.add("自定义短信模版");
setState(() {}); // setState(() {});
}, // },
child: ListView( // child: ListView(
children: [ // children: [
SizedBox( // SizedBox(
height: 1000.w, // height: 1000.w,
child: ListView.builder( // child: ListView.builder(
itemBuilder: (context, index) { // itemBuilder: (context, index) {
return _getListContent(textList[index], index); // return _getListContent(textList[index], index);
}, // },
itemCount: textList.length, // itemCount: textList.length,
)) // ))
], // ],
), // ),
), // ),
); // );
} // }
//
_getListContent(String item, int index) { // _getListContent(String item, int index) {
return GestureDetector( // return GestureDetector(
onTap: () async { // onTap: () async {
if (item != "自定义短信模版") { // if (item != "自定义短信模版") {
// BotToast.showText(text: item); // // BotToast.showText(text: item);
widget.callback(item); // widget.callback(item);
Get.back(); // Get.back();
} else { // } else {
if (UserTool.userProvider.userInfo.isVip == 1) { // if (UserTool.userProvider.userInfo.isVip == 1) {
if (textList.length > 5) { // if (textList.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信'); // BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else { // } else {
Navigator.of(context) // Navigator.of(context)
.push( // .push(
MaterialPageRoute( // MaterialPageRoute(
builder: (_) => AddSmsPage(status: 0, ploneBack: (String textContent) { },qfBool: true,)), // builder: (_) => AddSmsPage(status: 0, ploneBack: (String textContent) { },qfBool: true,)),
) // )
.then((val) =>refreshController.callRefresh()); // .then((val) =>refreshController.callRefresh());
// textList.add("value"); // // textList.add("value");
// await prefs.setStringList("dxTExt", textList); // // await prefs.setStringList("dxTExt", textList);
} // }
} else { // } else {
BotToast.showText(text: '请先开通会员'); // BotToast.showText(text: '请先开通会员');
} // }
} // }
setState(() {}); // setState(() {});
}, // },
onLongPress: () { // onLongPress: () {
if (item != "自定义短信模版") { // if (item != "自定义短信模版") {
if (textList.length == 3) { // if (textList.length == 3) {
BotToast.showText(text: '内容不可删除'); // BotToast.showText(text: '内容不可删除');
} else { // } else {
showDialog( // showDialog(
context: context, // context: context,
builder: (context) { // builder: (context) {
return CupertinoAlertDialog( // return CupertinoAlertDialog(
title: const Text("删除短信模板"), // title: const Text("删除短信模板"),
content: Column( // content: Column(
children: [ // children: [
SizedBox( // SizedBox(
height: 10.w, // height: 10.w,
), // ),
const Align( // const Align(
child: Text("你确定要删除这个短信模版吗,删除之后无法还原。"), // child: Text("你确定要删除这个短信模版吗,删除之后无法还原。"),
) // )
], // ],
), // ),
actions: [ // actions: [
CupertinoDialogAction( // CupertinoDialogAction(
textStyle: const TextStyle(color: Color(0xFF999999)), // textStyle: const TextStyle(color: Color(0xFF999999)),
onPressed: () { // onPressed: () {
Navigator.pop(context); // Navigator.pop(context);
}, // },
child: const Text("取消"), // child: const Text("取消"),
), // ),
CupertinoDialogAction( // CupertinoDialogAction(
child: const Text("确定"), // child: const Text("确定"),
onPressed: () async { // onPressed: () async {
final prefs = await SharedPreferences.getInstance(); // final prefs = await SharedPreferences.getInstance();
textList.remove(item[index]); // textList.remove(item[index]);
await prefs.setStringList("dxIndex", textList); // await prefs.setStringList("dxIndex", textList);
refreshController.callRefresh(); // refreshController.callRefresh();
}, // },
), // ),
], // ],
); // );
}); // });
} // }
} // }
setState(() {}); // setState(() {});
}, // },
child: Container( // child: Container(
// width: 686.w, // // width: 686.w,
height: 128.w, // height: 128.w,
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w), // margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.only(left: 40.w, top: 45.w), // padding: EdgeInsets.only(left: 40.w, top: 45.w),
decoration: BoxDecoration( // decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w), // borderRadius: BorderRadius.circular(16.w),
gradient: const LinearGradient( // gradient: const LinearGradient(
begin: Alignment.centerLeft, // begin: Alignment.centerLeft,
end: Alignment.centerRight, // end: Alignment.centerRight,
colors: [ // colors: [
Color(0xFFF9F9F9), // Color(0xFFF9F9F9),
Color(0xFFF9F9F9), // Color(0xFFF9F9F9),
]), // ]),
), // ),
child: Text( // child: Text(
item, // item,
style: TextStyle( // style: TextStyle(
fontSize: BaseStyle.fontSize28, // fontSize: BaseStyle.fontSize28,
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
), // ),
); // );
} // }
} // }

@ -1,134 +1,134 @@
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; // import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; // import 'package:get/get.dart';
import 'package:provider/provider.dart'; // import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart'; // import 'package:shared_preferences/shared_preferences.dart';
//
import '../../base/base_style.dart'; // import '../../base/base_style.dart';
import '../../constants/api.dart'; // import '../../constants/api.dart';
import '../../model/network/api_client.dart'; // import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart'; // import '../../model/network/base_model.dart';
import '../../providers/user_provider.dart'; // import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; // import '../../utils/toast/cloud_toast.dart';
import '../user/content_details_page.dart'; // import '../user/content_details_page.dart';
import '../widget/plone_back_button.dart'; // import '../widget/plone_back_button.dart';
import '../widget/plone_bottom.dart'; // import '../widget/plone_bottom.dart';
//
class AddSmsPage extends StatefulWidget { // class AddSmsPage extends StatefulWidget {
final int status; // final int status;
final TextCallback ploneBack; // final TextCallback ploneBack;
final bool qfBool; // final bool qfBool;
const AddSmsPage({Key? key, required this.status, required this.ploneBack,this.qfBool=false}) : super(key: key); // const AddSmsPage({Key? key, required this.status, required this.ploneBack,this.qfBool=false}) : super(key: key);
//
@override // @override
_AddSmsPageState createState() => _AddSmsPageState(); // _AddSmsPageState createState() => _AddSmsPageState();
} // }
//
class _AddSmsPageState extends State<AddSmsPage> { // class _AddSmsPageState extends State<AddSmsPage> {
late TextEditingController _controller; // late TextEditingController _controller;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); // final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
String contant=""; // String contant="";
//
//
@override // @override
void initState() { // void initState() {
super.initState(); // super.initState();
_controller = TextEditingController(); // _controller = TextEditingController();
} // }
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); // // final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return Scaffold( // return Scaffold(
resizeToAvoidBottomInset: false, // resizeToAvoidBottomInset: false,
appBar: AppBar( // appBar: AppBar(
elevation: 0, // elevation: 0,
title: Text( // title: Text(
'编辑短信标签', // '编辑短信标签',
style: TextStyle( // style: TextStyle(
fontSize: BaseStyle.fontSize34, // fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
titleSpacing: 162.w, // titleSpacing: 162.w,
leading: const CloudBackButton(isSpecial: true), // leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor), // backgroundColor: kForeGroundColor),
backgroundColor: Colors.white, // backgroundColor: Colors.white,
body: Align( // body: Align(
alignment: Alignment.topCenter, // alignment: Alignment.topCenter,
child: Container( // child: Container(
height: 800.w, // height: 800.w,
decoration: BoxDecoration( // decoration: BoxDecoration(
color: const Color(0xFFF9F9F9), // color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.circular(16.w), // borderRadius: BorderRadius.circular(16.w),
), // ),
padding: EdgeInsets.all(30.w), // padding: EdgeInsets.all(30.w),
margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w), // margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w),
child: TextField( // child: TextField(
maxLines: 100, // maxLines: 100,
keyboardType: TextInputType.text, // keyboardType: TextInputType.text,
onEditingComplete: () { // onEditingComplete: () {
setState(() {}); // setState(() {});
// _refreshController.callRefresh(); // // _refreshController.callRefresh();
}, // },
style: TextStyle( // style: TextStyle(
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontSize: BaseStyle.fontSize28, // fontSize: BaseStyle.fontSize28,
), // ),
onChanged: (text) async{ // onChanged: (text) async{
contant=text; // contant=text;
setState((){}); // setState((){});
}, // },
controller: _controller, // controller: _controller,
decoration: const InputDecoration( // decoration: const InputDecoration(
fillColor: Colors.transparent, // fillColor: Colors.transparent,
contentPadding: EdgeInsets.zero, // contentPadding: EdgeInsets.zero,
filled: true, // filled: true,
isDense: true, // isDense: true,
hintText: "请输入所需短信标签", // hintText: "请输入所需短信标签",
border: InputBorder.none, // border: InputBorder.none,
), // ),
), // ),
), // ),
), // ),
bottomNavigationBar: PloneBottom( // bottomNavigationBar: PloneBottom(
border: _controller.text.isEmpty, // border: _controller.text.isEmpty,
opacity: contant.isEmpty ? 0.4 : 1, // opacity: contant.isEmpty ? 0.4 : 1,
onTap: () async { // onTap: () async {
final prefs = await SharedPreferences.getInstance(); // final prefs = await SharedPreferences.getInstance();
List<String>? contentList=prefs.getStringList("dxText"); // List<String>? contentList=prefs.getStringList("dxText");
if(widget.qfBool){ // if(widget.qfBool){
contentList?.add(contant); // contentList?.add(contant);
await prefs.setStringList("dxText", contentList!); // await prefs.setStringList("dxText", contentList!);
Get.back(); // Get.back();
}else{ // }else{
BaseModel res = await apiClient.request(API.content.content, data: { // BaseModel res = await apiClient.request(API.content.content, data: {
'content': _controller.text, // 'content': _controller.text,
'status': widget.status, // 'status': widget.status,
}); // });
if (res.code == 0) { // if (res.code == 0) {
setState(() {}); // setState(() {});
widget.ploneBack(_controller.text); // widget.ploneBack(_controller.text);
switch (widget.status) { // switch (widget.status) {
case 1: // case 1:
await userProvider.updateConSms(); // await userProvider.updateConSms();
break; // break;
case 2: // case 2:
await userProvider.updateRefSms(); // await userProvider.updateRefSms();
break; // break;
case 3: // case 3:
await userProvider.updateCallSms(); // await userProvider.updateCallSms();
break; // break;
case 4: // case 4:
await userProvider.updateIdleSms(); // await userProvider.updateIdleSms();
break; // break;
} // }
} else { // } else {
CloudToast.show(res.msg); // CloudToast.show(res.msg);
} // }
Get.back();} // Get.back();}
}, // },
text: "保存", // text: "保存",
).paddingOnly(bottom: 30.w), // ).paddingOnly(bottom: 30.w),
); // );
} // }
} // }

@ -1,279 +1,279 @@
import 'package:bot_toast/bot_toast.dart'; // import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:provider/provider.dart'; // import 'package:provider/provider.dart';
//
import '../../base/base_style.dart'; // import '../../base/base_style.dart';
import '../../constants/api.dart'; // import '../../constants/api.dart';
import '../../model/contant_list_model.dart'; // import '../../model/contant_list_model.dart';
import '../../model/network/api_client.dart'; // import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart'; // import '../../model/network/base_model.dart';
import '../../model/sms_content_model.dart'; // import '../../model/sms_content_model.dart';
import '../../providers/user_provider.dart'; // import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; // import '../../utils/toast/cloud_toast.dart';
import '../widget/centertipsalterwidget.dart'; // import '../widget/centertipsalterwidget.dart';
import 'add_sms_page.dart'; // import 'add_sms_page.dart';
//
class AnswerIdleList extends StatefulWidget { // class AnswerIdleList extends StatefulWidget {
final EasyRefreshController refreshController; // final EasyRefreshController refreshController;
final bool isIdle; // final bool isIdle;
final int num; // final int num;
//
const AnswerIdleList( // const AnswerIdleList(
{Key? key, required this.refreshController, required this.isIdle,required this.num}) // {Key? key, required this.refreshController, required this.isIdle,required this.num})
: super(key: key); // : super(key: key);
//
@override // @override
_AnswerIdleListState createState() => _AnswerIdleListState(); // _AnswerIdleListState createState() => _AnswerIdleListState();
} // }
//
class _AnswerIdleListState extends State<AnswerIdleList> // class _AnswerIdleListState extends State<AnswerIdleList>
with AutomaticKeepAliveClientMixin { // with AutomaticKeepAliveClientMixin {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); // final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容']; // List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容'];
List<SmsContentModel> _model = []; // List<SmsContentModel> _model = [];
List<ContantListModel> answerList=[]; // List<ContantListModel> answerList=[];
List<String> textListSMS = []; // List<String> textListSMS = [];
List<int> smsIdList = []; // List<int> smsIdList = [];
int isCheck = 0; // int isCheck = 0;
bool val = true; // bool val = true;
//
// final EasyRefreshController _easyRefreshController = EasyRefreshController(); // // final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return Column( // return Column(
children: [ // children: [
_getText(), // _getText(),
32.hb, // 32.hb,
widget.isIdle // widget.isIdle
? val // ? val
? Expanded( // ? Expanded(
// width: 662.w, // // width: 662.w,
// height: 800.w, // // height: 800.w,
child: EasyRefresh.custom( // child: EasyRefresh.custom(
firstRefresh: true, // firstRefresh: true,
controller: widget.refreshController, // controller: widget.refreshController,
header: MaterialHeader(), // header: MaterialHeader(),
// footer: MaterialFooter(), // // footer: MaterialFooter(),
onRefresh: () async { // onRefresh: () async {
await userProvider.updateUserInfo(); // await userProvider.updateUserInfo();
print("这是数据$answerList"); // print("这是数据$answerList");
// userProvider.updateRefSms(); // // userProvider.updateRefSms();
// updateList(); // // updateList();
setState(() {}); // setState(() {});
}, // },
slivers: [ // slivers: [
SliverList( // SliverList(
delegate: // delegate:
SliverChildBuilderDelegate((context, index) { // SliverChildBuilderDelegate((context, index) {
return _getBox(answerList[index], index); // return _getBox(answerList[index], index);
}, childCount: answerList.length)), // }, childCount: answerList.length)),
])) // ]))
: _getEmptyList() // : _getEmptyList()
: Expanded( // : Expanded(
// width: 662.w, // // width: 662.w,
// height: 800.w, // // height: 800.w,
child: EasyRefresh.custom( // child: EasyRefresh.custom(
firstRefresh: true, // firstRefresh: true,
controller: widget.refreshController, // controller: widget.refreshController,
header: MaterialHeader(), // header: MaterialHeader(),
// footer: MaterialFooter(), // // footer: MaterialFooter(),
onRefresh: () async { // onRefresh: () async {
await userProvider.updateUserInfo(); // await userProvider.updateUserInfo();
print("这是数据$answerList"); // print("这是数据$answerList");
// userProvider.updateRefSms(); // // userProvider.updateRefSms();
// updateList(); // // updateList();
setState(() {}); // setState(() {});
}, // },
slivers: [ // slivers: [
SliverList( // SliverList(
delegate: // delegate:
SliverChildBuilderDelegate((context, index) { // SliverChildBuilderDelegate((context, index) {
return _getBox(answerList[index], index); // return _getBox(answerList[index], index);
}, childCount: answerList.length)) // }, childCount: answerList.length))
])) // ]))
], // ],
); // );
} // }
//
updateList() async { // updateList() async {
if (userProvider.isLogin) { // if (userProvider.isLogin) {
// textListSMS.clear(); // // textListSMS.clear();
// smsIdList.clear(); // // smsIdList.clear();
int i = 0; // int i = 0;
// contentRef // // contentRef
var base = await apiClient.request(API.content.findByStatus, data: {'status': 1}); // var base = await apiClient.request(API.content.findByStatus, data: {'status': 1});
if (base.code == 0) { // if (base.code == 0) {
_model=(base.data as List) // _model=(base.data as List)
.map((e) => SmsContentModel.fromJson(e)) // .map((e) => SmsContentModel.fromJson(e))
.toList(); // .toList();
} else { // } else {
CloudToast.show(base.msg); // CloudToast.show(base.msg);
} // }
for (var model in _model) { // for (var model in _model) {
textListSMS.add(model.content); // textListSMS.add(model.content);
smsIdList.add(model.id); // smsIdList.add(model.id);
if (model.isChecked == 1) { // if (model.isChecked == 1) {
isCheck = i; // isCheck = i;
} // }
i++; // i++;
} // }
textListSMS.add("自定义短信内容"); // textListSMS.add("自定义短信内容");
} else { // } else {
textListSMS = textList; // textListSMS = textList;
} // }
} // }
//
_getText() { // _getText() {
return Container( // return Container(
height: 128.w, // height: 128.w,
// margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w), // // margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.only(left: 40.w, top: 45.w), // padding: EdgeInsets.only(left: 40.w, top: 45.w),
child: ListTile( // child: ListTile(
title: Text( // title: Text(
"功能讲解", // "功能讲解",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp), // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp),
), // ),
subtitle: Text( // subtitle: Text(
widget.isIdle // widget.isIdle
? "您给朋友去电接听后所发送的短信":"朋友给你来电接听后所发送的短信", // ? "您给朋友去电接听后所发送的短信":"朋友给你来电接听后所发送的短信",
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp), // style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
), // ),
trailing: widget.isIdle // trailing: widget.isIdle
? Switch( // ? Switch(
value: val, // value: val,
onChanged: (value) async { // onChanged: (value) async {
// if(!value){ // // if(!value){
// // //
// } // // }
// await prefs.setBool("kg", value); // // await prefs.setBool("kg", value);
// print("这是数据${prefs.getBool("kg")}"); // // print("这是数据${prefs.getBool("kg")}");
setState(() { // setState(() {
val = value; // val = value;
}); // });
}) // })
: const SizedBox()), // : const SizedBox()),
); // );
} // }
//
_getBox(ContantListModel item,int index) { // _getBox(ContantListModel item,int index) {
return GestureDetector( // return GestureDetector(
onTap: () async { // onTap: () async {
if (item.content != "自定义短信内容") { // if (item.content != "自定义短信内容") {
BaseModel res = await apiClient.request(API.content.checked, // BaseModel res = await apiClient.request(API.content.checked,
data: {'id': item.id, 'status': 1}); // data: {'id': item.id, 'status': 1});
if (res.code == 0) { // if (res.code == 0) {
setState(() {}); // setState(() {});
userProvider.updateUserInfo(); // userProvider.updateUserInfo();
userProvider.updateConSms(); // userProvider.updateConSms();
widget.refreshController.callRefresh(); // widget.refreshController.callRefresh();
} else { // } else {
CloudToast.show(res.msg); // CloudToast.show(res.msg);
} // }
} else { // } else {
if (userProvider.userInfo.isVip == 1) { // if (userProvider.userInfo.isVip == 1) {
if (answerList.length > 5) { // if (answerList.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信'); // BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else { // } else {
Get.to(AddSmsPage( // Get.to(AddSmsPage(
status: 1, // status: 1,
ploneBack: (String textContent) { // ploneBack: (String textContent) {
widget.refreshController.callRefresh(); // widget.refreshController.callRefresh();
}, // },
)); // ));
} // }
} else { // } else {
BotToast.showText(text: '请先开通会员'); // BotToast.showText(text: '请先开通会员');
} // }
} // }
setState(() {}); // setState(() {});
}, // },
onLongPress: () { // onLongPress: () {
if (item.content != "自定义短信内容") { // if (item.content != "自定义短信内容") {
if (answerList.length == 2 || isCheck == index) { // if (answerList.length == 2 || isCheck == index) {
if (answerList.length == 2) { // if (answerList.length == 2) {
BotToast.showText(text: '最后一条内容不可删除'); // BotToast.showText(text: '最后一条内容不可删除');
} else if (isCheck == index) { // } else if (isCheck == index) {
BotToast.showText(text: '当前为选中内容,不可删除'); // BotToast.showText(text: '当前为选中内容,不可删除');
} // }
} else { // } else {
showDialog( // showDialog(
context: context, // context: context,
builder: (context) { // builder: (context) {
return Centertipsalterwidget( // return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。', // desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板', // title: '删除短信模板',
id: item.id, // id: item.id,
callback: (bool status) { // callback: (bool status) {
widget.refreshController.callRefresh(); // widget.refreshController.callRefresh();
}, // },
); // );
}); // });
} // }
} // }
setState(() {}); // setState(() {});
}, // },
child: Container( // child: Container(
// width: 686.w, // // width: 686.w,
height: 128.w, // height: 128.w,
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w), // margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.only(left: 40.w, top: 45.w), // padding: EdgeInsets.only(left: 40.w, top: 45.w),
decoration: BoxDecoration( // decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), // borderRadius: BorderRadius.circular(16),
gradient: LinearGradient( // gradient: LinearGradient(
begin: Alignment.centerLeft, // begin: Alignment.centerLeft,
end: Alignment.centerRight, // end: Alignment.centerRight,
colors: [ // colors: [
index == isCheck // index == isCheck
? const Color(0xFF1890FF) // ? const Color(0xFF1890FF)
: const Color(0xFFF9F9F9), // : const Color(0xFFF9F9F9),
index == isCheck // index == isCheck
? const Color(0xFF74BCFF) // ? const Color(0xFF74BCFF)
: const Color(0xFFF9F9F9), // : const Color(0xFFF9F9F9),
]), // ]),
), // ),
child: Text( // child: Text(
item.content, // item.content,
style: TextStyle( // style: TextStyle(
fontSize: BaseStyle.fontSize28, // fontSize: BaseStyle.fontSize28,
color: index == isCheck // color: index == isCheck
? const Color(0xFFF9F9F9) // ? const Color(0xFFF9F9F9)
: BaseStyle.color333333, // : BaseStyle.color333333,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
), // ),
); // );
} // }
//
_getEmptyList() { // _getEmptyList() {
return Column( // return Column(
crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
children: [ // children: [
234.hb, // 234.hb,
Image.asset( // Image.asset(
Assets.images.emptylist.path, // Assets.images.emptylist.path,
width: 240.w, // width: 240.w,
height: 212.w, // height: 212.w,
fit: BoxFit.fill, // fit: BoxFit.fill,
), // ),
48.hb, // 48.hb,
Text( // Text(
"功能已关闭", // "功能已关闭",
style: TextStyle( // style: TextStyle(
color: const Color(0xFF999999), // color: const Color(0xFF999999),
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
fontSize: 36.sp), // fontSize: 36.sp),
), // ),
16.hb, // 16.hb,
Text( // Text(
"去电接听后将不会发送短信", // "去电接听后将不会发送短信",
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp), // style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
), // ),
], // ],
); // );
} // }
//
@override // @override
bool get wantKeepAlive => true; // bool get wantKeepAlive => true;
} // }

@ -3,23 +3,15 @@ import 'dart:ui';
import 'package:call_log/call_log.dart'; import 'package:call_log/call_log.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:telephony/telephony.dart'; import 'package:telephony/telephony.dart';
Future<void> initializeService() async { Future<void> initializeService() async {
// SharedPreferences preferences = await SharedPreferences.getInstance(); SharedPreferences.getInstance();
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
await service.configure( await service.configure(
androidConfiguration: AndroidConfiguration(
// this will be executed when app is in foreground or background in separated isolate
onStart: onStart,
// auto start service
autoStart: true,
isForegroundMode: true,
),
iosConfiguration: IosConfiguration( iosConfiguration: IosConfiguration(
// auto start service // auto start service
autoStart: true, autoStart: true,
@ -28,10 +20,16 @@ Future<void> initializeService() async {
// you have to enable background fetch capability on xcode project // you have to enable background fetch capability on xcode project
onBackground: onIosBackground, onBackground: onIosBackground,
), ),
androidConfiguration: AndroidConfiguration(
// this will be executed when app is in foreground or background in separated isolate
onStart: onStart,
// auto start service
autoStart: true,
isForegroundMode: true,
),
); );
service.startService(); service.startService();
} }
// }
bool onIosBackground(ServiceInstance service) { bool onIosBackground(ServiceInstance service) {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -41,162 +39,76 @@ bool onIosBackground(ServiceInstance service) {
void onStart(ServiceInstance service) async { void onStart(ServiceInstance service) async {
DartPluginRegistrant.ensureInitialized(); DartPluginRegistrant.ensureInitialized();
service.on("stopService").listen((event) {
service.stopSelf();
});
//
int flag = 0; int flag = 0;
String? phoneNum = ""; String? phoneNum = "";
String callState; String callState;
service.on('stopService').listen((event) {
service.stopSelf();
});
Timer.periodic(const Duration(seconds: 1), (timer) async { Timer.periodic(const Duration(seconds: 1), (timer) async {
//
final SharedPreferences prefs = await SharedPreferences.getInstance(); final SharedPreferences prefs = await SharedPreferences.getInstance();
//
CallState state = await Telephony.instance.callState; CallState state = await Telephony.instance.callState;
callState = state.name; callState = state.name;
// print("$callState$flag"); //
// print(entry.first.duration); String content = prefs.getString("refSms")!;
String? ref = prefs.getString('refSms'); //
String? con = prefs.getString('conSms');
String? call = prefs.getString('callSms');
String? idle = prefs.getString('idleSms');
bool? callSw = prefs.getBool('callSwitch') ?? true;
bool? idleSw = prefs.getBool('idleSwitch') ?? true;
int? numberSet = prefs.getInt("numIndex") ?? 0; int? numberSet = prefs.getInt("numIndex") ?? 0;
List<String>? numberList = prefs.getStringList("addressList") ??[] ; print("号码设置$numberSet 发送内容$content");
List<String>? noNumberList = prefs.getStringList("specified") ??[];
print("号码设置$numberSet 通讯列表$numberList 指定不发送$noNumberList");
if (callState == "IDLE") { if (callState == "IDLE") {
if (flag != 0) { if (flag != 0) {
final Iterable<CallLogEntry> entry = await CallLog.query(); final Iterable<CallLogEntry> entry = await CallLog.query();
phoneNum = entry.first.number; phoneNum = entry.first.number;
print(phoneNum); // print(phoneNum);
// if()
switch (numberSet) { switch (numberSet) {
case 0: case 0:
if (!(noNumberList.contains(phoneNum))) { print("所有都发");
if (flag > 0) { // Telephony.backgroundInstance
// print("来电拒接/未接"); // .sendSms(to: phoneNum!, message: content);
// print("${phoneNum!}:${ref!}"); flag = 0;
Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: ref!);
// print("发送成功");
} else if (flag == -1) {
print("来电接听");
print("${phoneNum!}:${con!}");
Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: con);
} else {
if (entry.first.duration! > 0) {
if (callSw) {
print(callSw);
print("${phoneNum!}:${call!}");
Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: call);
}
print("去电接听");
} else {
if (idleSw) {
print(idleSw);
print("${phoneNum!}:${idle!}");
Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: idle);
}
print("去电未接");
}
print("发送成功");
}
flag = 0;
}else{
print("123412434124132312232341241242321312312323123323");
}
break; break;
case 1: case 1:
if ((numberList.contains(phoneNum)) && if (flag > 0) {
!(noNumberList.contains(phoneNum))) { print("来电拒接");
if (flag > 0) { // print("来电拒接/未接");
print("来电拒接/未接"); // print("${phoneNum!}:${ref!}");
print("${phoneNum!}:${ref!}"); // Telephony.backgroundInstance
Telephony.backgroundInstance // .sendSms(to: phoneNum!, message: content);
.sendSms(to: phoneNum!, message: ref); // print("发送成功");
print("发送成功"); } else if (flag == -1) {
} else if (flag == -1) { print("来电接听");
print("来电接听"); // print("来电接听");
print("${phoneNum!}:${con!}"); // print("${phoneNum!}:$content");
Telephony.backgroundInstance // Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: con); // .sendSms(to: phoneNum!, message: content);
} else {
if (entry.first.duration! > 0) {
if (callSw) {
print(callSw);
print("${phoneNum!}:${call!}");
Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: call);
}
print("去电接听");
} else {
if (idleSw) {
print(idleSw);
print("${phoneNum!}:${idle!}");
Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: idle);
}
print("去电未接");
}
print("发送成功");
}
flag = 0;
}else{
print("123412434124132312232341241242321312312323123323");
} }
flag = 0;
break; break;
case 2: case 2:
if (!(numberList.contains(phoneNum)) && if (entry.first.duration! > 0) {
!(noNumberList.contains(phoneNum))) { print("去电接听");
if (flag > 0) { // print("${phoneNum!}:$content");
print("来电拒接/未接"); // Telephony.backgroundInstance
print("${phoneNum!}:${ref!}"); // .sendSms(to: phoneNum!, message: content);
Telephony.backgroundInstance } else {
.sendSms(to: phoneNum!, message: ref); print("去电挂断");
print("发送成功"); // print("${phoneNum!}:$content");
} else if (flag == -1) { // Telephony.backgroundInstance
print("来电接听"); // .sendSms(to: phoneNum!, message: content);
print("${phoneNum!}:${con!}");
Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: con);
} else {
if (entry.first.duration! > 0) {
if (callSw) {
print(callSw);
print("${phoneNum!}:${call!}");
Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: call);
}
print("去电接听");
} else {
if (idleSw) {
print(idleSw);
print("${phoneNum!}:${idle!}");
Telephony.backgroundInstance
.sendSms(to: phoneNum!, message: idle);
}
print("去电未接");
}
print("发送成功");
}
flag = 0;
}else{
print("123412434124132312232341241242321312312323123323");
} }
flag = 0;
break; break;
} }
} }
} else if (callState == "RINGING") { } else if (callState == "RINGING") {
//
flag = 1; flag = 1;
print('通话'); print("打印");
} else if (callState == "OFFHOOK") { } else if (callState == "OFFHOOK") {
//
if (flag > 0) flag *= -1; if (flag > 0) flag *= -1;
if (flag == 0) flag = -2; if (flag == 0) flag = -2;
print('不通话'); print("打印");
} }
}); });
} }

@ -1,326 +1,326 @@
import 'package:bot_toast/bot_toast.dart'; // import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:provider/provider.dart'; // import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart'; // import 'package:shared_preferences/shared_preferences.dart';
//
import '../../base/base_style.dart'; // import '../../base/base_style.dart';
import '../../constants/api.dart'; // import '../../constants/api.dart';
import '../../model/network/api_client.dart'; // import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart'; // import '../../model/network/base_model.dart';
import '../../model/sms_content_model.dart'; // import '../../model/sms_content_model.dart';
import '../../providers/user_provider.dart'; // import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; // import '../../utils/toast/cloud_toast.dart';
import '../widget/centertipsalterwidget.dart'; // import '../widget/centertipsalterwidget.dart';
import 'add_sms_page.dart'; // import 'add_sms_page.dart';
import 'home_page.dart'; // import 'home_page.dart';
//
class CallingIdleList extends StatefulWidget { // class CallingIdleList extends StatefulWidget {
final EasyRefreshController refreshController; // final EasyRefreshController refreshController;
final String title; // final String title;
final int status; // final int status;
final String? name; // final String? name;
final Color themeColor; // final Color themeColor;
//
const CallingIdleList({ // const CallingIdleList({
Key? key, // Key? key,
required this.title, // required this.title,
required this.status, // required this.status,
this.name = '', // this.name = '',
required this.themeColor, // required this.themeColor,
required this.refreshController, // required this.refreshController,
}) : super(key: key); // }) : super(key: key);
//
@override // @override
_CallingIdleListState createState() => _CallingIdleListState(); // _CallingIdleListState createState() => _CallingIdleListState();
} // }
//
class _CallingIdleListState extends State<CallingIdleList> // class _CallingIdleListState extends State<CallingIdleList>
with AutomaticKeepAliveClientMixin { // with AutomaticKeepAliveClientMixin {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); // final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance(); // final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容']; // List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容'];
List<SmsContentModel> _model = []; // List<SmsContentModel> _model = [];
List<String> textListSMS = []; // List<String> textListSMS = [];
List<int> smsIdList = []; // List<int> smsIdList = [];
int isCheck = 0; // int isCheck = 0;
late bool val = true; // late bool val = true;
//
@override // @override
void initState() { // void initState() {
super.initState(); // super.initState();
} // }
//
Future<void> getSwitch() async { // Future<void> getSwitch() async {
final SharedPreferences prefs = await _prefs; // final SharedPreferences prefs = await _prefs;
val = prefs.getBool(widget.name!) ?? false; // val = prefs.getBool(widget.name!) ?? false;
//
print(val); // print(val);
} // }
//
Future<void> updateList() async { // Future<void> updateList() async {
if (userProvider.isLogin) { // if (userProvider.isLogin) {
textListSMS.clear(); // textListSMS.clear();
smsIdList.clear(); // smsIdList.clear();
int i = 0; // int i = 0;
var base = await apiClient // var base = await apiClient
.request(API.content.findByStatus, data: {'status': widget.status}); // .request(API.content.findByStatus, data: {'status': widget.status});
if (base.code == 0) { // if (base.code == 0) {
_model = (base.data as List) // _model = (base.data as List)
.map((e) => SmsContentModel.fromJson(e)) // .map((e) => SmsContentModel.fromJson(e))
.toList(); // .toList();
} else { // } else {
CloudToast.show(base.msg); // CloudToast.show(base.msg);
} // }
for (var model in _model) { // for (var model in _model) {
textListSMS.add(model.content); // textListSMS.add(model.content);
smsIdList.add(model.id); // smsIdList.add(model.id);
if (model.isChecked == 1) { // if (model.isChecked == 1) {
isCheck = i; // isCheck = i;
} // }
i++; // i++;
} // }
textListSMS.add("自定义短信内容"); // textListSMS.add("自定义短信内容");
} else { // } else {
textListSMS = textList; // textListSMS = textList;
} // }
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return EasyRefresh( // return EasyRefresh(
firstRefresh: true, // firstRefresh: true,
controller: widget.refreshController, // controller: widget.refreshController,
header: MaterialHeader(), // header: MaterialHeader(),
// footer: MaterialFooter(), // // footer: MaterialFooter(),
onRefresh: () async { // onRefresh: () async {
// await userProvider.updateUserInfo(); // // await userProvider.updateUserInfo();
getSwitch(); // getSwitch();
await updateList(); // await updateList();
setState(() {}); // setState(() {});
}, // },
child: ListView( // child: ListView(
children: [ // children: [
_getText(), // _getText(),
32.hb, // 32.hb,
// _getEmptyList(), // // _getEmptyList(),
widget.name!.isEmpty || val // widget.name!.isEmpty || val
? // ?
SizedBox( // SizedBox(
height: 1000.w, // height: 1000.w,
child: ListView.builder( // child: ListView.builder(
itemBuilder: (context, index) { // itemBuilder: (context, index) {
return _getBox(textListSMS[index], index); // return _getBox(textListSMS[index], index);
}, // },
itemCount: textListSMS.length, // itemCount: textListSMS.length,
)) // ))
: _getEmptyList(), // : _getEmptyList(),
// SliverList( // // SliverList(
// delegate: SliverChildBuilderDelegate((context, index) { // // delegate: SliverChildBuilderDelegate((context, index) {
// return _getBox(textListSMS[index], index); // // return _getBox(textListSMS[index], index);
// }, childCount: textListSMS.length), // // }, childCount: textListSMS.length),
// ), // // ),
], // ],
), // ),
); // );
// Column( // // Column(
// children: [ // // children: [
// _getText(), // // _getText(),
// 32.hb, // // 32.hb,
// widget.name!.isEmpty || val // // widget.name!.isEmpty || val
// ? Expanded( // // ? Expanded(
// child: EasyRefresh.custom( // // child: EasyRefresh.custom(
// firstRefresh: true, // // firstRefresh: true,
// controller: widget.refreshController, // // controller: widget.refreshController,
// header: MaterialHeader(), // // header: MaterialHeader(),
// // footer: MaterialFooter(), // // // footer: MaterialFooter(),
// onRefresh: () async { // // onRefresh: () async {
// // await userProvider.updateUserInfo(); // // // await userProvider.updateUserInfo();
// await updateList(); // // await updateList();
// setState(() {}); // // setState(() {});
// }, // // },
// slivers: [ // // slivers: [
// SliverList( // // SliverList(
// delegate: SliverChildBuilderDelegate((context, index) { // // delegate: SliverChildBuilderDelegate((context, index) {
// return _getBox(textListSMS[index], index); // // return _getBox(textListSMS[index], index);
// }, childCount: textListSMS.length), // // }, childCount: textListSMS.length),
// ), // // ),
// ], // // ],
// ), // // ),
// ) // // )
// : _getEmptyList(), // // : _getEmptyList(),
// ], // // ],
// ); // // );
} // }
_getText() { // _getText() {
return Container( // return Container(
height: 128.w, // height: 128.w,
// width: 622.w, // // width: 622.w,
padding: EdgeInsets.only(left: 40.w, top: 45.w), // padding: EdgeInsets.only(left: 40.w, top: 45.w),
child: ListTile( // child: ListTile(
title: Text( // title: Text(
"功能讲解", // "功能讲解",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp), // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp),
), // ),
subtitle: Text( // subtitle: Text(
widget.title, // widget.title,
style: TextStyle(color: const Color(0xFF999999), fontSize: 27.sp), // style: TextStyle(color: const Color(0xFF999999), fontSize: 27.sp),
), // ),
trailing: Offstage( // trailing: Offstage(
offstage: widget.name!.isEmpty, // offstage: widget.name!.isEmpty,
child: Switch( // child: Switch(
value: val, // value: val,
onChanged: (value) async { // onChanged: (value) async {
final SharedPreferences prefs = await _prefs; // final SharedPreferences prefs = await _prefs;
setState(() { // setState(() {
val = value; // val = value;
prefs.remove(widget.name!); // prefs.remove(widget.name!);
prefs.setBool(widget.name!, val ); // prefs.setBool(widget.name!, val );
}); // });
service.invoke("stopService"); // service.invoke("stopService");
if (prefs.getBool('kg')!) { // if (prefs.getBool('kg')!) {
Future.delayed(const Duration(seconds: 1), () async { // Future.delayed(const Duration(seconds: 1), () async {
service.startService(); // service.startService();
}); // });
} // }
}, // },
), // ),
), // ),
), // ),
); // );
} // }
//
_getBox(String content, int index) { // _getBox(String content, int index) {
return GestureDetector( // return GestureDetector(
onTap: () async { // onTap: () async {
if (content != "自定义短信内容") { // if (content != "自定义短信内容") {
BaseModel res = await apiClient.request(API.content.checked, // BaseModel res = await apiClient.request(API.content.checked,
data: {'id': smsIdList[index], 'status': widget.status}); // data: {'id': smsIdList[index], 'status': widget.status});
if (res.code == 0) { // if (res.code == 0) {
setState(() {}); // setState(() {});
// await userProvider.updateUserInfo(); // // await userProvider.updateUserInfo();
switch (widget.status) { // switch (widget.status) {
case 1: // case 1:
await userProvider.updateConSms(); // await userProvider.updateConSms();
break; // break;
case 2: // case 2:
await userProvider.updateRefSms(); // await userProvider.updateRefSms();
break; // break;
case 3: // case 3:
await userProvider.updateCallSms(); // await userProvider.updateCallSms();
break; // break;
case 4: // case 4:
await userProvider.updateIdleSms(); // await userProvider.updateIdleSms();
break; // break;
} // }
widget.refreshController.callRefresh(); // widget.refreshController.callRefresh();
} else { // } else {
CloudToast.show(res.msg); // CloudToast.show(res.msg);
} // }
} else { // } else {
if (userProvider.userInfo.isVip == 1) { // if (userProvider.userInfo.isVip == 1) {
if (textListSMS.length > 5) { // if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信'); // BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else { // } else {
Get.to( // Get.to(
AddSmsPage( // AddSmsPage(
status: widget.status, // status: widget.status,
ploneBack: (String textContent) { // ploneBack: (String textContent) {
widget.refreshController.callRefresh(); // widget.refreshController.callRefresh();
}, // },
), // ),
); // );
} // }
} else { // } else {
BotToast.showText(text: '请先开通会员'); // BotToast.showText(text: '请先开通会员');
} // }
} // }
setState(() {}); // setState(() {});
}, // },
onLongPress: () { // onLongPress: () {
if (content != "自定义短信内容") { // if (content != "自定义短信内容") {
if (textListSMS.length == 2 || isCheck == index) { // if (textListSMS.length == 2 || isCheck == index) {
if (textListSMS.length == 2) { // if (textListSMS.length == 2) {
BotToast.showText(text: '最后一条内容不可删除'); // BotToast.showText(text: '最后一条内容不可删除');
} else if (isCheck == index) { // } else if (isCheck == index) {
BotToast.showText(text: '当前为选中内容,不可删除'); // BotToast.showText(text: '当前为选中内容,不可删除');
} // }
} else { // } else {
showDialog( // showDialog(
context: context, // context: context,
builder: (context) { // builder: (context) {
return Centertipsalterwidget( // return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。', // desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板', // title: '删除短信模板',
id: smsIdList[index], // id: smsIdList[index],
callback: (bool status) { // callback: (bool status) {
widget.refreshController.callRefresh(); // widget.refreshController.callRefresh();
}, // },
); // );
}); // });
} // }
} // }
setState(() {}); // setState(() {});
}, // },
child: Container( // child: Container(
// width: 686.w, // // width: 686.w,
height: 128.w, // height: 128.w,
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w), // margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.only(left: 40.w, top: 45.w), // padding: EdgeInsets.only(left: 40.w, top: 45.w),
decoration: BoxDecoration( // decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), // borderRadius: BorderRadius.circular(16),
gradient: LinearGradient( // gradient: LinearGradient(
begin: Alignment.centerLeft, // begin: Alignment.centerLeft,
end: Alignment.centerRight, // end: Alignment.centerRight,
colors: [ // colors: [
index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9), // index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9),
index == isCheck // index == isCheck
? widget.themeColor.withOpacity(0.5) // ? widget.themeColor.withOpacity(0.5)
: const Color(0xFFF9F9F9), // : const Color(0xFFF9F9F9),
]), // ]),
), // ),
child: Text( // child: Text(
content, // content,
style: TextStyle( // style: TextStyle(
fontSize: BaseStyle.fontSize28, // fontSize: BaseStyle.fontSize28,
color: index == isCheck // color: index == isCheck
? const Color(0xFFF9F9F9) // ? const Color(0xFFF9F9F9)
: BaseStyle.color333333, // : BaseStyle.color333333,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
), // ),
); // );
} // }
//
_getEmptyList() { // _getEmptyList() {
return Column( // return Column(
crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
children: [ // children: [
234.hb, // 234.hb,
Image.asset( // Image.asset(
Assets.images.emptylist.path, // Assets.images.emptylist.path,
width: 240.w, // width: 240.w,
height: 212.w, // height: 212.w,
fit: BoxFit.fill, // fit: BoxFit.fill,
), // ),
48.hb, // 48.hb,
Text( // Text(
"功能已关闭", // "功能已关闭",
style: TextStyle( // style: TextStyle(
color: const Color(0xFF999999), // color: const Color(0xFF999999),
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
fontSize: 36.sp), // fontSize: 36.sp),
), // ),
16.hb, // 16.hb,
Text( // Text(
"去电拒接/未接后将不会发送短信", // "去电拒接/未接后将不会发送短信",
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp), // style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
), // ),
], // ],
); // );
} // }
//
@override // @override
bool get wantKeepAlive => true; // bool get wantKeepAlive => true;
} // }

@ -1,125 +1,125 @@
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/base/base_style.dart'; // import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/home/calling_idle_list.dart'; // import 'package:project_telephony/ui/home/calling_idle_list.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart'; // import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart'; // import 'package:tab_indicator_styler/tab_indicator_styler.dart';
//
class ContentConnectPage extends StatefulWidget { // class ContentConnectPage extends StatefulWidget {
const ContentConnectPage({Key? key}) : super(key: key); // const ContentConnectPage({Key? key}) : super(key: key);
//
@override // @override
_ContentConnectPageState createState() => _ContentConnectPageState(); // _ContentConnectPageState createState() => _ContentConnectPageState();
} // }
//
class _ContentConnectPageState extends State<ContentConnectPage> // class _ContentConnectPageState extends State<ContentConnectPage>
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin { // with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
late TabController _tabController; // late TabController _tabController;
final EasyRefreshController _answerRefreshController = // final EasyRefreshController _answerRefreshController =
EasyRefreshController(); // EasyRefreshController();
final EasyRefreshController _wasAnswerRefreshController = // final EasyRefreshController _wasAnswerRefreshController =
EasyRefreshController(); // EasyRefreshController();
//
@override // @override
void initState() { // void initState() {
super.initState(); // super.initState();
_tabController = TabController( // _tabController = TabController(
length: 2, // length: 2,
initialIndex: 0, // initialIndex: 0,
vsync: this, // vsync: this,
); // );
} // }
//
@override // @override
void dispose() { // void dispose() {
_tabController.dispose(); // _tabController.dispose();
_answerRefreshController.dispose(); // _answerRefreshController.dispose();
_wasAnswerRefreshController.dispose(); // _wasAnswerRefreshController.dispose();
super.dispose(); // super.dispose();
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
super.build(context); // super.build(context);
return Scaffold( // return Scaffold(
appBar: AppBar( // appBar: AppBar(
elevation: 0, // elevation: 0,
title: Text( // title: Text(
'选择短信内容', // '选择短信内容',
style: Theme.of(context).textTheme.headline6, // style: Theme.of(context).textTheme.headline6,
), // ),
leading: const CloudBackButton(isSpecial: true), // leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor, // backgroundColor: kForeGroundColor,
), // ),
backgroundColor: Colors.white, // backgroundColor: Colors.white,
body: Column( // body: Column(
children: [ // children: [
Container( // Container(
width: double.infinity, // width: double.infinity,
height: 88.w, // height: 88.w,
margin: EdgeInsets.symmetric(horizontal: 66.w), // margin: EdgeInsets.symmetric(horizontal: 66.w),
padding: EdgeInsets.all(8.w), // padding: EdgeInsets.all(8.w),
decoration: BoxDecoration( // decoration: BoxDecoration(
color: const Color(0xFFF9F9F9), // color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.all(Radius.circular(44.w))), // borderRadius: BorderRadius.all(Radius.circular(44.w))),
child: TabBar( // child: TabBar(
controller: _tabController, // controller: _tabController,
labelColor: const Color(0xFF1890FF), // labelColor: const Color(0xFF1890FF),
unselectedLabelColor: const Color(0xFF999999), // unselectedLabelColor: const Color(0xFF999999),
unselectedLabelStyle: // unselectedLabelStyle:
const TextStyle(fontWeight: FontWeight.bold), // const TextStyle(fontWeight: FontWeight.bold),
labelStyle: const TextStyle(fontWeight: FontWeight.bold), // labelStyle: const TextStyle(fontWeight: FontWeight.bold),
onTap: (num) { // onTap: (num) {
if (num == 0) { // if (num == 0) {
_answerRefreshController.callRefresh(); // _answerRefreshController.callRefresh();
} else { // } else {
_wasAnswerRefreshController.callRefresh(); // _wasAnswerRefreshController.callRefresh();
} // }
}, // },
indicator: RectangularIndicator( // indicator: RectangularIndicator(
color: Colors.white, // color: Colors.white,
bottomLeftRadius: 44.w, // bottomLeftRadius: 44.w,
bottomRightRadius: 44.w, // bottomRightRadius: 44.w,
topLeftRadius: 44.w, // topLeftRadius: 44.w,
topRightRadius: 44.w, // topRightRadius: 44.w,
// paintingStyle: PaintingStyle.fill, // // paintingStyle: PaintingStyle.fill,
), // ),
tabs: const [ // tabs: const [
Tab( // Tab(
text: "被叫接听", // text: "被叫接听",
), // ),
Tab( // Tab(
text: "主叫接听", // text: "主叫接听",
), // ),
], // ],
), // ),
), // ),
Expanded( // Expanded(
child: TabBarView( // child: TabBarView(
controller: _tabController, // controller: _tabController,
children: [ // children: [
CallingIdleList( // CallingIdleList(
refreshController: _answerRefreshController, // refreshController: _answerRefreshController,
title: '朋友给你来电接听后所发送的短信', // title: '朋友给你来电接听后所发送的短信',
status: 1, // status: 1,
themeColor: const Color(0xFF1890FF), // themeColor: const Color(0xFF1890FF),
), // ),
CallingIdleList( // CallingIdleList(
refreshController: _answerRefreshController, // refreshController: _answerRefreshController,
name: "callSwitch", // name: "callSwitch",
title: '您给朋友去电接听后所发送的短信', // title: '您给朋友去电接听后所发送的短信',
status: 3, // status: 3,
themeColor: const Color(0xFF1890FF), // themeColor: const Color(0xFF1890FF),
), // ),
], // ],
), // ),
), // ),
], // ],
), // ),
); // );
} // }
//
@override // @override
bool get wantKeepAlive => true; // bool get wantKeepAlive => true;
} // }

@ -1,128 +1,128 @@
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/base/base_style.dart'; // import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart'; // import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:shared_preferences/shared_preferences.dart'; // import 'package:shared_preferences/shared_preferences.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart'; // import 'package:tab_indicator_styler/tab_indicator_styler.dart';
//
import 'calling_idle_list.dart'; // import 'calling_idle_list.dart';
//
class ContentRefusePage extends StatefulWidget { // class ContentRefusePage extends StatefulWidget {
const ContentRefusePage({Key? key}) : super(key: key); // const ContentRefusePage({Key? key}) : super(key: key);
//
@override // @override
_ContentRefusePageState createState() => _ContentRefusePageState(); // _ContentRefusePageState createState() => _ContentRefusePageState();
} // }
//
class _ContentRefusePageState extends State<ContentRefusePage> // class _ContentRefusePageState extends State<ContentRefusePage>
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin { // with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
late TabController _tabController; // late TabController _tabController;
final EasyRefreshController _callingRefreshController = // final EasyRefreshController _callingRefreshController =
EasyRefreshController(); // EasyRefreshController();
final EasyRefreshController _wasCalledRefreshController = // final EasyRefreshController _wasCalledRefreshController =
EasyRefreshController(); // EasyRefreshController();
bool? idleSwitch=true; // bool? idleSwitch=true;
//
@override // @override
void initState() { // void initState() {
_tabController = TabController(length: 2, initialIndex: 0, vsync: this); // _tabController = TabController(length: 2, initialIndex: 0, vsync: this);
getSwitch(); // getSwitch();
super.initState(); // super.initState();
} // }
//
@override // @override
void dispose() { // void dispose() {
_tabController.dispose(); // _tabController.dispose();
_callingRefreshController.dispose(); // _callingRefreshController.dispose();
_wasCalledRefreshController.dispose(); // _wasCalledRefreshController.dispose();
super.dispose(); // super.dispose();
} // }
//
Future<void> getSwitch()async{ // Future<void> getSwitch()async{
final SharedPreferences prefs = await SharedPreferences.getInstance(); // final SharedPreferences prefs = await SharedPreferences.getInstance();
idleSwitch=prefs.getBool("idleSwitch"); // idleSwitch=prefs.getBool("idleSwitch");
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
super.build(context); // super.build(context);
return Scaffold( // return Scaffold(
appBar: AppBar( // appBar: AppBar(
elevation: 0, // elevation: 0,
title: Text( // title: Text(
'选择短信内容', // '选择短信内容',
style: Theme.of(context).textTheme.headline6, // style: Theme.of(context).textTheme.headline6,
), // ),
leading: const CloudBackButton(isSpecial: true), // leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor, // backgroundColor: kForeGroundColor,
), // ),
backgroundColor: Colors.white, // backgroundColor: Colors.white,
body: Column( // body: Column(
children: [ // children: [
Container( // Container(
width: double.infinity, // width: double.infinity,
height: 88.w, // height: 88.w,
margin: EdgeInsets.symmetric(horizontal: 66.w), // margin: EdgeInsets.symmetric(horizontal: 66.w),
padding: EdgeInsets.all(8.w), // padding: EdgeInsets.all(8.w),
decoration: BoxDecoration( // decoration: BoxDecoration(
color: const Color(0xFFF9F9F9), // color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.all(Radius.circular(44.w))), // borderRadius: BorderRadius.all(Radius.circular(44.w))),
child: TabBar( // child: TabBar(
// indicator: Decoration(), // // indicator: Decoration(),
controller: _tabController, // controller: _tabController,
labelColor: const Color(0xFF1890FF), // labelColor: const Color(0xFF1890FF),
unselectedLabelColor: const Color(0xFF999999), // unselectedLabelColor: const Color(0xFF999999),
unselectedLabelStyle: // unselectedLabelStyle:
const TextStyle(fontWeight: FontWeight.bold), // const TextStyle(fontWeight: FontWeight.bold),
labelStyle: const TextStyle(fontWeight: FontWeight.bold), // labelStyle: const TextStyle(fontWeight: FontWeight.bold),
onTap: (num) { // onTap: (num) {
if (num == 0) { // if (num == 0) {
_callingRefreshController.callRefresh(); // _callingRefreshController.callRefresh();
} else { // } else {
_wasCalledRefreshController.callRefresh(); // _wasCalledRefreshController.callRefresh();
} // }
}, // },
indicator: RectangularIndicator( // indicator: RectangularIndicator(
color: Colors.white, // color: Colors.white,
bottomLeftRadius: 44.w, // bottomLeftRadius: 44.w,
bottomRightRadius: 44.w, // bottomRightRadius: 44.w,
topLeftRadius: 44.w, // topLeftRadius: 44.w,
topRightRadius: 44.w, // topRightRadius: 44.w,
), // ),
tabs: const [ // tabs: const [
Tab( // Tab(
text: "被叫拒接/未接", // text: "被叫拒接/未接",
), // ),
Tab( // Tab(
text: "主叫拒接/未接", // text: "主叫拒接/未接",
), // ),
], // ],
), // ),
), // ),
Expanded( // Expanded(
child: TabBarView( // child: TabBarView(
controller: _tabController, // controller: _tabController,
children:[ // children:[
CallingIdleList( // CallingIdleList(
status: 2, // status: 2,
themeColor: const Color(0xFF13CA9D), // themeColor: const Color(0xFF13CA9D),
title: '朋友给你来电接听后所发送的短信', refreshController: _callingRefreshController, // title: '朋友给你来电接听后所发送的短信', refreshController: _callingRefreshController,
), // ),
CallingIdleList( // CallingIdleList(
name: "idleSwitch", // name: "idleSwitch",
status: 4, // status: 4,
title: '您给朋友去电拒接/未接后所发送的短信', // title: '您给朋友去电拒接/未接后所发送的短信',
themeColor: const Color(0xFF13CA9D), refreshController: _wasCalledRefreshController, // themeColor: const Color(0xFF13CA9D), refreshController: _wasCalledRefreshController,
), // ),
], // ],
), // ),
), // ),
], // ],
), // ),
); // );
} // }
//
@override // @override
bool get wantKeepAlive => true; // bool get wantKeepAlive => true;
} // }

@ -11,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 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../user/content_details_page.dart';
import '../user/privacy_rights_page.dart'; import '../user/privacy_rights_page.dart';
import 'content_connect_page.dart'; import 'content_connect_page.dart';
import 'content_refuse_page.dart'; import 'content_refuse_page.dart';
@ -69,7 +70,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
// print('版本构建号$buildNumber'); // print('版本构建号$buildNumber');
// print("服务器上的${res.versionCode}"); // print("服务器上的${res.versionCode}");
// print("服务器上的${res.versionName}"); // print("服务器上的${res.versionName}");
if (res.versionCode > int.parse(buildNumber)) { if (int.parse(res.versionCode )> int.parse(buildNumber)) {
// CloudToast.show("是否进行版本更新"); // CloudToast.show("是否进行版本更新");
showDialog( showDialog(
context: context, context: context,
@ -258,11 +259,12 @@ alignment: Alignment.center,
48.hb, 48.hb,
_getSet(), _getSet(),
32.hb, 32.hb,
_getContainer("接听后", "编辑接听后发送的短信内容", Assets.images.answer.path, // _getContainer("接听后", "编辑接听后发送的短信内容", Assets.images.answer.path,
const Color(0xFF74BCFF), const Color(0xFF1890FF)), // const Color(0xFF74BCFF), const Color(0xFF1890FF)),
30.hb, // 30.hb,
_getContainer("拒接/未接后", "编辑拒接/未接后发送的短信内容", Assets.images.refused.path, _getContainer("编辑短信", "编辑拒接/未接后发送的短信内容", Assets.images.refused.path,
const Color(0xFF72E4C8), const Color(0xFF13CA9D)) const Color(0xFF72E4C8), const Color(0xFF13CA9D))
,50.hb
], ],
), ),
); );
@ -317,6 +319,7 @@ alignment: Alignment.center,
_getContainer(String title, String text, String image, Color cl1, Color cl2) { _getContainer(String title, String text, String image, Color cl1, Color cl2) {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
Get.to(() => ContentDetailsPage(ploneBack: (String textContent) { }, content: '',));
// Get.to(()=>UpdatePage()); // Get.to(()=>UpdatePage());
// FlutterXUpdate.checkUpdate( // FlutterXUpdate.checkUpdate(
// // topImageRes:'vipbanner', // // topImageRes:'vipbanner',
@ -333,12 +336,12 @@ alignment: Alignment.center,
// print(version); // print(version);
// print(buildNumber); supportSilentInstall: // print(buildNumber); supportSilentInstall:
// 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());
// print("未接听"); // // print("未接听");
} // }
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -348,24 +351,24 @@ alignment: Alignment.center,
end: Alignment.centerRight, end: Alignment.centerRight,
colors: [cl1, cl2])), colors: [cl1, cl2])),
width: 622.w, width: 622.w,
height: 192.w, height: 300.w,
child: Row( child: Row(
children: [ children: [
Container( Container(
padding: EdgeInsets.only(top: 40.w, left: 50.w), padding: EdgeInsets.only(top: 100.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: 60.sp,
color: const Color(0xFFFFFFFF), color: const Color(0xFFFFFFFF),
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
16.hb, 16.hb,
Text( Text(
text, text,
style: TextStyle( style: TextStyle(
fontSize: 27.sp, fontSize: 28.sp,
color: const Color(0xFFFFFFFF).withOpacity(0.6)), color: const Color(0xFFFFFFFF).withOpacity(0.6)),
), ),
], ],
@ -373,7 +376,7 @@ alignment: Alignment.center,
), ),
const Spacer(), const Spacer(),
Padding( Padding(
padding: EdgeInsets.only(top: 40.w), padding: EdgeInsets.only(top: 148.w),
child: Image.asset( child: Image.asset(
image, image,
width: 166.w, width: 166.w,

@ -25,13 +25,10 @@ class UserInfoFunc {
return UpdateModel.fromJson(res.data); return UpdateModel.fromJson(res.data);
} else { } else {
return const UpdateModel( return const UpdateModel(
versionCode: 0, versionCode: "",
updateStatus: 0,
versionName: '', versionName: '',
modifyContent: '', modifyContent: '',
apkSize: '', );
apkMd5: '',
downloadUrl: '');
} }
} }
} }

@ -1,202 +1,200 @@
import 'package:call_log/call_log.dart'; // import 'package:call_log/call_log.dart';
import 'package:flustars/flustars.dart'; // import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/base/base_style.dart'; // import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/home/set/func/exclude_contacts_func.dart'; // import 'package:project_telephony/ui/home/set/func/exclude_contacts_func.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:shared_preferences/shared_preferences.dart'; // import 'package:shared_preferences/shared_preferences.dart';
//
import '../../../../model/phone_num_model.dart'; // import '../../../../model/phone_num_model.dart';
import '../../../../utils/toast/cloud_toast.dart'; // import '../../../../utils/toast/cloud_toast.dart';
import '../../../widget/scaffold_theme_widget.dart'; // import '../../../widget/scaffold_theme_widget.dart';
//
class CallRecordsList extends StatefulWidget { // class CallRecordsList extends StatefulWidget {
const CallRecordsList({Key? key}) : super(key: key); // const CallRecordsList({Key? key}) : super(key: key);
//
@override // @override
_CallRecordsListState createState() => _CallRecordsListState(); // _CallRecordsListState createState() => _CallRecordsListState();
} // }
//
class _CallRecordsListState extends State<CallRecordsList> { // class _CallRecordsListState extends State<CallRecordsList> {
List<PhoneNumModel> phoneNum = []; // List<PhoneNumModel> phoneNum = [];
List<PhoneNumModel> phoneNum2 = []; // List<PhoneNumModel> phoneNum2 = [];
// List<ExcludePnModel> phoneNum3 = []; // // List<ExcludePnModel> phoneNum3 = [];
List phoneNum3=[]; // List phoneNum3=[];
// Map<String, String> get phoneNum3 => {}; // // Map<String, String> get phoneNum3 => {};
//
final EasyRefreshController _easyRefreshController = EasyRefreshController(); // final EasyRefreshController _easyRefreshController = EasyRefreshController();
late bool notifications; // late bool notifications;
late bool trackHistory; // late bool trackHistory;
late bool instantOrders; // late bool instantOrders;
late SharedPreferences prefs; // late SharedPreferences prefs;
List<String> numList = []; // List<String> numList = [];
//
// List<String> =[] // // List<String> =[]
@override // @override
void initState() { // void initState() {
// getList(); // // getList();
getList(); // getList();
super.initState(); // super.initState();
} // }
//
@override // @override
void dispose() { // void dispose() {
_easyRefreshController.dispose(); // _easyRefreshController.dispose();
super.dispose(); // super.dispose();
} // }
//
getList() async { // getList() async {
phoneNum.clear(); // phoneNum.clear();
final Iterable<CallLogEntry> entries = await CallLog.query(); // final Iterable<CallLogEntry> entries = await CallLog.query();
for (CallLogEntry entrie in entries) { // for (CallLogEntry entrie in entries) {
if (!numList.contains(entrie.number)) { // if (!numList.contains(entrie.number)) {
numList.add(entrie.number!); // numList.add(entrie.number!);
phoneNum.add(PhoneNumModel( // phoneNum.add(PhoneNumModel(
num: entrie.number, // num: entrie.number,
time: entrie.timestamp, // time: entrie.timestamp,
name: entrie.name, // name: entrie.name,
state: false, // state: false,
)); // ));
} // }
} // }
for (int i = 0; i < phoneNum.length; i++) { // for (int i = 0; i < phoneNum.length; i++) {
phoneNum2.add(PhoneNumModel( // phoneNum2.add(PhoneNumModel(
num: phoneNum[i].num, // num: phoneNum[i].num,
time: phoneNum[i].time, // time: phoneNum[i].time,
name: phoneNum[i].name, // name: phoneNum[i].name,
state: phoneNum[i].state, // state: phoneNum[i].state,
)); // ));
} // }
// for (CallLogEntry entrie in entries) { // // for (CallLogEntry entrie in entries) {
// if (!numList.contains(entrie.number)) { // // if (!numList.contains(entrie.number)) {
// numList.add(entrie.number!); // // numList.add(entrie.number!);
// phoneNum.add(PhoneNumModel( // // phoneNum.add(PhoneNumModel(
// num: entrie.number, // // num: entrie.number,
// time: entrie.timestamp, // // time: entrie.timestamp,
// name: entrie.name, // // name: entrie.name,
// state: false, // // state: false,
// )); // // ));
// } // // }
// } // // }
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return ScaffoldThemeWidget( // return ScaffoldThemeWidget(
bottom: '添加', // bottom: '添加',
title: '从通话记录添加', // title: '从通话记录添加',
isBorder: true, // isBorder: true,
isOpacity: phoneNum3.isNotEmpty, // isOpacity: phoneNum3.isNotEmpty,
onTap: () async { // onTap: () async {
// if (phoneNum3.isEmpty) {
if (phoneNum3.isEmpty) { // CloudToast.show('请选择手机号');
CloudToast.show('请选择手机号'); // } else {
} else { // // print(phoneNum3);
// print(phoneNum3); // await ExcludeFunc.getContactsList(phoneNum3);
await ExcludeFunc.getContactsList(phoneNum3); // // Navigator.pop(context,true);
// Navigator.pop(context,true); // Get.back();
Get.back(); // Get.back();
Get.back();
}
// _easyRefreshController.callRefresh();
// phoneNum3.clear();
},
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
controller: _easyRefreshController,
onRefresh: () async {
getList();
setState(() {});
},
child: ListView.builder(
itemBuilder: (context, index) {
return _getBox(phoneNum2[index], phoneNum2[index].num!,phoneNum2[index].name?? "");
},
itemCount: phoneNum2.length,
),
));
// var profileBuilder = FutureBuilder(
// // future: _incrementCounter(),
// future: getList() , // a Future<String> or null
// builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
// if(snapshot.connectionState==ConnectionState.done){
// return ListView.builder(
// itemBuilder: (context, index) {
// return _getBox(phoneNum[index]);
// },
// itemCount: phoneNum.length,
// );
// }else{
// return const SizedBox();
// } // }
// }); // // _easyRefreshController.callRefresh();
// return ScaffoldThemeWidget( // // phoneNum3.clear();
// bottom: '添加', // },
// title: '从通话记录添加', // child: EasyRefresh(
// isBorder: true, // firstRefresh: true,
// isOpacity: false, // header: MaterialHeader(),
// onTap: () { // controller: _easyRefreshController,
// onRefresh: () async {
// getList();
// setState(() {});
// },
// child: ListView.builder(
// itemBuilder: (context, index) {
// return _getBox(phoneNum2[index], phoneNum2[index].num!,phoneNum2[index].name?? "");
// },
// itemCount: phoneNum2.length,
// ),
// ));
// // var profileBuilder = FutureBuilder(
// // // future: _incrementCounter(),
// // future: getList() , // a Future<String> or null
// // builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
// // if(snapshot.connectionState==ConnectionState.done){
// // return ListView.builder(
// // itemBuilder: (context, index) {
// // return _getBox(phoneNum[index]);
// // },
// // itemCount: phoneNum.length,
// // );
// // }else{
// // return const SizedBox();
// // }
// // });
// // return ScaffoldThemeWidget(
// // bottom: '添加',
// // title: '从通话记录添加',
// // isBorder: true,
// // isOpacity: false,
// // onTap: () {
// //
// // },
// // child: profileBuilder
// // );
// // Column(
// // children: [
// // Container(width: 750.w, height: 1000.w, child: Text("")
// //
// // // ListView(
// // // children: [],
// // // ),
// // ),
// // PloneBottom(onTap: () async {
// // // Iterable<CallLogEntry> entries = await CallLog.get();
// // final Iterable<CallLogEntry> entries = await CallLog.query();
// // for (CallLogEntry entrie in entries) {
// // a.add(entrie.number);
// // }
// // // var b = entries.length;
// // print("通话记录条数$a");
// // })
// // ],
// // );
// }
// //
// }, // _getBox(PhoneNumModel item, String num,String name) {
// child: profileBuilder // return CheckboxListTile(
// ); // onChanged: (bool? value) {
// Column( // setState(() {
// children: [ // item.state = value!;
// Container(width: 750.w, height: 1000.w, child: Text("") // if (item.state) {
// // phoneNum3.add({"phone":num,"remark":name});
// // ListView( // // phoneNum3.add((phone: num, remark: name));
// // children: [], //
// // ), // } else {
// ), // phoneNum3.remove({"phone":num,"remark":name});
// PloneBottom(onTap: () async { // // phoneNum3.remove(ExcludePnModel(phone: num, remark: name)) ;
// // Iterable<CallLogEntry> entries = await CallLog.get(); // }
// final Iterable<CallLogEntry> entries = await CallLog.query(); // });
// for (CallLogEntry entrie in entries) { // },
// a.add(entrie.number); // value: item.state,
// } // title: Text(
// // var b = entries.length; // item.num!,
// print("通话记录条数$a"); // style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold),
// }) // ),
// ], // subtitle: Row(
// ); // children: [
} // Text(
// DateUtil.formatDateMs(item.time! * 1000, format: 'MM/dd HH:mm'),
_getBox(PhoneNumModel item, String num,String name) { // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
return CheckboxListTile( // ),
onChanged: (bool? value) { // 30.wb,
setState(() { // Text(
item.state = value!; // item.name == null ? "" : item.name!,
if (item.state) { // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
phoneNum3.add({"phone":num,"remark":name}); // )
// phoneNum3.add((phone: num, remark: name)); // ],
// ),
} else { // );
phoneNum3.remove({"phone":num,"remark":name}); // }
// phoneNum3.remove(ExcludePnModel(phone: num, remark: name)) ; // }
}
});
},
value: item.state,
title: Text(
item.num!,
style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold),
),
subtitle: Row(
children: [
Text(
DateUtil.formatDateMs(item.time! * 1000, format: 'MM/dd HH:mm'),
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
),
30.wb,
Text(
item.name == null ? "" : item.name!,
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
)
],
),
);
}
}

@ -1,18 +1,18 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:flutter_contacts/flutter_contacts.dart'; import 'package:flutter_contacts/flutter_contacts.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/ui/home/set/specify_phone_page.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/user_tool.dart'; import 'package:project_telephony/utils/user_tool.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../../../base/base_style.dart'; import '../../../base/base_style.dart';
import '../../widget/plone_back_button.dart'; import '../../widget/plone_back_button.dart';
import '../call.dart';
import '../home_page.dart';
// class setItem{
//
// }
class PhoneSetPage extends StatefulWidget { class PhoneSetPage extends StatefulWidget {
const PhoneSetPage({Key? key}) : super(key: key); const PhoneSetPage({Key? key}) : super(key: key);
@ -26,8 +26,39 @@ class _PhoneSetPageState extends State<PhoneSetPage> {
List<Contact>? contact; List<Contact>? contact;
List<String> numbers = []; List<String> numbers = [];
List<String>? numList = []; List<String>? numList = [];
bool vle=false;
bool isVip=false;
String? endDate;
final EasyRefreshController _refreshController = EasyRefreshController(); final EasyRefreshController _refreshController = EasyRefreshController();
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
final EasyRefreshController _easyRefreshController=EasyRefreshController();
List setList = [ List setList = [
// {
// "icon": Assets.icons.rylyphone.path,
// "title": "任意来源号码发送",
// "text": "所有的号码来电都会发送",
// // "select": true,
// },
// {
// "icon": Assets.icons.txlphone.path,
// "title": "在通讯录中的号码发送",
// "text": "只给在通讯录中的号码来电发送",
// // "select": false,
// },
// {
// "icon": Assets.icons.notxlphone.path,
// "title": "不在通讯录中的号码发送",
// "text": "只给不在通讯录中的号码来电发送",
// // "select": false,
// },
// {
{
"icon": Assets.icons.switch1.path,
"title": "功能开关",
"text": "功能开启所有号码都发送",
// "select": true,
},
{ {
"icon": Assets.icons.rylyphone.path, "icon": Assets.icons.rylyphone.path,
"title": "任意来源号码发送", "title": "任意来源号码发送",
@ -36,14 +67,14 @@ class _PhoneSetPageState extends State<PhoneSetPage> {
}, },
{ {
"icon": Assets.icons.txlphone.path, "icon": Assets.icons.txlphone.path,
"title": "在通讯录中的号码发送", "title": "来电接听/挂断",
"text": "给在通讯录中的号码来电发送", "text": "发来电",
// "select": false, // "select": false,
}, },
{ {
"icon": Assets.icons.notxlphone.path, "icon": Assets.icons.notxlphone.path,
"title": "不在通讯录中的号码发送", "title": "去电接听/挂断",
"text": "给不在通讯录中的号码来电发送", "text": "发去电",
// "select": false, // "select": false,
}, },
]; ];
@ -52,7 +83,11 @@ class _PhoneSetPageState extends State<PhoneSetPage> {
void initState() { void initState() {
super.initState(); super.initState();
} }
@override
void dispose() {
_easyRefreshController.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -78,74 +113,127 @@ class _PhoneSetPageState extends State<PhoneSetPage> {
final SharedPreferences prefs = await SharedPreferences.getInstance(); final SharedPreferences prefs = await SharedPreferences.getInstance();
print(prefs.getInt("numIndex")); print(prefs.getInt("numIndex"));
select = (prefs.getInt("numIndex")) ?? 0; select = (prefs.getInt("numIndex")) ?? 0;
_getRequests();
// _viewLoading(); // _viewLoading();
setState(() {}); setState(() {});
}, },
child: ListView( child: ListView(
children: [ children: [
// _getSwitch(),
_getList(), _getList(),
24.hb, // GestureDetector(
GestureDetector( // onTap: () {
onTap: () { // Get.to(() => const SpecifyPhonePage());
Get.to(() => const SpecifyPhonePage()); // },
}, // child: Container(
child: Container( // padding:
padding: // EdgeInsets.symmetric(horizontal: 32.w, vertical: 30.w),
EdgeInsets.symmetric(horizontal: 32.w, vertical: 30.w), // height: 144.w,
height: 144.w, // child: ListTile(
child: ListTile( // leading: SizedBox(
leading: SizedBox( // width: 72.w,
width: 72.w, // height: 72.w,
height: 72.w, // child: Image.asset(
child: Image.asset( // Assets.icons.zdphone.path,
Assets.icons.zdphone.path, // fit: BoxFit.fill,
fit: BoxFit.fill, // ),
), // ),
), // title: Text(
title: Text( // "指定号码不发送",
"指定号码不发送", // style: TextStyle(
style: TextStyle( // fontSize: 32.sp, fontWeight: FontWeight.bold),
fontSize: 32.sp, fontWeight: FontWeight.bold), // ),
), // subtitle: Text(
subtitle: Text( // "通过添加指定号码来设置不发送",
"通过添加指定号码来设置不发送", // style: TextStyle(
style: TextStyle( // fontSize: 28.sp, color: const Color(0xFF999999)),
fontSize: 28.sp, color: const Color(0xFF999999)), // ),
), // trailing: SizedBox(
trailing: SizedBox( // width: 48.w,
width: 48.w, // height: 48.w,
height: 48.w, // child: const Icon(Icons.arrow_forward_ios),
child: const Icon(Icons.arrow_forward_ios), // )),
)), // ),
), // )
)
], ],
), ),
) )
// Column(
// children: [
//
//
//
// ],
// ),
); );
} }
_getList() { _getList() {
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 30.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
height: 500.w, height: 640.w,
child: ListView.builder( child: ListView.builder(
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _getListBox(setList, index); return _getListBox(setList, index,index!=0);
}, },
itemCount: setList.length, itemCount: setList.length,
), ),
); );
} }
//
// _getSwitch() {
// return Container(
// padding: EdgeInsets.symmetric(horizontal: 32.w),
// child: ListTile(
// // onTap: (() {}),
// leading: Image.asset(
// Assets.icons.switch1.path,
// height: 54.w,
// width: 56.w,
// fit: BoxFit.fill,
// ),
// title: Text(
// "功能开关",
// style: TextStyle(
// color: BaseStyle.color333333,
// fontSize: BaseStyle.fontSize34,
// fontWeight: FontWeight.bold),
// ),
// trailing: Checkbox(
// value: vle,
// //
// onChanged: (value) {
// setState(() {
// vle=value!;
// });
// },
// //
// activeColor: Colors.blue,
// //
// checkColor: Colors.white,
// ),
//
//
// // Switch(
// // value: vle,
// // onChanged: (value) async {
// // final SharedPreferences prefs = await _prefs;
// // setState(() {
// // if (isVip) {
// // vle = value;
// // if (vle) {
// // print("true");
// // prefs.remove("kg");
// // prefs.setBool("kg", vle);
// // service.startService();
// // initializeService();
// // BotToast.showText(text: " 你开启了该功能");
// // } else {
// // prefs.remove("kg");
// // prefs.setBool("kg", vle);
// // service.invoke("stopService");
// // BotToast.showText(text: "你已经关闭该功能");
// // }
// // } else {
// // BotToast.showText(text: "还没有开通会员,不可使用该功能");
// // }
// // });
// // }),
// ));
// }
// Future _viewLoading() async { // Future _viewLoading() async {
// final SharedPreferences prefs = await SharedPreferences.getInstance(); // final SharedPreferences prefs = await SharedPreferences.getInstance();
// contact = await FlutterContacts.getContacts(); // contact = await FlutterContacts.getContacts();
@ -184,24 +272,54 @@ class _PhoneSetPageState extends State<PhoneSetPage> {
// // } // // }
// setState(() {}); // setState(() {});
// } // }
_getRequests() async {
_getListBox(List item, int index) { UserTool.userProvider.updateUserInfo();
if (UserTool.userProvider.isLogin) {
// print(UserTool.userProvider.userInfo.end * 1000);
// print(DateTime.now().millisecondsSinceEpoch);
if (UserTool.userProvider.userInfo.isVip != 1) {
isVip = false;
vle = false;
// UserTool.userProvider.updateUserInfo();
_easyRefreshController.callRefresh();
} else {
isVip = true;
vle = await service.isRunning();
// print(vle);
// _easyRefreshController.callRefresh();
}
//service.isRunning() as bool;
// endDate = DateUtil.formatDateMs(
// UserTool.userProvider.userInfo.end * 1000,
// format: DateFormats.y_mo_d);
} else {
vle = false;
}
//
setState(() {});
}
_getListBox(List item, int index,bool kg) {
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
final SharedPreferences prefs = await SharedPreferences.getInstance(); if(kg){
select = index; final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setInt("numIndex", index); select = index;
service.invoke("stopService"); await prefs.setInt("numIndex", index);
if (prefs.getBool('kg') ?? false) { service.invoke("stopService");
Future.delayed(const Duration(seconds: 1), () async { if (prefs.getBool('kg') ?? false) {
service.startService();
}); Future.delayed(const Duration(seconds: 1), () async {
vle=true;
service.startService();
});
}
UserTool.userProvider.viewLoading();
_refreshController.callRefresh();
// print(_selectIndex);
} }
UserTool.userProvider.viewLoading();
_refreshController.callRefresh();
// print(_selectIndex);
setState(() {}); setState(() {});
}, },
child: ListTile( child: ListTile(
@ -223,7 +341,8 @@ class _PhoneSetPageState extends State<PhoneSetPage> {
trailing: SizedBox( trailing: SizedBox(
width: 40.w, width: 40.w,
height: 40.w, height: 40.w,
child: Radio( child: kg?
Radio(
onChanged: (int? value) async{ onChanged: (int? value) async{
// final SharedPreferences prefs = await SharedPreferences.getInstance(); // final SharedPreferences prefs = await SharedPreferences.getInstance();
// select = index; // select = index;
@ -242,6 +361,46 @@ class _PhoneSetPageState extends State<PhoneSetPage> {
}, },
groupValue: select, groupValue: select,
value: index, value: index,
):Checkbox(
value: vle,
//
onChanged: (value) async{
final SharedPreferences prefs = await _prefs;
// if(!value){
//
// }
// await prefs.setBool("kg", value);
// print("这是数据${prefs.getBool("kg")}");
setState(() {
if (isVip) {
vle = value!;
// prefs.setBool("kg", vle);
// initializeService();
// print(vle);
if (vle) {
// print("true");
// prefs.remove("kg");
prefs.setBool("kg", vle);
service.startService();
initializeService();
BotToast.showText(text: " 你开启了该功能");
} else {
// print("false");
// prefs.remove("kg");
prefs.setBool("kg", vle);
service.invoke("stopService");
BotToast.showText(text: "你已经关闭该功能");
// print("这是数据${prefs.getBool("kg")}");
}
} else {
BotToast.showText(text: "还没有开通会员,不可使用该功能");
}
});
},
//
activeColor: Colors.blue,
//
checkColor: Colors.white,
), ),
), ),

@ -1,310 +1,310 @@
import 'package:flutter/cupertino.dart'; // import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; // import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/constants/api.dart'; // import 'package:project_telephony/constants/api.dart';
import 'package:project_telephony/model/network/api_client.dart'; // import 'package:project_telephony/model/network/api_client.dart';
import 'package:project_telephony/ui/exclude/exclude_contacts_page.dart'; // import 'package:project_telephony/ui/exclude/exclude_contacts_page.dart';
import 'package:project_telephony/ui/exclude/exclude_single_page.dart'; // import 'package:project_telephony/ui/exclude/exclude_single_page.dart';
import 'package:project_telephony/ui/home/set/phone_num_list/call_records_list.dart'; // import 'package:project_telephony/ui/home/set/phone_num_list/call_records_list.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart'; // import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/utils/headers.dart'; // import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/toast/cloud_toast.dart'; // import 'package:project_telephony/utils/toast/cloud_toast.dart';
import 'package:project_telephony/utils/user_tool.dart'; // import 'package:project_telephony/utils/user_tool.dart';
//
import '../../../base/base_style.dart'; // import '../../../base/base_style.dart';
import '../../../model/exclude_phone_model.dart'; // import '../../../model/exclude_phone_model.dart';
import '../../widget/scaffold_theme_widget.dart'; // import '../../widget/scaffold_theme_widget.dart';
import 'func/exclude_contacts_func.dart'; // import 'func/exclude_contacts_func.dart';
//
class SpecifyPhonePage extends StatefulWidget { // class SpecifyPhonePage extends StatefulWidget {
const SpecifyPhonePage({Key? key}) : super(key: key); // const SpecifyPhonePage({Key? key}) : super(key: key);
//
@override // @override
_SpecifyPhonePageState createState() => _SpecifyPhonePageState(); // _SpecifyPhonePageState createState() => _SpecifyPhonePageState();
} // }
//
class _SpecifyPhonePageState extends State<SpecifyPhonePage> { // class _SpecifyPhonePageState extends State<SpecifyPhonePage> {
final EasyRefreshController _refreshController = EasyRefreshController(); // final EasyRefreshController _refreshController = EasyRefreshController();
List<ExcludePhoneModel> findList = []; // List<ExcludePhoneModel> findList = [];
String name=""; // String name="";
String phone=""; // String phone="";
@override // @override
void dispose() { // void dispose() {
_refreshController.dispose(); // _refreshController.dispose();
super.dispose(); // super.dispose();
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return ScaffoldThemeWidget( // return ScaffoldThemeWidget(
wid: 196, // wid: 196,
title: "指定号码", // title: "指定号码",
bottom: '添加', // bottom: '添加',
onTap: () { // onTap: () {
showModalBottomSheet( // showModalBottomSheet(
builder: (BuildContext context) { // builder: (BuildContext context) {
return Container( // return Container(
width: double.infinity, // width: double.infinity,
height: 750.w, // height: 750.w,
padding: EdgeInsets.symmetric(horizontal: 32.w), // padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Column( // child: Column(
children: [ // children: [
48.hb, // 48.hb,
Text( // Text(
"添加号码", // "添加号码",
style: TextStyle( // style: TextStyle(
fontSize: 34.w, fontWeight: FontWeight.bold), // fontSize: 34.w, fontWeight: FontWeight.bold),
), // ),
Expanded( // Expanded(
child: ListView( // child: ListView(
children: [ // children: [
_getAddPhone("通话记录添加", "通过本机通话记录添加号码", () { // _getAddPhone("通话记录添加", "通过本机通话记录添加号码", () {
Navigator.of(context) // Navigator.of(context)
.push( // .push(
MaterialPageRoute( // MaterialPageRoute(
builder: (_) => const CallRecordsList()), // builder: (_) => const CallRecordsList()),
) // )
.then((val) =>_refreshController.callRefresh()); // .then((val) =>_refreshController.callRefresh());
//
// Get.to(() => const CallRecordsList()); // // Get.to(() => const CallRecordsList());
}), // }),
_getAddPhone("通迅录添加", "通过本机通讯录添加号码", () { // _getAddPhone("通迅录添加", "通过本机通讯录添加号码", () {
Navigator.of(context) // Navigator.of(context)
.push( // .push(
MaterialPageRoute( // MaterialPageRoute(
builder: (_) => const ExcludeContactsPage()), // builder: (_) => const ExcludeContactsPage()),
) // )
.then((val) =>_refreshController.callRefresh()); // .then((val) =>_refreshController.callRefresh());
//
}), // }),
_getAddPhone("添加单个或批量号码", "通过输入号码段添加批量号码", () { // _getAddPhone("添加单个或批量号码", "通过输入号码段添加批量号码", () {
Navigator.of(context) // Navigator.of(context)
.push( // .push(
MaterialPageRoute( // MaterialPageRoute(
builder: (_) => const ExcludeSinglePage()), // builder: (_) => const ExcludeSinglePage()),
) // )
.then((val) =>_refreshController.callRefresh()); // .then((val) =>_refreshController.callRefresh());
}), // }),
], // ],
)), // )),
PloneBottom( // PloneBottom(
onTap: () { // onTap: () {
Navigator.pop(context); // Navigator.pop(context);
}, // },
hPadding: 32, // hPadding: 32,
border: true, // border: true,
textColor: const Color(0xFF1890FF), // textColor: const Color(0xFF1890FF),
color2: const Color(0xFFF9F9F9), // color2: const Color(0xFFF9F9F9),
color1: const Color(0xFFF9F9F9), // color1: const Color(0xFFF9F9F9),
text: "取消", // text: "取消",
), // ),
32.hb // 32.hb
], // ],
), // ),
); // );
}, // },
context: context); // context: context);
//
}, // },
child: EasyRefresh( // child: EasyRefresh(
firstRefresh: true, // firstRefresh: true,
controller: _refreshController, // controller: _refreshController,
header: MaterialHeader(), // header: MaterialHeader(),
// footer: MaterialFooter(), // // footer: MaterialFooter(),
onRefresh: () async { // onRefresh: () async {
findList = await ExcludeFunc.getContacts(); // findList = await ExcludeFunc.getContacts();
UserTool.userProvider.viewLoading(); // UserTool.userProvider.viewLoading();
// await userProvider.updateUserInfo(); // // await userProvider.updateUserInfo();
//
setState(() {}); // setState(() {});
}, // },
child: findList.isEmpty ? _getNullList() : _getNum() // child: findList.isEmpty ? _getNullList() : _getNum()
//
// ListView( // // ListView(
// children: [findList.isEmpty ? _getNullList() : _getNum()], // // children: [findList.isEmpty ? _getNullList() : _getNum()],
// ) // // )
//
), // ),
); // );
} // }
//
_getNum() { // _getNum() {
return ListView.builder( // return ListView.builder(
itemBuilder: (context, index) { // itemBuilder: (context, index) {
return _getNumContant(findList[index],findList[index].id); // return _getNumContant(findList[index],findList[index].id);
}, // },
itemCount: findList.length, // itemCount: findList.length,
); // );
} // }
//
_getNumContant(ExcludePhoneModel item,int id) { // _getNumContant(ExcludePhoneModel item,int id) {
return Container( // return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w), // margin: EdgeInsets.symmetric(horizontal: 16.w),
child: ListTile( // child: ListTile(
onTap: () { // onTap: () {
showDialog( // showDialog(
context: context, // context: context,
builder: (context) { // builder: (context) {
return CupertinoAlertDialog( // return CupertinoAlertDialog(
title: Text( // title: Text(
"修改名称", // "修改名称",
style: TextStyle( // style: TextStyle(
color: BaseStyle.color333333, fontSize: 34.sp), // color: BaseStyle.color333333, fontSize: 34.sp),
), // ),
content: Column( // content: Column(
children: [ // children: [
Column( // Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
Text( // Text(
"名称", // "名称",
style: TextStyle( // style: TextStyle(
fontSize: 28.sp, // fontSize: 28.sp,
color: BaseStyle.color999999, // color: BaseStyle.color999999,
), // ),
), // ),
24.hb, // 24.hb,
CupertinoTextField( // CupertinoTextField(
padding: EdgeInsets.symmetric( // padding: EdgeInsets.symmetric(
horizontal: 24.w, vertical: 20.w), // horizontal: 24.w, vertical: 20.w),
decoration: BoxDecoration( // decoration: BoxDecoration(
border: Border.all(color: Colors.white), // border: Border.all(color: Colors.white),
// borderRadius: BorderRadius.all( // // borderRadius: BorderRadius.all(
// Radius.circular(4.w) // // Radius.circular(4.w)
// ), // // ),
color: const Color(0xFFF9F9F9)), // color: const Color(0xFFF9F9F9)),
placeholderStyle: // placeholderStyle:
const TextStyle(color: BaseStyle.color333333), // const TextStyle(color: BaseStyle.color333333),
placeholder: item.remark, // placeholder: item.remark,
onChanged: (value) { // onChanged: (value) {
name=value; // name=value;
setState(() {}); // setState(() {});
}, // },
), // ),
20.hb, // 20.hb,
Text( // Text(
"号码", // "号码",
style: TextStyle( // style: TextStyle(
fontSize: 28.sp, // fontSize: 28.sp,
color: BaseStyle.color999999, // color: BaseStyle.color999999,
), // ),
), // ),
24.hb, // 24.hb,
CupertinoTextField( // CupertinoTextField(
padding: EdgeInsets.symmetric( // padding: EdgeInsets.symmetric(
horizontal: 24.w, vertical: 20.w), // horizontal: 24.w, vertical: 20.w),
decoration: BoxDecoration( // decoration: BoxDecoration(
border: Border.all(color: Colors.white), // border: Border.all(color: Colors.white),
// borderRadius: BorderRadius.all( // // borderRadius: BorderRadius.all(
// Radius.circular(4.w) // // Radius.circular(4.w)
// ), // // ),
color: const Color(0xFFF9F9F9)), // color: const Color(0xFFF9F9F9)),
placeholder: item.phone, // placeholder: item.phone,
onChanged: (value) { // onChanged: (value) {
phone=value; // phone=value;
setState(() {}); // setState(() {});
}, // },
), // ),
82.hb, // 82.hb,
// _getUpdate("爸爸", "123123123"), // // _getUpdate("爸爸", "123123123"),
PloneBottom( // PloneBottom(
blM: false, // blM: false,
border: true, // border: true,
color1: const Color(0xFF1890FF), // color1: const Color(0xFF1890FF),
color2: const Color(0xFF74BCFF), // color2: const Color(0xFF74BCFF),
onTap: () async{ // onTap: () async{
Navigator.pop(context); // Navigator.pop(context);
var res=await ExcludeFunc.getUpdate(id, phone, item.remark.isEmpty?name:item.remark); // var res=await ExcludeFunc.getUpdate(id, phone, item.remark.isEmpty?name:item.remark);
_refreshController.callRefresh(); // _refreshController.callRefresh();
print(res); // print(res);
}, // },
text: "保存", // text: "保存",
) // )
], // ],
), // ),
], // ],
), // ),
); // );
}); // });
}, // },
title: Text( // title: Text(
item.remark.isEmpty? item.phone:item.remark, // item.remark.isEmpty? item.phone:item.remark,
style: TextStyle( // style: TextStyle(
fontSize: 32.sp, // fontSize: 32.sp,
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontWeight: FontWeight.bold)), // fontWeight: FontWeight.bold)),
subtitle: Text( // subtitle: Text(
item.address, // item.address,
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
), // ),
trailing: TextButton( // trailing: TextButton(
style: ButtonStyle( // style: ButtonStyle(
side: MaterialStateProperty.all( // side: MaterialStateProperty.all(
BorderSide(width: 2.w, color: const Color(0xFFE8E8E8)))), // BorderSide(width: 2.w, color: const Color(0xFFE8E8E8)))),
onPressed: () async { // onPressed: () async {
print(id); // print(id);
var res = // var res =
await apiClient.request(API.exclude.delete, data: {"id":id}); // await apiClient.request(API.exclude.delete, data: {"id":id});
if (res.code == 0) { // if (res.code == 0) {
_refreshController.callRefresh(); // _refreshController.callRefresh();
CloudToast.show(res.msg); // CloudToast.show(res.msg);
} else { // } else {
CloudToast.show(res.msg); // CloudToast.show(res.msg);
} // }
}, // },
child: Text( // child: Text(
"删除", // "删除",
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color333333), // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color333333),
), // ),
), // ),
), // ),
); // );
} // }
//
_getAddPhone(String title, String text, VoidCallback widget) { // _getAddPhone(String title, String text, VoidCallback widget) {
return GestureDetector( // return GestureDetector(
onTap: widget, // onTap: widget,
child: ListTile( // child: ListTile(
title: Text( // title: Text(
title, // title,
style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.bold), // style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.bold),
), // ),
subtitle: Text( // subtitle: Text(
text, // text,
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
), // ),
trailing: const Icon(Icons.chevron_right), // trailing: const Icon(Icons.chevron_right),
), // ),
); // );
} // }
//
_getNullList() { // _getNullList() {
return Column( // return Column(
mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center, // // crossAxisAlignment: CrossAxisAlignment.center,
children: [ // children: [
490.hb, // 490.hb,
Image.asset( // Image.asset(
Assets.icons.nullphonelist.path, // Assets.icons.nullphonelist.path,
width: 240.w, // width: 240.w,
height: 212.w, // height: 212.w,
fit: BoxFit.fill, // fit: BoxFit.fill,
), // ),
48.hb, // 48.hb,
Text( // Text(
"这里是空的", // "这里是空的",
style: TextStyle( // style: TextStyle(
color: const Color(0xFF999999), // color: const Color(0xFF999999),
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
fontSize: 36.sp), // fontSize: 36.sp),
), // ),
16.hb, // 16.hb,
Text( // Text(
"还没有添加指定号码", // "还没有添加指定号码",
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp), // style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
), // ),
490.hb, // 490.hb,
], // ],
); // );
} // }
} // }

@ -10,11 +10,13 @@ import 'package:project_telephony/ui/login/login_psd_page.dart';
import 'package:project_telephony/ui/user/set_password_page.dart'; import 'package:project_telephony/ui/user/set_password_page.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart'; import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:provider/provider.dart';
import '../../base/base_style.dart'; import '../../base/base_style.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../constants/environment/environment.dart'; import '../../constants/environment/environment.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; import '../../utils/toast/cloud_toast.dart';
import '../../utils/user_tool.dart'; import '../../utils/user_tool.dart';
import '../tab_navigator.dart'; import '../tab_navigator.dart';
@ -46,7 +48,7 @@ class _LoginPageState extends State<LoginPage> {
late FocusNode _smsCodeFocusNode; late FocusNode _smsCodeFocusNode;
bool _cantSelected = false; bool _cantSelected = false;
DateTime? _lastTap; DateTime? _lastTap;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -165,11 +167,11 @@ class _LoginPageState extends State<LoginPage> {
}); });
if (base.code == 0) { if (base.code == 0) {
print("1");
await UserTool.userProvider.setToken(base.data['token']); await userProvider.setToken(base.data['token']);
print("2"); userProvider.viewLoading();
Get.offAll(const TabNavigator()); Get.offAll(const TabNavigator());
print("3");
if (UserTool.userProvider.userInfo.havePwd == 0) { if (UserTool.userProvider.userInfo.havePwd == 0) {
Get.to(() => const SetPasswordPage()); Get.to(() => const SetPasswordPage());
} }

@ -6,14 +6,14 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:project_telephony/extensions/num_ext.dart'; import 'package:project_telephony/extensions/num_ext.dart';
import 'package:project_telephony/ui/login/login_page.dart'; import 'package:project_telephony/ui/login/login_page.dart';
import 'package:provider/provider.dart';
import '../../base/base_style.dart'; import '../../base/base_style.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../gen/assets.gen.dart'; import '../../gen/assets.gen.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; import '../../utils/toast/cloud_toast.dart';
import '../../utils/user_tool.dart'; import '../../utils/user_tool.dart';
import '../tab_navigator.dart'; import '../tab_navigator.dart';
@ -35,7 +35,7 @@ class _LoginPsdPageState extends State<LoginPsdPage> {
late TextEditingController _pwdController; late TextEditingController _pwdController;
DateTime? _lastTap; DateTime? _lastTap;
late bool _showPwd = true; late bool _showPwd = true;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -136,14 +136,11 @@ class _LoginPsdPageState extends State<LoginPsdPage> {
'password': _pwdController.text 'password': _pwdController.text
}); });
if (base.code == 0) { if (base.code == 0) {
print("1"); await userProvider.setToken(base.data['token']);
await UserTool.userProvider.setToken(base.data['token']); userProvider.viewLoading();
print("2"); Get.offAll(const TabNavigator());
Get.offAll(const TabNavigator());
print("3");
} else { } else {
CloudToast.show(base.msg); CloudToast.show(base.msg);
} }
} }
}, },

@ -2,8 +2,6 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:project_telephony/ui/user/user_page.dart'; import 'package:project_telephony/ui/user/user_page.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'TextMe/text_me_page.dart';
import 'home/home_page.dart'; import 'home/home_page.dart';
class TabNavigator extends StatefulWidget { class TabNavigator extends StatefulWidget {

@ -1,12 +1,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/user_tool.dart'; import 'package:project_telephony/utils/user_tool.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../base/base_style.dart'; import '../../base/base_style.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart'; import '../../model/network/base_model.dart';
import '../../utils/toast/cloud_toast.dart'; import '../../utils/toast/cloud_toast.dart';
import '../home/home_page.dart';
import '../widget/plone_back_button.dart'; import '../widget/plone_back_button.dart';
import '../widget/plone_bottom.dart'; import '../widget/plone_bottom.dart';
@ -28,6 +30,7 @@ class _ContentDetailsPageState extends State<ContentDetailsPage> {
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); // final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
String cText=""; String cText="";
final FocusNode verifyNode=FocusNode(); final FocusNode verifyNode=FocusNode();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -46,7 +49,7 @@ final FocusNode verifyNode=FocusNode();
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
title: Text( title: Text(
'编辑短信标签', '编辑短信',
style: TextStyle( style: TextStyle(
fontSize: BaseStyle.fontSize34, fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333, color: BaseStyle.color333333,
@ -90,7 +93,7 @@ final FocusNode verifyNode=FocusNode();
filled: true, filled: true,
isDense: true, isDense: true,
fillColor: Colors.transparent , fillColor: Colors.transparent ,
hintText: widget.content.isNotEmpty ? "" : "请输入所需短信标签", hintText: widget.content.isNotEmpty ? "" : "请输入所需短信",
hintStyle: TextStyle( hintStyle: TextStyle(
color: widget.content != "" color: widget.content != ""
? const Color(0xFF333333) ? const Color(0xFF333333)
@ -106,13 +109,21 @@ final FocusNode verifyNode=FocusNode();
opacity: cText.isNotEmpty ? 1 : 0.4, opacity: cText.isNotEmpty ? 1 : 0.4,
onTap: () async { onTap: () async {
// print(_controller.text); // print(_controller.text);
final prefs = await SharedPreferences.getInstance();
BaseModel res = BaseModel res =
await apiClient.request(API.app.addTag, data: {'tag': _controller.text}); await apiClient.request(API.app.addTag, data: {'tag': _controller.text});
if (res.code == 0) { if (res.code == 0) {
setState(() {}); setState(() {});
widget.ploneBack(_controller.text); widget.ploneBack(_controller.text);
UserTool.userProvider.updateUserInfo(); prefs.setString("refSms", _controller.text);
UserTool.userProvider.updateConSms(); service.invoke("stopService");
if (prefs.getBool('kg') ?? false) {
Future.delayed(const Duration(seconds: 1), () async {
service.startService();
});
}
// UserTool.userProvider.updateUserInfo();
// UserTool.userProvider.updateConSms();
Get.back(); Get.back();
} else { } else {
CloudToast.show(res.msg); CloudToast.show(res.msg);

@ -169,14 +169,14 @@ class _UserPageState extends State<UserPage> {
72.hb, 72.hb,
_getBanner(), _getBanner(),
64.hb, 64.hb,
_getSwitch2(), // _getSwitch2(),
_getSwitch(Assets.icons.privacy.path, "隐私政策", false), _getSwitch(Assets.icons.privacy.path, "隐私政策", false),
_getSwitch( _getSwitch(
Assets.icons.permissions.path, "权限说明", false), Assets.icons.permissions.path, "权限说明", false),
_getSwitch(Assets.icons.sms.path, "短信标签", false), // _getSwitch(Assets.icons.sms.path, "短信标签", false),
_getSwitch(Assets.icons.card.path, "卡密兑换", false), _getSwitch(Assets.icons.card.path, "卡密兑换", false),
// const Spacer(), // const Spacer(),
100.hb, 200.hb,
UserTool.userProvider.isLogin UserTool.userProvider.isLogin
? PloneBottom( ? PloneBottom(
border: false, border: false,
@ -406,78 +406,76 @@ class _UserPageState extends State<UserPage> {
} }
// //
_getSwitch2() { // _getSwitch2() {
return Container( // return Container(
padding: EdgeInsets.symmetric(horizontal: 32.w), // padding: EdgeInsets.symmetric(horizontal: 32.w),
child: ListTile( // child: ListTile(
// onTap: (() {}), // // onTap: (() {}),
leading: Image.asset( // leading: Image.asset(
Assets.icons.switch1.path, // Assets.icons.switch1.path,
height: 54.w, // height: 54.w,
width: 56.w, // width: 56.w,
fit: BoxFit.fill, // fit: BoxFit.fill,
), // ),
title: Text( // title: Text(
"功能开关", // "功能开关",
style: TextStyle( // style: TextStyle(
color: BaseStyle.color333333, // color: BaseStyle.color333333,
fontSize: BaseStyle.fontSize34, // fontSize: BaseStyle.fontSize34,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
trailing: Switch( // trailing: Switch(
value: vle, // value: vle,
onChanged: (value) async { // onChanged: (value) async {
final SharedPreferences prefs = await _prefs; // final SharedPreferences prefs = await _prefs;
// if(!value){ // // if(!value){
// // //
// } // // }
// await prefs.setBool("kg", value); // // await prefs.setBool("kg", value);
// print("这是数据${prefs.getBool("kg")}"); // // print("这是数据${prefs.getBool("kg")}");
setState(() { // setState(() {
if (isVip) { // if (isVip) {
vle = value; // vle = value;
// prefs.setBool("kg", vle); // // prefs.setBool("kg", vle);
// initializeService(); // // initializeService();
if (vle) { // if (vle) {
print("true"); // print("true");
prefs.remove("kg"); // prefs.remove("kg");
prefs.setBool("kg", vle); // prefs.setBool("kg", vle);
// Future.delayed(const Duration(seconds: 1), () async { // // Future.delayed(const Duration(seconds: 1), () async {
// service.startService(); // // service.startService();
// }); // // });
service.startService(); // service.startService();
// WidgetsFlutterBinding.ensureInitialized(); // // WidgetsFlutterBinding.ensureInitialized();
initializeService(); // initializeService();
// UserTool.userProvider.setKg(vle) // // UserTool.userProvider.setKg(vle)
// initializeService(); // // initializeService();
// initializeService(); // // initializeService();
BotToast.showText(text: " 你开启了该功能"); // BotToast.showText(text: " 你开启了该功能");
// initializeService(); // // initializeService();
// print("这是数据${prefs.getBool("kg")}"); // // print("这是数据${prefs.getBool("kg")}");
} else { // } else {
prefs.remove("kg"); // prefs.remove("kg");
prefs.setBool("kg", vle); // prefs.setBool("kg", vle);
// Future.delayed(const Duration(seconds: 1), () async { // // Future.delayed(const Duration(seconds: 1), () async {
// service.invoke("stopService"); // // service.invoke("stopService");
// }); // // });
service.invoke("stopService"); // service.invoke("stopService");
// // exit(0);
/// // // UserTool.userProvider.setKg(vle);
// exit(0); // // prefs.setBool("kg", false);
// UserTool.userProvider.setKg(vle); // // initializeService();
// prefs.setBool("kg", false); //
// initializeService(); // BotToast.showText(text: "你已经关闭该功能");
// // print("这是数据${prefs.getBool("kg")}");
BotToast.showText(text: "你已经关闭该功能"); // }
// print("这是数据${prefs.getBool("kg")}"); // } else {
} // BotToast.showText(text: "还没有开通会员,不可使用该功能");
} else { // }
BotToast.showText(text: "还没有开通会员,不可使用该功能"); // });
} // }),
}); // ));
}), // }
));
}
_getSwitch(String url, String name, bool pd) { _getSwitch(String url, String name, bool pd) {
return GestureDetector( return GestureDetector(

@ -352,14 +352,14 @@ packages:
name: flutter_background_service_ios name: flutter_background_service_ios
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.4.0"
flutter_background_service_platform_interface: flutter_background_service_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: flutter_background_service_platform_interface name: flutter_background_service_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.2.0"
flutter_contacts: flutter_contacts:
dependency: "direct main" dependency: "direct main"
description: description:

@ -1,38 +1,18 @@
name: project_telephony name: project_telephony
description: A new Flutter project. description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.5 cupertino_icons: ^1.0.5
telephony: telephony:
git: git:
@ -44,6 +24,7 @@ dependencies:
git: git:
url: https://git.oa00.com/austin_dai/permission_handler.git url: https://git.oa00.com/austin_dai/permission_handler.git
# 后台设置 # 后台设置
# flutter_background_service: ^2.4.3
flutter_background_service: flutter_background_service:
git: git:
url: https://git.oa00.com/austin_dai/flutter_background_service.git url: https://git.oa00.com/austin_dai/flutter_background_service.git

@ -1,7 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flustars/flustars.dart';
import 'package:grinder/grinder.dart'; import 'package:grinder/grinder.dart';
import 'package:path/path.dart'; import 'package:path/path.dart';
import 'package:pub_semver/pub_semver.dart'; import 'package:pub_semver/pub_semver.dart';

Loading…
Cancel
Save