|
|
|
@ -5,6 +5,11 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'package:project_telephony/ui/widget/scaffold_theme_widget.dart';
|
|
|
|
|
|
|
|
|
|
import '../../constants/api.dart';
|
|
|
|
|
import '../../model/exclude_phone_model.dart';
|
|
|
|
|
import '../../model/network/api_client.dart';
|
|
|
|
|
import '../../model/network/base_model.dart';
|
|
|
|
|
|
|
|
|
|
class ExcludeContactsPage extends StatefulWidget {
|
|
|
|
|
const ExcludeContactsPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
@ -17,7 +22,6 @@ class _ExcludeContactsPageState extends State<ExcludeContactsPage> {
|
|
|
|
|
List<String> numbers = [];
|
|
|
|
|
List<bool> status = [];
|
|
|
|
|
var flag = true;
|
|
|
|
|
bool _permissionDenied = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
@ -83,11 +87,20 @@ class _ExcludeContactsPageState extends State<ExcludeContactsPage> {
|
|
|
|
|
return ScaffoldThemeWidget(
|
|
|
|
|
title: "从通讯录添加",
|
|
|
|
|
bottom: "添加",
|
|
|
|
|
onTap: () {
|
|
|
|
|
onTap: () async {
|
|
|
|
|
List<Exclude> excludeList = [];
|
|
|
|
|
for (int i = 0; i < status.length; i++) {
|
|
|
|
|
if (status[i] == true) {
|
|
|
|
|
excludeList.add(
|
|
|
|
|
Exclude(phone: numbers[i], remark: contacts![i].displayName));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (status.contains(true)) {
|
|
|
|
|
// BotToast.showText(text: "有");
|
|
|
|
|
|
|
|
|
|
BaseModel res = await apiClient
|
|
|
|
|
.request(API.exclude.add, data: {'exclude': excludeList});
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
Get.back();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
BotToast.showText(text: "还未选中手机号");
|
|
|
|
|
}
|
|
|
|
|