|
|
@ -5,8 +5,10 @@ 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/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/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/exclude_pn_model.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';
|
|
|
@ -21,13 +23,17 @@ class CallRecordsList extends StatefulWidget {
|
|
|
|
class _CallRecordsListState extends State<CallRecordsList> {
|
|
|
|
class _CallRecordsListState extends State<CallRecordsList> {
|
|
|
|
List<PhoneNumModel> phoneNum = [];
|
|
|
|
List<PhoneNumModel> phoneNum = [];
|
|
|
|
List<PhoneNumModel> phoneNum2 = [];
|
|
|
|
List<PhoneNumModel> phoneNum2 = [];
|
|
|
|
List<String> phoneNum3 = [];
|
|
|
|
// List<ExcludePnModel> phoneNum3 = [];
|
|
|
|
|
|
|
|
List 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() {
|
|
|
@ -56,7 +62,7 @@ class _CallRecordsListState extends State<CallRecordsList> {
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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,
|
|
|
@ -85,13 +91,13 @@ class _CallRecordsListState extends State<CallRecordsList> {
|
|
|
|
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 {
|
|
|
|
var res=await apiClient.request(API.exclude.add,data: {});
|
|
|
|
|
|
|
|
print(phoneNum3);
|
|
|
|
print(phoneNum3);
|
|
|
|
|
|
|
|
var res = await ExcludeFunc.getContactsList(phoneNum3);
|
|
|
|
|
|
|
|
print(res);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// _easyRefreshController.callRefresh();
|
|
|
|
// _easyRefreshController.callRefresh();
|
|
|
|
// phoneNum3.clear();
|
|
|
|
// phoneNum3.clear();
|
|
|
@ -104,10 +110,9 @@ class _CallRecordsListState extends State<CallRecordsList> {
|
|
|
|
getList();
|
|
|
|
getList();
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child:
|
|
|
|
child: ListView.builder(
|
|
|
|
ListView.builder(
|
|
|
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return _getBox(phoneNum2[index],phoneNum2[index].num!);
|
|
|
|
return _getBox(phoneNum2[index], phoneNum2[index].num!,phoneNum2[index].name?? "");
|
|
|
|
},
|
|
|
|
},
|
|
|
|
itemCount: phoneNum2.length,
|
|
|
|
itemCount: phoneNum2.length,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -158,15 +163,18 @@ class _CallRecordsListState extends State<CallRecordsList> {
|
|
|
|
// );
|
|
|
|
// );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_getBox(PhoneNumModel item, String index) {
|
|
|
|
_getBox(PhoneNumModel item, String num,String name) {
|
|
|
|
return CheckboxListTile(
|
|
|
|
return CheckboxListTile(
|
|
|
|
onChanged: (bool? value) {
|
|
|
|
onChanged: (bool? value) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
item.state = value!;
|
|
|
|
item.state = value!;
|
|
|
|
if(item.state){
|
|
|
|
if (item.state) {
|
|
|
|
phoneNum3.add(index);
|
|
|
|
phoneNum3.add({"phone":num,"remark":name});
|
|
|
|
}else{
|
|
|
|
// phoneNum3.add((phone: num, remark: name));
|
|
|
|
phoneNum3.remove(index);
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
phoneNum3.remove({"phone":num,"remark":name});
|
|
|
|
|
|
|
|
// phoneNum3.remove(ExcludePnModel(phone: num, remark: name)) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|