|
|
@ -1,20 +1,21 @@
|
|
|
|
import 'package:call_log/call_log.dart';
|
|
|
|
|
|
|
|
import 'package:flustars/flustars.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/model/network/api_client.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.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/home_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/utils/headers.dart';
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
import 'package:project_telephony/ui/widget/plone_bottom.dart';
|
|
|
|
import 'package:project_telephony/ui/widget/plone_bottom.dart';
|
|
|
|
|
|
|
|
import 'package:project_telephony/utils/toast/cloud_toast.dart';
|
|
|
|
import '../../../base/base_style.dart';
|
|
|
|
import '../../../base/base_style.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../../../model/phone_num_model.dart';
|
|
|
|
import '../../../model/exclude_phone_model.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import '../../widget/centertipsalterwidget.dart';
|
|
|
|
|
|
|
|
import '../../widget/scaffold_theme_widget.dart';
|
|
|
|
import '../../widget/scaffold_theme_widget.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class SpecifyPhonePage extends StatefulWidget {
|
|
|
|
class SpecifyPhonePage extends StatefulWidget {
|
|
|
@ -26,6 +27,9 @@ class SpecifyPhonePage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
|
|
class _SpecifyPhonePageState extends State<SpecifyPhonePage> {
|
|
|
|
class _SpecifyPhonePageState extends State<SpecifyPhonePage> {
|
|
|
|
final EasyRefreshController _refreshController = EasyRefreshController();
|
|
|
|
final EasyRefreshController _refreshController = EasyRefreshController();
|
|
|
|
|
|
|
|
List<ExcludePhoneModel> findList = [
|
|
|
|
|
|
|
|
const ExcludePhoneModel(id: 0, phone: '123123123123', remark: '好的')
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
void dispose() {
|
|
|
@ -36,7 +40,7 @@ class _SpecifyPhonePageState extends State<SpecifyPhonePage> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ScaffoldThemeWidget(
|
|
|
|
return ScaffoldThemeWidget(
|
|
|
|
title: "发送号码设置",
|
|
|
|
title: "指定号码",
|
|
|
|
bottom: '添加',
|
|
|
|
bottom: '添加',
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
showModalBottomSheet(
|
|
|
|
showModalBottomSheet(
|
|
|
@ -57,13 +61,14 @@ class _SpecifyPhonePageState extends State<SpecifyPhonePage> {
|
|
|
|
child: ListView(
|
|
|
|
child: ListView(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
_getAddPhone("通话记录添加", "通过本机通话记录添加号码", () {
|
|
|
|
_getAddPhone("通话记录添加", "通过本机通话记录添加号码", () {
|
|
|
|
Get.to(() => ScaffoldThemeWidget(
|
|
|
|
Navigator.of(context)
|
|
|
|
bottom: '添加',
|
|
|
|
.push(
|
|
|
|
title: '从通话记录添加',
|
|
|
|
MaterialPageRoute(
|
|
|
|
isBorder: true,
|
|
|
|
builder: (_) => const CallRecordsList()),
|
|
|
|
isOpacity: false,
|
|
|
|
)
|
|
|
|
onTap: () {},
|
|
|
|
.then((val) => _getNullList());
|
|
|
|
child: const CallRecordsList()));
|
|
|
|
|
|
|
|
|
|
|
|
// Get.to(() => const CallRecordsList());
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
_getAddPhone("通迅录添加", "通过本机通讯录添加号码", () async {
|
|
|
|
_getAddPhone("通迅录添加", "通过本机通讯录添加号码", () async {
|
|
|
|
if(await Permission.contacts.isDenied){
|
|
|
|
if(await Permission.contacts.isDenied){
|
|
|
@ -113,18 +118,141 @@ class _SpecifyPhonePageState extends State<SpecifyPhonePage> {
|
|
|
|
header: MaterialHeader(),
|
|
|
|
header: MaterialHeader(),
|
|
|
|
// footer: MaterialFooter(),
|
|
|
|
// footer: MaterialFooter(),
|
|
|
|
onRefresh: () async {
|
|
|
|
onRefresh: () async {
|
|
|
|
|
|
|
|
// findList = await ExcludeFunc.getContacts();
|
|
|
|
// await userProvider.updateUserInfo();
|
|
|
|
// await userProvider.updateUserInfo();
|
|
|
|
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: ListView(
|
|
|
|
child: findList.isEmpty ? _getNullList() : _getNum()
|
|
|
|
children: [
|
|
|
|
|
|
|
|
_getNullList(),
|
|
|
|
// ListView(
|
|
|
|
],
|
|
|
|
// children: [findList.isEmpty ? _getNullList() : _getNum()],
|
|
|
|
)),
|
|
|
|
// )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_getNum() {
|
|
|
|
|
|
|
|
return ListView.builder(
|
|
|
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
|
|
|
return _getNumContant(findList[index]);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
itemCount: findList.length,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_getNumContant(ExcludePhoneModel item) {
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 16.w),
|
|
|
|
|
|
|
|
child: ListTile(
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
showDialog(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
builder: (context) {
|
|
|
|
|
|
|
|
return CupertinoAlertDialog(
|
|
|
|
|
|
|
|
title: Text(
|
|
|
|
|
|
|
|
"修改名称",
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
color: BaseStyle.color333333, fontSize: 34.sp),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
content: Column(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
"名称",
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 28.sp,
|
|
|
|
|
|
|
|
color: BaseStyle.color999999,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
24.hb,
|
|
|
|
|
|
|
|
CupertinoTextField(
|
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 24.w,vertical: 20.w),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
border: Border.all(color: Colors.white),
|
|
|
|
|
|
|
|
// borderRadius: BorderRadius.all(
|
|
|
|
|
|
|
|
// Radius.circular(4.w)
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
color: const Color(0xFFF9F9F9)),
|
|
|
|
|
|
|
|
placeholderStyle:
|
|
|
|
|
|
|
|
const TextStyle(color: BaseStyle.color333333),
|
|
|
|
|
|
|
|
placeholder: item.remark,
|
|
|
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
20.hb,
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
"号码",
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 28.sp,
|
|
|
|
|
|
|
|
color: BaseStyle.color999999,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
24.hb,
|
|
|
|
|
|
|
|
CupertinoTextField(
|
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 24.w,vertical: 20.w),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
border: Border.all(color: Colors.white),
|
|
|
|
|
|
|
|
// borderRadius: BorderRadius.all(
|
|
|
|
|
|
|
|
// Radius.circular(4.w)
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
color: const Color(0xFFF9F9F9)),
|
|
|
|
|
|
|
|
placeholder: item.phone,
|
|
|
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
82.hb,
|
|
|
|
|
|
|
|
// _getUpdate("爸爸", "123123123"),
|
|
|
|
|
|
|
|
PloneBottom(
|
|
|
|
|
|
|
|
blM:false,
|
|
|
|
|
|
|
|
border: true,
|
|
|
|
|
|
|
|
color1:const Color(0xFF1890FF),
|
|
|
|
|
|
|
|
color2:const Color(0xFF74BCFF),
|
|
|
|
|
|
|
|
onTap: () {},
|
|
|
|
|
|
|
|
text: "保存",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
title: Text(item.phone,
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 32.sp,
|
|
|
|
|
|
|
|
color: BaseStyle.color333333,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
|
|
|
|
subtitle: Text(
|
|
|
|
|
|
|
|
item.remark,
|
|
|
|
|
|
|
|
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
trailing: TextButton(
|
|
|
|
|
|
|
|
style: ButtonStyle(
|
|
|
|
|
|
|
|
side: MaterialStateProperty.all(
|
|
|
|
|
|
|
|
BorderSide(width: 2.w, color: const Color(0xFFE8E8E8)))),
|
|
|
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
var res =
|
|
|
|
|
|
|
|
await apiClient.request(API.exclude.find, data: {item.id});
|
|
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
|
|
_refreshController.callRefresh();
|
|
|
|
|
|
|
|
CloudToast.show(res.msg);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
CloudToast.show(res.msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
"删除",
|
|
|
|
|
|
|
|
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,
|
|
|
|