# Conflicts:
#	lib/ui/exclude/exclude_contacts_page.dart
#	lib/ui/exclude/exclude_single_page.dart
master
王亚玲 2 years ago
commit f75a5270fb

@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:project_telephony/ui/widget/scaffold_theme_widget.dart'; import 'package:project_telephony/ui/widget/scaffold_theme_widget.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:velocity_x/velocity_x.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../model/exclude_phone_model.dart'; import '../../model/exclude_phone_model.dart';
@ -36,7 +37,11 @@ class _ExcludeContactsPageState extends State<ExcludeContactsPage> {
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);
numbers.add(full!.phones.first.number); if(full?.phones.length==0){
numbers.add('');
}else{
numbers.add(full!.phones.first.number);
}
status.add(false); status.add(false);
} }
// await prefs.setStringList("addressList", numbers); // await prefs.setStringList("addressList", numbers);
@ -107,6 +112,7 @@ class _ExcludeContactsPageState extends State<ExcludeContactsPage> {
BaseModel res = await apiClient BaseModel res = await apiClient
.request(API.exclude.add, data: {'exclude': excludeList}); .request(API.exclude.add, data: {'exclude': excludeList});
if (res.code == 0) { if (res.code == 0) {
BotToast.showText(text: res.msg);
Get.back(); Get.back();
} }
} else { } else {

@ -1,9 +1,17 @@
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_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:project_telephony/ui/widget/scaffold_theme_widget.dart'; import 'package:project_telephony/ui/widget/scaffold_theme_widget.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import '../../constants/api.dart';
import '../../model/exclude_phone_model.dart';
import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart';
class ExcludeSinglePage extends StatefulWidget { class ExcludeSinglePage extends StatefulWidget {
const ExcludeSinglePage({Key? key}) : super(key: key); const ExcludeSinglePage({Key? key}) : super(key: key);
@ -35,13 +43,27 @@ class _ExcludeSinglePageState extends State<ExcludeSinglePage> {
wid: 110, wid: 110,
title: '添加单个或批量号码', title: '添加单个或批量号码',
bottom: "添加", bottom: "添加",
onTap: () { onTap: () async {
if (_phoneController.text.isEmpty) {
BotToast.showText(text: "未输入手机号");
} else {
BaseModel res = await apiClient.request(
API.exclude.add,
data: {
'exclude': [Exclude(
phone: _phoneController.text,
remark: _nameController.text,
)],
},
);
BotToast.showText(text: res.msg);
if (res.code == 0) {
Get.back();
}
}
}, },
isOpacity: isOpacity:
_phoneController.text.isNotEmpty && _nameController.text.isNotEmpty, _phoneController.text.isNotEmpty || _nameController.text.isNotEmpty,
child: Container( child: Container(
padding: EdgeInsets.only(top: 25.h, left: 50.w, right: 50.w), padding: EdgeInsets.only(top: 25.h, left: 50.w, right: 50.w),
child: Column( child: Column(
@ -62,7 +84,6 @@ class _ExcludeSinglePageState extends State<ExcludeSinglePage> {
color: Colors.black38, color: Colors.black38,
), ),
), ),
TextSpan( TextSpan(
text: "如输入000*可屏蔽所有000开头的号码", text: "如输入000*可屏蔽所有000开头的号码",
style: TextStyle( style: TextStyle(
@ -84,7 +105,7 @@ class _ExcludeSinglePageState extends State<ExcludeSinglePage> {
children: [ children: [
Text( Text(
title, title,
style: TextStyle( style: TextStyle(
fontSize: 28.sp, fontSize: 28.sp,
color: const Color(0xFF999999), color: const Color(0xFF999999),
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -99,7 +120,7 @@ class _ExcludeSinglePageState extends State<ExcludeSinglePage> {
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.all(30.w), contentPadding: EdgeInsets.all(30.w),
hintText: content, hintText: content,
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 28.sp, fontSize: 28.sp,
// fontWeight: FontWeight.w600, // fontWeight: FontWeight.w600,
color: const Color(0xFF999999), color: const Color(0xFF999999),

Loading…
Cancel
Save