master
parent
88891266f6
commit
adbf8fcdd7
@ -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,
|
||||||
// );
|
);
|
||||||
|
@ -1,234 +0,0 @@
|
|||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
||||||
// import 'package:project_telephony/utils/headers.dart';
|
|
||||||
// import 'package:project_telephony/utils/hive_store.dart';
|
|
||||||
//
|
|
||||||
// import '../../base/base_style.dart';
|
|
||||||
// import '../../model/hive/phone_model.dart';
|
|
||||||
// import '../exclude/exclude_contacts_page.dart';
|
|
||||||
// import '../exclude/exclude_single_page.dart';
|
|
||||||
// import '../widget/plone_back_button.dart';
|
|
||||||
//
|
|
||||||
// class CallListPage extends StatefulWidget {
|
|
||||||
// final String title;
|
|
||||||
// final List<PhoneNum> phoneNum;
|
|
||||||
// final int index;
|
|
||||||
// const CallListPage({Key? key, required this.title, required this.phoneNum,required this.index})
|
|
||||||
// : super(key: key);
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// _CallListPageState createState() => _CallListPageState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _CallListPageState extends State<CallListPage> {
|
|
||||||
// final EasyRefreshController _refreshController = EasyRefreshController();
|
|
||||||
// List<PhoneModel> messList = [];
|
|
||||||
// List<PhoneNum> numList = [];
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void dispose() {
|
|
||||||
// _refreshController.dispose();
|
|
||||||
// super.dispose();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return Scaffold(
|
|
||||||
// resizeToAvoidBottomInset: false,
|
|
||||||
// appBar: AppBar(
|
|
||||||
// centerTitle: true,
|
|
||||||
// elevation: 0,
|
|
||||||
// title: Text(
|
|
||||||
// widget.title,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: BaseStyle.fontSize34,
|
|
||||||
// color: BaseStyle.color333333,
|
|
||||||
// fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// // titleSpacing: 150.w,
|
|
||||||
// leading: const CloudBackButton(
|
|
||||||
// isSpecial: true,
|
|
||||||
// isSpecials: false,
|
|
||||||
// ),
|
|
||||||
// backgroundColor: kForeGroundColor),
|
|
||||||
// backgroundColor: Colors.white,
|
|
||||||
// body: EasyRefresh(
|
|
||||||
// firstRefresh: true,
|
|
||||||
// controller: _refreshController,
|
|
||||||
// header: MaterialHeader(),
|
|
||||||
// // footer: MaterialFooter(),
|
|
||||||
// onRefresh: () async {
|
|
||||||
// // await userProvider.updateUserInfo();
|
|
||||||
//
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// child: widget.phoneNum.isEmpty
|
|
||||||
// ? _getNullList()
|
|
||||||
// : _getNum(widget.phoneNum)
|
|
||||||
//
|
|
||||||
// // ListView(
|
|
||||||
// // children: [findList.isEmpty ? _getNullList() : _getNum()],
|
|
||||||
// // )
|
|
||||||
//
|
|
||||||
// ),
|
|
||||||
// bottomNavigationBar: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
// children: [
|
|
||||||
// 62.wb,
|
|
||||||
// _getBottom("号码添加", const Color(0xFF1890FF), () {
|
|
||||||
// Navigator.of(context)
|
|
||||||
// .push(
|
|
||||||
// MaterialPageRoute(builder: (_) => ExcludeSinglePage( qf: true,index: widget.index,)),
|
|
||||||
// )
|
|
||||||
// .then((value) => _refreshController.callRefresh());
|
|
||||||
// }, Colors.white, Colors.white, 2, const Color(0xFF1890FF), 58, 24),
|
|
||||||
// 32.wb,
|
|
||||||
// _getBottom("通讯录中添加", Colors.white, () {
|
|
||||||
// Navigator.of(context)
|
|
||||||
// .push(
|
|
||||||
// MaterialPageRoute(
|
|
||||||
// builder: (_) => ExcludeContactsPage(
|
|
||||||
// qf: true,
|
|
||||||
// index: widget.index,
|
|
||||||
// )),
|
|
||||||
// )
|
|
||||||
// .then((val) => _refreshController.callRefresh());
|
|
||||||
// }, const Color(0xFF74BCFF), const Color(0xFF1890FF), 0, Colors.white,
|
|
||||||
// 96, 24),
|
|
||||||
// 62.wb,
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _getBottom(String text, Color textColor, VoidCallback ontap, Color color1,
|
|
||||||
// Color color2, int border, Color borderColor, int h, int v) {
|
|
||||||
// return GestureDetector(
|
|
||||||
// onTap: ontap,
|
|
||||||
// child: Container(
|
|
||||||
// padding: EdgeInsets.symmetric(horizontal: h.w, vertical: v.w),
|
|
||||||
// margin: EdgeInsets.only(bottom: 32.w),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// borderRadius: BorderRadius.circular(8.w),
|
|
||||||
// gradient: LinearGradient(
|
|
||||||
// colors: [color1, color2],
|
|
||||||
// end: Alignment.centerRight,
|
|
||||||
// begin: Alignment.centerLeft),
|
|
||||||
// border: Border.all(width: border.w, color: borderColor)),
|
|
||||||
// child: Text(
|
|
||||||
// text,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 28.sp, color: textColor, fontWeight: FontWeight.w500),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _getNullList() {
|
|
||||||
// return Column(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
// // crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// 490.hb,
|
|
||||||
// Image.asset(
|
|
||||||
// Assets.icons.nullphonelist.path,
|
|
||||||
// width: 240.w,
|
|
||||||
// height: 212.w,
|
|
||||||
// fit: BoxFit.fill,
|
|
||||||
// ),
|
|
||||||
// 48.hb,
|
|
||||||
// Text(
|
|
||||||
// "这里是空的",
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: const Color(0xFF999999),
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// fontSize: 36.sp),
|
|
||||||
// ),
|
|
||||||
// 16.hb,
|
|
||||||
// Text(
|
|
||||||
// "还没有添加指定号码",
|
|
||||||
// style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
|
|
||||||
// ),
|
|
||||||
// 490.hb,
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _getNum(List<PhoneNum> item) {
|
|
||||||
// return ListView.builder(
|
|
||||||
// itemBuilder: (context, index) {
|
|
||||||
// return Container(
|
|
||||||
// margin: EdgeInsets.symmetric(horizontal: 16.w),
|
|
||||||
// child: ListTile(
|
|
||||||
// onTap: () async {},
|
|
||||||
// title: Text(
|
|
||||||
// item[index].name ?? "",
|
|
||||||
// style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// subtitle: Text(
|
|
||||||
// item[index].phone ?? "",
|
|
||||||
// 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 {
|
|
||||||
// // print("123");
|
|
||||||
// messList =
|
|
||||||
// await HiveStore.dataBox?.get("ml").cast<PhoneModel>();
|
|
||||||
// // numList = HiveStore.dataBox?.get("pl").cast<PhoneNum>();
|
|
||||||
// // print(item[index]);
|
|
||||||
// // messList.removeWhere((element) => (element.phoneList)!.contains(item[index]));
|
|
||||||
// // numList.remove(item[index]);
|
|
||||||
// messList[widget.index].phoneList!.remove(item[index]);
|
|
||||||
// HiveStore.dataBox?.put("ml", messList);
|
|
||||||
// print(HiveStore.dataBox?.get("ml"));
|
|
||||||
// _refreshController.callRefresh();
|
|
||||||
// // print(HiveStore.dataBox?.get("pl"));
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// "删除",
|
|
||||||
// style: TextStyle(fontSize: 28.sp, color: BaseStyle.color333333),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// // CheckboxListTile(
|
|
||||||
// // onChanged: (bool? value) {
|
|
||||||
// // setState(() {
|
|
||||||
// // item[index].state = value!;
|
|
||||||
// // if (item[index].state!) {
|
|
||||||
// // // 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[index].state,
|
|
||||||
// // title: Text(
|
|
||||||
// // item[index].name ?? "",
|
|
||||||
// // style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold),
|
|
||||||
// // ),
|
|
||||||
// // subtitle: Row(
|
|
||||||
// // children: [
|
|
||||||
// // Text(
|
|
||||||
// // item[index].phone ?? "",
|
|
||||||
// // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
|
|
||||||
// // ),
|
|
||||||
// // // 30.wb,
|
|
||||||
// // // Text(
|
|
||||||
// // // item.name == null ? "" : item.name!,
|
|
||||||
// // // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
|
|
||||||
// // // )
|
|
||||||
// // ],
|
|
||||||
// // ),
|
|
||||||
// // );
|
|
||||||
// },
|
|
||||||
// itemCount: widget.phoneNum.length,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,191 +0,0 @@
|
|||||||
// import 'package:bot_toast/bot_toast.dart';
|
|
||||||
// import 'package:flutter/cupertino.dart';
|
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
||||||
// import 'package:project_telephony/utils/headers.dart';
|
|
||||||
// import 'package:project_telephony/utils/user_tool.dart';
|
|
||||||
// import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
//
|
|
||||||
// import '../../base/base_style.dart';
|
|
||||||
// import '../home/add_sms_page.dart';
|
|
||||||
// import '../widget/plone_back_button.dart';
|
|
||||||
//
|
|
||||||
// typedef TextCallback = Function(String content);
|
|
||||||
// class TextTemplate extends StatefulWidget {
|
|
||||||
// final TextCallback callback;
|
|
||||||
// const TextTemplate({Key? key,required this.callback}) : super(key: key);
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// _TextTemplateState createState() => _TextTemplateState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _TextTemplateState extends State<TextTemplate> {
|
|
||||||
// EasyRefreshController refreshController = EasyRefreshController();
|
|
||||||
//
|
|
||||||
// List<String> textList = [];
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// addText();
|
|
||||||
// super.initState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// addText() async {
|
|
||||||
// final prefs = await SharedPreferences.getInstance();
|
|
||||||
// if (textList.length == 1) {
|
|
||||||
// prefs.setStringList("dxText", [
|
|
||||||
// "祝你万事顺心",
|
|
||||||
// "欢迎你的来电,祝你生活愉快",
|
|
||||||
// "感谢您的来电,我们会尽快处理",
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void dispose() {
|
|
||||||
// // TODO: implement dispose
|
|
||||||
// refreshController.dispose();
|
|
||||||
// super.dispose();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return Scaffold(
|
|
||||||
// resizeToAvoidBottomInset: false,
|
|
||||||
// appBar: AppBar(
|
|
||||||
// elevation: 0,
|
|
||||||
// title: Text(
|
|
||||||
// '短信模版',
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: BaseStyle.fontSize34,
|
|
||||||
// color: BaseStyle.color333333,
|
|
||||||
// fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// titleSpacing: 162.w,
|
|
||||||
// leading: const CloudBackButton(isSpecial: true),
|
|
||||||
// backgroundColor: kForeGroundColor),
|
|
||||||
// backgroundColor: Colors.white,
|
|
||||||
// body: EasyRefresh(
|
|
||||||
// firstRefresh: true,
|
|
||||||
// controller: refreshController,
|
|
||||||
// header: MaterialHeader(),
|
|
||||||
// footer: MaterialFooter(),
|
|
||||||
// onRefresh: () async {
|
|
||||||
// final prefs = await SharedPreferences.getInstance();
|
|
||||||
// textList = prefs.getStringList("dxText") ?? [];
|
|
||||||
// textList.add("自定义短信模版");
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// child: ListView(
|
|
||||||
// children: [
|
|
||||||
// SizedBox(
|
|
||||||
// height: 1000.w,
|
|
||||||
// child: ListView.builder(
|
|
||||||
// itemBuilder: (context, index) {
|
|
||||||
// return _getListContent(textList[index], index);
|
|
||||||
// },
|
|
||||||
// itemCount: textList.length,
|
|
||||||
// ))
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _getListContent(String item, int index) {
|
|
||||||
// return GestureDetector(
|
|
||||||
// onTap: () async {
|
|
||||||
// if (item != "自定义短信模版") {
|
|
||||||
// // BotToast.showText(text: item);
|
|
||||||
// widget.callback(item);
|
|
||||||
// Get.back();
|
|
||||||
// } else {
|
|
||||||
// if (UserTool.userProvider.userInfo.isVip == 1) {
|
|
||||||
// if (textList.length > 5) {
|
|
||||||
// BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
|
|
||||||
// } else {
|
|
||||||
// Navigator.of(context)
|
|
||||||
// .push(
|
|
||||||
// MaterialPageRoute(
|
|
||||||
// builder: (_) => AddSmsPage(status: 0, ploneBack: (String textContent) { },qfBool: true,)),
|
|
||||||
// )
|
|
||||||
// .then((val) =>refreshController.callRefresh());
|
|
||||||
// // textList.add("value");
|
|
||||||
// // await prefs.setStringList("dxTExt", textList);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// BotToast.showText(text: '请先开通会员');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// onLongPress: () {
|
|
||||||
// if (item != "自定义短信模版") {
|
|
||||||
// if (textList.length == 3) {
|
|
||||||
// BotToast.showText(text: '内容不可删除');
|
|
||||||
// } else {
|
|
||||||
// showDialog(
|
|
||||||
// context: context,
|
|
||||||
// builder: (context) {
|
|
||||||
// return CupertinoAlertDialog(
|
|
||||||
// title: const Text("删除短信模板"),
|
|
||||||
// content: Column(
|
|
||||||
// children: [
|
|
||||||
// SizedBox(
|
|
||||||
// height: 10.w,
|
|
||||||
// ),
|
|
||||||
// const Align(
|
|
||||||
// child: Text("你确定要删除这个短信模版吗,删除之后无法还原。"),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// actions: [
|
|
||||||
// CupertinoDialogAction(
|
|
||||||
// textStyle: const TextStyle(color: Color(0xFF999999)),
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.pop(context);
|
|
||||||
// },
|
|
||||||
// child: const Text("取消"),
|
|
||||||
// ),
|
|
||||||
// CupertinoDialogAction(
|
|
||||||
// child: const Text("确定"),
|
|
||||||
// onPressed: () async {
|
|
||||||
// final prefs = await SharedPreferences.getInstance();
|
|
||||||
// textList.remove(item[index]);
|
|
||||||
// await prefs.setStringList("dxIndex", textList);
|
|
||||||
// refreshController.callRefresh();
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// child: Container(
|
|
||||||
// // width: 686.w,
|
|
||||||
// height: 128.w,
|
|
||||||
// margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
|
|
||||||
// padding: EdgeInsets.only(left: 40.w, top: 45.w),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// borderRadius: BorderRadius.circular(16.w),
|
|
||||||
// gradient: const LinearGradient(
|
|
||||||
// begin: Alignment.centerLeft,
|
|
||||||
// end: Alignment.centerRight,
|
|
||||||
// colors: [
|
|
||||||
// Color(0xFFF9F9F9),
|
|
||||||
// Color(0xFFF9F9F9),
|
|
||||||
// ]),
|
|
||||||
// ),
|
|
||||||
// child: Text(
|
|
||||||
// item,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: BaseStyle.fontSize28,
|
|
||||||
// color: BaseStyle.color333333,
|
|
||||||
// fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,134 +0,0 @@
|
|||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
// import 'package:get/get.dart';
|
|
||||||
// import 'package:provider/provider.dart';
|
|
||||||
// import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
//
|
|
||||||
// import '../../base/base_style.dart';
|
|
||||||
// import '../../constants/api.dart';
|
|
||||||
// import '../../model/network/api_client.dart';
|
|
||||||
// import '../../model/network/base_model.dart';
|
|
||||||
// import '../../providers/user_provider.dart';
|
|
||||||
// import '../../utils/toast/cloud_toast.dart';
|
|
||||||
// import '../user/content_details_page.dart';
|
|
||||||
// import '../widget/plone_back_button.dart';
|
|
||||||
// import '../widget/plone_bottom.dart';
|
|
||||||
//
|
|
||||||
// class AddSmsPage extends StatefulWidget {
|
|
||||||
// final int status;
|
|
||||||
// final TextCallback ploneBack;
|
|
||||||
// final bool qfBool;
|
|
||||||
// const AddSmsPage({Key? key, required this.status, required this.ploneBack,this.qfBool=false}) : super(key: key);
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// _AddSmsPageState createState() => _AddSmsPageState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _AddSmsPageState extends State<AddSmsPage> {
|
|
||||||
// late TextEditingController _controller;
|
|
||||||
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
|
||||||
// String contant="";
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// super.initState();
|
|
||||||
// _controller = TextEditingController();
|
|
||||||
// }
|
|
||||||
// // final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return Scaffold(
|
|
||||||
// resizeToAvoidBottomInset: false,
|
|
||||||
// appBar: AppBar(
|
|
||||||
// elevation: 0,
|
|
||||||
// title: Text(
|
|
||||||
// '编辑短信标签',
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: BaseStyle.fontSize34,
|
|
||||||
// color: BaseStyle.color333333,
|
|
||||||
// fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// titleSpacing: 162.w,
|
|
||||||
// leading: const CloudBackButton(isSpecial: true),
|
|
||||||
// backgroundColor: kForeGroundColor),
|
|
||||||
// backgroundColor: Colors.white,
|
|
||||||
// body: Align(
|
|
||||||
// alignment: Alignment.topCenter,
|
|
||||||
// child: Container(
|
|
||||||
// height: 800.w,
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: const Color(0xFFF9F9F9),
|
|
||||||
// borderRadius: BorderRadius.circular(16.w),
|
|
||||||
// ),
|
|
||||||
// padding: EdgeInsets.all(30.w),
|
|
||||||
// margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w),
|
|
||||||
// child: TextField(
|
|
||||||
// maxLines: 100,
|
|
||||||
// keyboardType: TextInputType.text,
|
|
||||||
// onEditingComplete: () {
|
|
||||||
// setState(() {});
|
|
||||||
// // _refreshController.callRefresh();
|
|
||||||
// },
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: BaseStyle.color333333,
|
|
||||||
// fontSize: BaseStyle.fontSize28,
|
|
||||||
// ),
|
|
||||||
// onChanged: (text) async{
|
|
||||||
// contant=text;
|
|
||||||
// setState((){});
|
|
||||||
// },
|
|
||||||
// controller: _controller,
|
|
||||||
// decoration: const InputDecoration(
|
|
||||||
// fillColor: Colors.transparent,
|
|
||||||
// contentPadding: EdgeInsets.zero,
|
|
||||||
// filled: true,
|
|
||||||
// isDense: true,
|
|
||||||
// hintText: "请输入所需短信标签",
|
|
||||||
// border: InputBorder.none,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// bottomNavigationBar: PloneBottom(
|
|
||||||
// border: _controller.text.isEmpty,
|
|
||||||
// opacity: contant.isEmpty ? 0.4 : 1,
|
|
||||||
// onTap: () async {
|
|
||||||
// final prefs = await SharedPreferences.getInstance();
|
|
||||||
// List<String>? contentList=prefs.getStringList("dxText");
|
|
||||||
// if(widget.qfBool){
|
|
||||||
// contentList?.add(contant);
|
|
||||||
// await prefs.setStringList("dxText", contentList!);
|
|
||||||
// Get.back();
|
|
||||||
// }else{
|
|
||||||
// BaseModel res = await apiClient.request(API.content.content, data: {
|
|
||||||
// 'content': _controller.text,
|
|
||||||
// 'status': widget.status,
|
|
||||||
// });
|
|
||||||
// if (res.code == 0) {
|
|
||||||
// setState(() {});
|
|
||||||
// widget.ploneBack(_controller.text);
|
|
||||||
// switch (widget.status) {
|
|
||||||
// case 1:
|
|
||||||
// await userProvider.updateConSms();
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// await userProvider.updateRefSms();
|
|
||||||
// break;
|
|
||||||
// case 3:
|
|
||||||
// await userProvider.updateCallSms();
|
|
||||||
// break;
|
|
||||||
// case 4:
|
|
||||||
// await userProvider.updateIdleSms();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// CloudToast.show(res.msg);
|
|
||||||
// }
|
|
||||||
// Get.back();}
|
|
||||||
// },
|
|
||||||
// text: "保存",
|
|
||||||
// ).paddingOnly(bottom: 30.w),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,279 +0,0 @@
|
|||||||
// import 'package:bot_toast/bot_toast.dart';
|
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
||||||
// import 'package:project_telephony/utils/headers.dart';
|
|
||||||
// import 'package:provider/provider.dart';
|
|
||||||
//
|
|
||||||
// import '../../base/base_style.dart';
|
|
||||||
// import '../../constants/api.dart';
|
|
||||||
// import '../../model/contant_list_model.dart';
|
|
||||||
// import '../../model/network/api_client.dart';
|
|
||||||
// import '../../model/network/base_model.dart';
|
|
||||||
// import '../../model/sms_content_model.dart';
|
|
||||||
// import '../../providers/user_provider.dart';
|
|
||||||
// import '../../utils/toast/cloud_toast.dart';
|
|
||||||
// import '../widget/centertipsalterwidget.dart';
|
|
||||||
// import 'add_sms_page.dart';
|
|
||||||
//
|
|
||||||
// class AnswerIdleList extends StatefulWidget {
|
|
||||||
// final EasyRefreshController refreshController;
|
|
||||||
// final bool isIdle;
|
|
||||||
// final int num;
|
|
||||||
//
|
|
||||||
// const AnswerIdleList(
|
|
||||||
// {Key? key, required this.refreshController, required this.isIdle,required this.num})
|
|
||||||
// : super(key: key);
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// _AnswerIdleListState createState() => _AnswerIdleListState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _AnswerIdleListState extends State<AnswerIdleList>
|
|
||||||
// with AutomaticKeepAliveClientMixin {
|
|
||||||
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
|
||||||
// List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容'];
|
|
||||||
// List<SmsContentModel> _model = [];
|
|
||||||
// List<ContantListModel> answerList=[];
|
|
||||||
// List<String> textListSMS = [];
|
|
||||||
// List<int> smsIdList = [];
|
|
||||||
// int isCheck = 0;
|
|
||||||
// bool val = true;
|
|
||||||
//
|
|
||||||
// // final EasyRefreshController _easyRefreshController = EasyRefreshController();
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return Column(
|
|
||||||
// children: [
|
|
||||||
// _getText(),
|
|
||||||
// 32.hb,
|
|
||||||
// widget.isIdle
|
|
||||||
// ? val
|
|
||||||
// ? Expanded(
|
|
||||||
// // width: 662.w,
|
|
||||||
// // height: 800.w,
|
|
||||||
// child: EasyRefresh.custom(
|
|
||||||
// firstRefresh: true,
|
|
||||||
// controller: widget.refreshController,
|
|
||||||
// header: MaterialHeader(),
|
|
||||||
// // footer: MaterialFooter(),
|
|
||||||
// onRefresh: () async {
|
|
||||||
// await userProvider.updateUserInfo();
|
|
||||||
// print("这是数据$answerList");
|
|
||||||
// // userProvider.updateRefSms();
|
|
||||||
// // updateList();
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// slivers: [
|
|
||||||
// SliverList(
|
|
||||||
// delegate:
|
|
||||||
// SliverChildBuilderDelegate((context, index) {
|
|
||||||
// return _getBox(answerList[index], index);
|
|
||||||
// }, childCount: answerList.length)),
|
|
||||||
// ]))
|
|
||||||
// : _getEmptyList()
|
|
||||||
// : Expanded(
|
|
||||||
// // width: 662.w,
|
|
||||||
// // height: 800.w,
|
|
||||||
// child: EasyRefresh.custom(
|
|
||||||
// firstRefresh: true,
|
|
||||||
// controller: widget.refreshController,
|
|
||||||
// header: MaterialHeader(),
|
|
||||||
// // footer: MaterialFooter(),
|
|
||||||
// onRefresh: () async {
|
|
||||||
// await userProvider.updateUserInfo();
|
|
||||||
// print("这是数据$answerList");
|
|
||||||
// // userProvider.updateRefSms();
|
|
||||||
// // updateList();
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// slivers: [
|
|
||||||
// SliverList(
|
|
||||||
// delegate:
|
|
||||||
// SliverChildBuilderDelegate((context, index) {
|
|
||||||
// return _getBox(answerList[index], index);
|
|
||||||
// }, childCount: answerList.length))
|
|
||||||
// ]))
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// updateList() async {
|
|
||||||
// if (userProvider.isLogin) {
|
|
||||||
// // textListSMS.clear();
|
|
||||||
// // smsIdList.clear();
|
|
||||||
// int i = 0;
|
|
||||||
// // contentRef
|
|
||||||
// var base = await apiClient.request(API.content.findByStatus, data: {'status': 1});
|
|
||||||
// if (base.code == 0) {
|
|
||||||
// _model=(base.data as List)
|
|
||||||
// .map((e) => SmsContentModel.fromJson(e))
|
|
||||||
// .toList();
|
|
||||||
// } else {
|
|
||||||
// CloudToast.show(base.msg);
|
|
||||||
// }
|
|
||||||
// for (var model in _model) {
|
|
||||||
// textListSMS.add(model.content);
|
|
||||||
// smsIdList.add(model.id);
|
|
||||||
// if (model.isChecked == 1) {
|
|
||||||
// isCheck = i;
|
|
||||||
// }
|
|
||||||
// i++;
|
|
||||||
// }
|
|
||||||
// textListSMS.add("自定义短信内容");
|
|
||||||
// } else {
|
|
||||||
// textListSMS = textList;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _getText() {
|
|
||||||
// return Container(
|
|
||||||
// height: 128.w,
|
|
||||||
// // margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
|
|
||||||
// padding: EdgeInsets.only(left: 40.w, top: 45.w),
|
|
||||||
// child: ListTile(
|
|
||||||
// title: Text(
|
|
||||||
// "功能讲解",
|
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp),
|
|
||||||
// ),
|
|
||||||
// subtitle: Text(
|
|
||||||
// widget.isIdle
|
|
||||||
// ? "您给朋友去电接听后所发送的短信":"朋友给你来电接听后所发送的短信",
|
|
||||||
// style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
|
|
||||||
// ),
|
|
||||||
// trailing: widget.isIdle
|
|
||||||
// ? Switch(
|
|
||||||
// value: val,
|
|
||||||
// onChanged: (value) async {
|
|
||||||
// // if(!value){
|
|
||||||
// //
|
|
||||||
// // }
|
|
||||||
// // await prefs.setBool("kg", value);
|
|
||||||
// // print("这是数据${prefs.getBool("kg")}");
|
|
||||||
// setState(() {
|
|
||||||
// val = value;
|
|
||||||
// });
|
|
||||||
// })
|
|
||||||
// : const SizedBox()),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _getBox(ContantListModel item,int index) {
|
|
||||||
// return GestureDetector(
|
|
||||||
// onTap: () async {
|
|
||||||
// if (item.content != "自定义短信内容") {
|
|
||||||
// BaseModel res = await apiClient.request(API.content.checked,
|
|
||||||
// data: {'id': item.id, 'status': 1});
|
|
||||||
// if (res.code == 0) {
|
|
||||||
// setState(() {});
|
|
||||||
// userProvider.updateUserInfo();
|
|
||||||
// userProvider.updateConSms();
|
|
||||||
// widget.refreshController.callRefresh();
|
|
||||||
// } else {
|
|
||||||
// CloudToast.show(res.msg);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (userProvider.userInfo.isVip == 1) {
|
|
||||||
// if (answerList.length > 5) {
|
|
||||||
// BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
|
|
||||||
// } else {
|
|
||||||
// Get.to(AddSmsPage(
|
|
||||||
// status: 1,
|
|
||||||
// ploneBack: (String textContent) {
|
|
||||||
// widget.refreshController.callRefresh();
|
|
||||||
// },
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// BotToast.showText(text: '请先开通会员');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// onLongPress: () {
|
|
||||||
// if (item.content != "自定义短信内容") {
|
|
||||||
// if (answerList.length == 2 || isCheck == index) {
|
|
||||||
// if (answerList.length == 2) {
|
|
||||||
// BotToast.showText(text: '最后一条内容不可删除');
|
|
||||||
// } else if (isCheck == index) {
|
|
||||||
// BotToast.showText(text: '当前为选中内容,不可删除');
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// showDialog(
|
|
||||||
// context: context,
|
|
||||||
// builder: (context) {
|
|
||||||
// return Centertipsalterwidget(
|
|
||||||
// desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
|
|
||||||
// title: '删除短信模板',
|
|
||||||
// id: item.id,
|
|
||||||
// callback: (bool status) {
|
|
||||||
// widget.refreshController.callRefresh();
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// child: Container(
|
|
||||||
// // width: 686.w,
|
|
||||||
// height: 128.w,
|
|
||||||
// margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
|
|
||||||
// padding: EdgeInsets.only(left: 40.w, top: 45.w),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// borderRadius: BorderRadius.circular(16),
|
|
||||||
// gradient: LinearGradient(
|
|
||||||
// begin: Alignment.centerLeft,
|
|
||||||
// end: Alignment.centerRight,
|
|
||||||
// colors: [
|
|
||||||
// index == isCheck
|
|
||||||
// ? const Color(0xFF1890FF)
|
|
||||||
// : const Color(0xFFF9F9F9),
|
|
||||||
// index == isCheck
|
|
||||||
// ? const Color(0xFF74BCFF)
|
|
||||||
// : const Color(0xFFF9F9F9),
|
|
||||||
// ]),
|
|
||||||
// ),
|
|
||||||
// child: Text(
|
|
||||||
// item.content,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: BaseStyle.fontSize28,
|
|
||||||
// color: index == isCheck
|
|
||||||
// ? const Color(0xFFF9F9F9)
|
|
||||||
// : BaseStyle.color333333,
|
|
||||||
// fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _getEmptyList() {
|
|
||||||
// return Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// 234.hb,
|
|
||||||
// Image.asset(
|
|
||||||
// Assets.images.emptylist.path,
|
|
||||||
// width: 240.w,
|
|
||||||
// height: 212.w,
|
|
||||||
// fit: BoxFit.fill,
|
|
||||||
// ),
|
|
||||||
// 48.hb,
|
|
||||||
// Text(
|
|
||||||
// "功能已关闭",
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: const Color(0xFF999999),
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// fontSize: 36.sp),
|
|
||||||
// ),
|
|
||||||
// 16.hb,
|
|
||||||
// Text(
|
|
||||||
// "去电接听后将不会发送短信",
|
|
||||||
// style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// bool get wantKeepAlive => true;
|
|
||||||
// }
|
|
@ -1,63 +0,0 @@
|
|||||||
//
|
|
||||||
//
|
|
||||||
// import 'dart:async';
|
|
||||||
//
|
|
||||||
// import 'package:call_log/call_log.dart';
|
|
||||||
// import 'package:flutter_sms/flutter_sms.dart';
|
|
||||||
// import 'package:get/get_utils/get_utils.dart';
|
|
||||||
// import 'package:telephony/telephony.dart';
|
|
||||||
// import 'package:workmanager/workmanager.dart';
|
|
||||||
//
|
|
||||||
// import '../user/user_page.dart';
|
|
||||||
// Future<void> _sendSMS(String message, List<String> recipients) async {
|
|
||||||
// // await sendSMS(message: message, recipients: recipients, sendDirect: true);
|
|
||||||
// try{
|
|
||||||
// String result =
|
|
||||||
// await sendSMS(message: message, recipients: recipients, sendDirect: true);
|
|
||||||
// print(result);
|
|
||||||
// } catch (error){
|
|
||||||
// print(error.toString());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// void callbackDispatcher() {
|
|
||||||
// Workmanager().executeTask((task, inputData) async{
|
|
||||||
// // _sendSMS("感谢来电", ["13486828191"]);
|
|
||||||
// // ${Telephony.backgroundInstance.sendSms(to: "13486828191", message: "message")}
|
|
||||||
// print("123412312412312312431231231231231231313123:${ _sendSMS("感谢来电", ["13486828191"])}");
|
|
||||||
// await sendSMS(message: "感谢来电", recipients: ["1348å6828191"], sendDirect: true);
|
|
||||||
// // sms();//simpleTask will be emitted here.
|
|
||||||
// return Future.value(true);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// void sms() async{
|
|
||||||
// int flag = 0;
|
|
||||||
// String phoneNum="";
|
|
||||||
// String callState;
|
|
||||||
// CallState state = await Telephony.instance.callState;
|
|
||||||
// callState = state.name;
|
|
||||||
// // print(callState!+" $flag");
|
|
||||||
// if (callState == "IDLE") {
|
|
||||||
// if (flag != 0) {
|
|
||||||
// flag = 0;
|
|
||||||
// // print("object");
|
|
||||||
// final Iterable<CallLogEntry> result = await CallLog.query();
|
|
||||||
// phoneNum = result.first.number!;
|
|
||||||
// if(phoneNum.isEmpty){
|
|
||||||
// print("At Least 1 Person or Message Required");
|
|
||||||
// }else{
|
|
||||||
// print("你好$phoneNum");
|
|
||||||
// // telephony.sendSms(to: phoneNum, message: "1234");
|
|
||||||
// _sendSMS('感谢来电',[phoneNum]);
|
|
||||||
// // print("你好123123$phoneNum");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else if (callState == "RINGING") {
|
|
||||||
// flag++;
|
|
||||||
// print('flag $flag');
|
|
||||||
// } else if (callState == "OFFHOOK") {
|
|
||||||
// flag++;
|
|
||||||
// print('flag $flag');
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
@ -1,326 +0,0 @@
|
|||||||
// import 'package:bot_toast/bot_toast.dart';
|
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
||||||
// import 'package:project_telephony/utils/headers.dart';
|
|
||||||
// import 'package:provider/provider.dart';
|
|
||||||
// import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
//
|
|
||||||
// import '../../base/base_style.dart';
|
|
||||||
// import '../../constants/api.dart';
|
|
||||||
// import '../../model/network/api_client.dart';
|
|
||||||
// import '../../model/network/base_model.dart';
|
|
||||||
// import '../../model/sms_content_model.dart';
|
|
||||||
// import '../../providers/user_provider.dart';
|
|
||||||
// import '../../utils/toast/cloud_toast.dart';
|
|
||||||
// import '../widget/centertipsalterwidget.dart';
|
|
||||||
// import 'add_sms_page.dart';
|
|
||||||
// import 'home_page.dart';
|
|
||||||
//
|
|
||||||
// class CallingIdleList extends StatefulWidget {
|
|
||||||
// final EasyRefreshController refreshController;
|
|
||||||
// final String title;
|
|
||||||
// final int status;
|
|
||||||
// final String? name;
|
|
||||||
// final Color themeColor;
|
|
||||||
//
|
|
||||||
// const CallingIdleList({
|
|
||||||
// Key? key,
|
|
||||||
// required this.title,
|
|
||||||
// required this.status,
|
|
||||||
// this.name = '',
|
|
||||||
// required this.themeColor,
|
|
||||||
// required this.refreshController,
|
|
||||||
// }) : super(key: key);
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// _CallingIdleListState createState() => _CallingIdleListState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _CallingIdleListState extends State<CallingIdleList>
|
|
||||||
// with AutomaticKeepAliveClientMixin {
|
|
||||||
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
|
||||||
// final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
|
|
||||||
// List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容'];
|
|
||||||
// List<SmsContentModel> _model = [];
|
|
||||||
// List<String> textListSMS = [];
|
|
||||||
// List<int> smsIdList = [];
|
|
||||||
// int isCheck = 0;
|
|
||||||
// late bool val = true;
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// super.initState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Future<void> getSwitch() async {
|
|
||||||
// final SharedPreferences prefs = await _prefs;
|
|
||||||
// val = prefs.getBool(widget.name!) ?? false;
|
|
||||||
//
|
|
||||||
// print(val);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Future<void> updateList() async {
|
|
||||||
// if (userProvider.isLogin) {
|
|
||||||
// textListSMS.clear();
|
|
||||||
// smsIdList.clear();
|
|
||||||
// int i = 0;
|
|
||||||
// var base = await apiClient
|
|
||||||
// .request(API.content.findByStatus, data: {'status': widget.status});
|
|
||||||
// if (base.code == 0) {
|
|
||||||
// _model = (base.data as List)
|
|
||||||
// .map((e) => SmsContentModel.fromJson(e))
|
|
||||||
// .toList();
|
|
||||||
// } else {
|
|
||||||
// CloudToast.show(base.msg);
|
|
||||||
// }
|
|
||||||
// for (var model in _model) {
|
|
||||||
// textListSMS.add(model.content);
|
|
||||||
// smsIdList.add(model.id);
|
|
||||||
// if (model.isChecked == 1) {
|
|
||||||
// isCheck = i;
|
|
||||||
// }
|
|
||||||
// i++;
|
|
||||||
// }
|
|
||||||
// textListSMS.add("自定义短信内容");
|
|
||||||
// } else {
|
|
||||||
// textListSMS = textList;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return EasyRefresh(
|
|
||||||
// firstRefresh: true,
|
|
||||||
// controller: widget.refreshController,
|
|
||||||
// header: MaterialHeader(),
|
|
||||||
// // footer: MaterialFooter(),
|
|
||||||
// onRefresh: () async {
|
|
||||||
// // await userProvider.updateUserInfo();
|
|
||||||
// getSwitch();
|
|
||||||
// await updateList();
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// child: ListView(
|
|
||||||
// children: [
|
|
||||||
// _getText(),
|
|
||||||
// 32.hb,
|
|
||||||
// // _getEmptyList(),
|
|
||||||
// widget.name!.isEmpty || val
|
|
||||||
// ?
|
|
||||||
// SizedBox(
|
|
||||||
// height: 1000.w,
|
|
||||||
// child: ListView.builder(
|
|
||||||
// itemBuilder: (context, index) {
|
|
||||||
// return _getBox(textListSMS[index], index);
|
|
||||||
// },
|
|
||||||
// itemCount: textListSMS.length,
|
|
||||||
// ))
|
|
||||||
// : _getEmptyList(),
|
|
||||||
// // SliverList(
|
|
||||||
// // delegate: SliverChildBuilderDelegate((context, index) {
|
|
||||||
// // return _getBox(textListSMS[index], index);
|
|
||||||
// // }, childCount: textListSMS.length),
|
|
||||||
// // ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// // Column(
|
|
||||||
// // children: [
|
|
||||||
// // _getText(),
|
|
||||||
// // 32.hb,
|
|
||||||
// // widget.name!.isEmpty || val
|
|
||||||
// // ? Expanded(
|
|
||||||
// // child: EasyRefresh.custom(
|
|
||||||
// // firstRefresh: true,
|
|
||||||
// // controller: widget.refreshController,
|
|
||||||
// // header: MaterialHeader(),
|
|
||||||
// // // footer: MaterialFooter(),
|
|
||||||
// // onRefresh: () async {
|
|
||||||
// // // await userProvider.updateUserInfo();
|
|
||||||
// // await updateList();
|
|
||||||
// // setState(() {});
|
|
||||||
// // },
|
|
||||||
// // slivers: [
|
|
||||||
// // SliverList(
|
|
||||||
// // delegate: SliverChildBuilderDelegate((context, index) {
|
|
||||||
// // return _getBox(textListSMS[index], index);
|
|
||||||
// // }, childCount: textListSMS.length),
|
|
||||||
// // ),
|
|
||||||
// // ],
|
|
||||||
// // ),
|
|
||||||
// // )
|
|
||||||
// // : _getEmptyList(),
|
|
||||||
// // ],
|
|
||||||
// // );
|
|
||||||
// }
|
|
||||||
// _getText() {
|
|
||||||
// return Container(
|
|
||||||
// height: 128.w,
|
|
||||||
// // width: 622.w,
|
|
||||||
// padding: EdgeInsets.only(left: 40.w, top: 45.w),
|
|
||||||
// child: ListTile(
|
|
||||||
// title: Text(
|
|
||||||
// "功能讲解",
|
|
||||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp),
|
|
||||||
// ),
|
|
||||||
// subtitle: Text(
|
|
||||||
// widget.title,
|
|
||||||
// style: TextStyle(color: const Color(0xFF999999), fontSize: 27.sp),
|
|
||||||
// ),
|
|
||||||
// trailing: Offstage(
|
|
||||||
// offstage: widget.name!.isEmpty,
|
|
||||||
// child: Switch(
|
|
||||||
// value: val,
|
|
||||||
// onChanged: (value) async {
|
|
||||||
// final SharedPreferences prefs = await _prefs;
|
|
||||||
// setState(() {
|
|
||||||
// val = value;
|
|
||||||
// prefs.remove(widget.name!);
|
|
||||||
// prefs.setBool(widget.name!, val );
|
|
||||||
// });
|
|
||||||
// service.invoke("stopService");
|
|
||||||
// if (prefs.getBool('kg')!) {
|
|
||||||
// Future.delayed(const Duration(seconds: 1), () async {
|
|
||||||
// service.startService();
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _getBox(String content, int index) {
|
|
||||||
// return GestureDetector(
|
|
||||||
// onTap: () async {
|
|
||||||
// if (content != "自定义短信内容") {
|
|
||||||
// BaseModel res = await apiClient.request(API.content.checked,
|
|
||||||
// data: {'id': smsIdList[index], 'status': widget.status});
|
|
||||||
// if (res.code == 0) {
|
|
||||||
// setState(() {});
|
|
||||||
// // await userProvider.updateUserInfo();
|
|
||||||
// switch (widget.status) {
|
|
||||||
// case 1:
|
|
||||||
// await userProvider.updateConSms();
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// await userProvider.updateRefSms();
|
|
||||||
// break;
|
|
||||||
// case 3:
|
|
||||||
// await userProvider.updateCallSms();
|
|
||||||
// break;
|
|
||||||
// case 4:
|
|
||||||
// await userProvider.updateIdleSms();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// widget.refreshController.callRefresh();
|
|
||||||
// } else {
|
|
||||||
// CloudToast.show(res.msg);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (userProvider.userInfo.isVip == 1) {
|
|
||||||
// if (textListSMS.length > 5) {
|
|
||||||
// BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
|
|
||||||
// } else {
|
|
||||||
// Get.to(
|
|
||||||
// AddSmsPage(
|
|
||||||
// status: widget.status,
|
|
||||||
// ploneBack: (String textContent) {
|
|
||||||
// widget.refreshController.callRefresh();
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// BotToast.showText(text: '请先开通会员');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// onLongPress: () {
|
|
||||||
// if (content != "自定义短信内容") {
|
|
||||||
// if (textListSMS.length == 2 || isCheck == index) {
|
|
||||||
// if (textListSMS.length == 2) {
|
|
||||||
// BotToast.showText(text: '最后一条内容不可删除');
|
|
||||||
// } else if (isCheck == index) {
|
|
||||||
// BotToast.showText(text: '当前为选中内容,不可删除');
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// showDialog(
|
|
||||||
// context: context,
|
|
||||||
// builder: (context) {
|
|
||||||
// return Centertipsalterwidget(
|
|
||||||
// desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
|
|
||||||
// title: '删除短信模板',
|
|
||||||
// id: smsIdList[index],
|
|
||||||
// callback: (bool status) {
|
|
||||||
// widget.refreshController.callRefresh();
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// setState(() {});
|
|
||||||
// },
|
|
||||||
// child: Container(
|
|
||||||
// // width: 686.w,
|
|
||||||
// height: 128.w,
|
|
||||||
// margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
|
|
||||||
// padding: EdgeInsets.only(left: 40.w, top: 45.w),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// borderRadius: BorderRadius.circular(16),
|
|
||||||
// gradient: LinearGradient(
|
|
||||||
// begin: Alignment.centerLeft,
|
|
||||||
// end: Alignment.centerRight,
|
|
||||||
// colors: [
|
|
||||||
// index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9),
|
|
||||||
// index == isCheck
|
|
||||||
// ? widget.themeColor.withOpacity(0.5)
|
|
||||||
// : const Color(0xFFF9F9F9),
|
|
||||||
// ]),
|
|
||||||
// ),
|
|
||||||
// child: Text(
|
|
||||||
// content,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: BaseStyle.fontSize28,
|
|
||||||
// color: index == isCheck
|
|
||||||
// ? const Color(0xFFF9F9F9)
|
|
||||||
// : BaseStyle.color333333,
|
|
||||||
// fontWeight: FontWeight.bold),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _getEmptyList() {
|
|
||||||
// return Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// 234.hb,
|
|
||||||
// Image.asset(
|
|
||||||
// Assets.images.emptylist.path,
|
|
||||||
// width: 240.w,
|
|
||||||
// height: 212.w,
|
|
||||||
// fit: BoxFit.fill,
|
|
||||||
// ),
|
|
||||||
// 48.hb,
|
|
||||||
// Text(
|
|
||||||
// "功能已关闭",
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: const Color(0xFF999999),
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// fontSize: 36.sp),
|
|
||||||
// ),
|
|
||||||
// 16.hb,
|
|
||||||
// Text(
|
|
||||||
// "去电拒接/未接后将不会发送短信",
|
|
||||||
// style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// bool get wantKeepAlive => true;
|
|
||||||
// }
|
|
@ -1,125 +0,0 @@
|
|||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
||||||
// import 'package:project_telephony/base/base_style.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/utils/headers.dart';
|
|
||||||
// import 'package:tab_indicator_styler/tab_indicator_styler.dart';
|
|
||||||
//
|
|
||||||
// class ContentConnectPage extends StatefulWidget {
|
|
||||||
// const ContentConnectPage({Key? key}) : super(key: key);
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// _ContentConnectPageState createState() => _ContentConnectPageState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _ContentConnectPageState extends State<ContentConnectPage>
|
|
||||||
// with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
|
|
||||||
// late TabController _tabController;
|
|
||||||
// final EasyRefreshController _answerRefreshController =
|
|
||||||
// EasyRefreshController();
|
|
||||||
// final EasyRefreshController _wasAnswerRefreshController =
|
|
||||||
// EasyRefreshController();
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// super.initState();
|
|
||||||
// _tabController = TabController(
|
|
||||||
// length: 2,
|
|
||||||
// initialIndex: 0,
|
|
||||||
// vsync: this,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void dispose() {
|
|
||||||
// _tabController.dispose();
|
|
||||||
// _answerRefreshController.dispose();
|
|
||||||
// _wasAnswerRefreshController.dispose();
|
|
||||||
// super.dispose();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// super.build(context);
|
|
||||||
// return Scaffold(
|
|
||||||
// appBar: AppBar(
|
|
||||||
// elevation: 0,
|
|
||||||
// title: Text(
|
|
||||||
// '选择短信内容',
|
|
||||||
// style: Theme.of(context).textTheme.headline6,
|
|
||||||
// ),
|
|
||||||
// leading: const CloudBackButton(isSpecial: true),
|
|
||||||
// backgroundColor: kForeGroundColor,
|
|
||||||
// ),
|
|
||||||
// backgroundColor: Colors.white,
|
|
||||||
// body: Column(
|
|
||||||
// children: [
|
|
||||||
// Container(
|
|
||||||
// width: double.infinity,
|
|
||||||
// height: 88.w,
|
|
||||||
// margin: EdgeInsets.symmetric(horizontal: 66.w),
|
|
||||||
// padding: EdgeInsets.all(8.w),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: const Color(0xFFF9F9F9),
|
|
||||||
// borderRadius: BorderRadius.all(Radius.circular(44.w))),
|
|
||||||
// child: TabBar(
|
|
||||||
// controller: _tabController,
|
|
||||||
// labelColor: const Color(0xFF1890FF),
|
|
||||||
// unselectedLabelColor: const Color(0xFF999999),
|
|
||||||
// unselectedLabelStyle:
|
|
||||||
// const TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
// labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
// onTap: (num) {
|
|
||||||
// if (num == 0) {
|
|
||||||
// _answerRefreshController.callRefresh();
|
|
||||||
// } else {
|
|
||||||
// _wasAnswerRefreshController.callRefresh();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// indicator: RectangularIndicator(
|
|
||||||
// color: Colors.white,
|
|
||||||
// bottomLeftRadius: 44.w,
|
|
||||||
// bottomRightRadius: 44.w,
|
|
||||||
// topLeftRadius: 44.w,
|
|
||||||
// topRightRadius: 44.w,
|
|
||||||
// // paintingStyle: PaintingStyle.fill,
|
|
||||||
// ),
|
|
||||||
// tabs: const [
|
|
||||||
// Tab(
|
|
||||||
// text: "被叫接听",
|
|
||||||
// ),
|
|
||||||
// Tab(
|
|
||||||
// text: "主叫接听",
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// child: TabBarView(
|
|
||||||
// controller: _tabController,
|
|
||||||
// children: [
|
|
||||||
// CallingIdleList(
|
|
||||||
// refreshController: _answerRefreshController,
|
|
||||||
// title: '朋友给你来电接听后所发送的短信',
|
|
||||||
// status: 1,
|
|
||||||
// themeColor: const Color(0xFF1890FF),
|
|
||||||
// ),
|
|
||||||
// CallingIdleList(
|
|
||||||
// refreshController: _answerRefreshController,
|
|
||||||
// name: "callSwitch",
|
|
||||||
// title: '您给朋友去电接听后所发送的短信',
|
|
||||||
// status: 3,
|
|
||||||
// themeColor: const Color(0xFF1890FF),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// bool get wantKeepAlive => true;
|
|
||||||
// }
|
|
@ -1,128 +0,0 @@
|
|||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
||||||
// import 'package:project_telephony/base/base_style.dart';
|
|
||||||
// import 'package:project_telephony/ui/widget/plone_back_button.dart';
|
|
||||||
// import 'package:project_telephony/utils/headers.dart';
|
|
||||||
// import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
// import 'package:tab_indicator_styler/tab_indicator_styler.dart';
|
|
||||||
//
|
|
||||||
// import 'calling_idle_list.dart';
|
|
||||||
//
|
|
||||||
// class ContentRefusePage extends StatefulWidget {
|
|
||||||
// const ContentRefusePage({Key? key}) : super(key: key);
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// _ContentRefusePageState createState() => _ContentRefusePageState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _ContentRefusePageState extends State<ContentRefusePage>
|
|
||||||
// with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
|
|
||||||
// late TabController _tabController;
|
|
||||||
// final EasyRefreshController _callingRefreshController =
|
|
||||||
// EasyRefreshController();
|
|
||||||
// final EasyRefreshController _wasCalledRefreshController =
|
|
||||||
// EasyRefreshController();
|
|
||||||
// bool? idleSwitch=true;
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// _tabController = TabController(length: 2, initialIndex: 0, vsync: this);
|
|
||||||
// getSwitch();
|
|
||||||
// super.initState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void dispose() {
|
|
||||||
// _tabController.dispose();
|
|
||||||
// _callingRefreshController.dispose();
|
|
||||||
// _wasCalledRefreshController.dispose();
|
|
||||||
// super.dispose();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Future<void> getSwitch()async{
|
|
||||||
// final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
||||||
// idleSwitch=prefs.getBool("idleSwitch");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// super.build(context);
|
|
||||||
// return Scaffold(
|
|
||||||
// appBar: AppBar(
|
|
||||||
// elevation: 0,
|
|
||||||
// title: Text(
|
|
||||||
// '选择短信内容',
|
|
||||||
// style: Theme.of(context).textTheme.headline6,
|
|
||||||
// ),
|
|
||||||
// leading: const CloudBackButton(isSpecial: true),
|
|
||||||
// backgroundColor: kForeGroundColor,
|
|
||||||
// ),
|
|
||||||
// backgroundColor: Colors.white,
|
|
||||||
// body: Column(
|
|
||||||
// children: [
|
|
||||||
// Container(
|
|
||||||
// width: double.infinity,
|
|
||||||
// height: 88.w,
|
|
||||||
// margin: EdgeInsets.symmetric(horizontal: 66.w),
|
|
||||||
// padding: EdgeInsets.all(8.w),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: const Color(0xFFF9F9F9),
|
|
||||||
// borderRadius: BorderRadius.all(Radius.circular(44.w))),
|
|
||||||
// child: TabBar(
|
|
||||||
// // indicator: Decoration(),
|
|
||||||
// controller: _tabController,
|
|
||||||
// labelColor: const Color(0xFF1890FF),
|
|
||||||
// unselectedLabelColor: const Color(0xFF999999),
|
|
||||||
// unselectedLabelStyle:
|
|
||||||
// const TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
// labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
// onTap: (num) {
|
|
||||||
// if (num == 0) {
|
|
||||||
// _callingRefreshController.callRefresh();
|
|
||||||
// } else {
|
|
||||||
// _wasCalledRefreshController.callRefresh();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// indicator: RectangularIndicator(
|
|
||||||
// color: Colors.white,
|
|
||||||
// bottomLeftRadius: 44.w,
|
|
||||||
// bottomRightRadius: 44.w,
|
|
||||||
// topLeftRadius: 44.w,
|
|
||||||
// topRightRadius: 44.w,
|
|
||||||
// ),
|
|
||||||
// tabs: const [
|
|
||||||
// Tab(
|
|
||||||
// text: "被叫拒接/未接",
|
|
||||||
// ),
|
|
||||||
// Tab(
|
|
||||||
// text: "主叫拒接/未接",
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// child: TabBarView(
|
|
||||||
// controller: _tabController,
|
|
||||||
// children:[
|
|
||||||
// CallingIdleList(
|
|
||||||
// status: 2,
|
|
||||||
// themeColor: const Color(0xFF13CA9D),
|
|
||||||
// title: '朋友给你来电接听后所发送的短信', refreshController: _callingRefreshController,
|
|
||||||
// ),
|
|
||||||
// CallingIdleList(
|
|
||||||
// name: "idleSwitch",
|
|
||||||
// status: 4,
|
|
||||||
// title: '您给朋友去电拒接/未接后所发送的短信',
|
|
||||||
// themeColor: const Color(0xFF13CA9D), refreshController: _wasCalledRefreshController,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// bool get wantKeepAlive => true;
|
|
||||||
// }
|
|
@ -0,0 +1,202 @@
|
|||||||
|
import 'package:call_log/call_log.dart';
|
||||||
|
import 'package:flustars/flustars.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyrefresh/easy_refresh.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/utils/headers.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
|
||||||
|
import '../../../../utils/toast/cloud_toast.dart';
|
||||||
|
import '../../../model/phone_num_model.dart';
|
||||||
|
import '../../widget/scaffold_theme_widget.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class CallRecordsList extends StatefulWidget {
|
||||||
|
const CallRecordsList({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_CallRecordsListState createState() => _CallRecordsListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CallRecordsListState extends State<CallRecordsList> {
|
||||||
|
List<PhoneNumModel> phoneNum = [];
|
||||||
|
List<PhoneNumModel> phoneNum2 = [];
|
||||||
|
// List<ExcludePnModel> phoneNum3 = [];
|
||||||
|
List phoneNum3=[];
|
||||||
|
// Map<String, String> get phoneNum3 => {};
|
||||||
|
|
||||||
|
final EasyRefreshController _easyRefreshController = EasyRefreshController();
|
||||||
|
late bool notifications;
|
||||||
|
late bool trackHistory;
|
||||||
|
late bool instantOrders;
|
||||||
|
late SharedPreferences prefs;
|
||||||
|
List<String> numList = [];
|
||||||
|
|
||||||
|
// List<String> =[]
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// getList();
|
||||||
|
getList();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_easyRefreshController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
getList() async {
|
||||||
|
phoneNum.clear();
|
||||||
|
final Iterable<CallLogEntry> entries = await CallLog.query();
|
||||||
|
for (CallLogEntry entrie in entries) {
|
||||||
|
if (!numList.contains(entrie.number)) {
|
||||||
|
numList.add(entrie.number!);
|
||||||
|
phoneNum.add(PhoneNumModel(
|
||||||
|
num: entrie.number,
|
||||||
|
time: entrie.timestamp,
|
||||||
|
name: entrie.name,
|
||||||
|
state: false,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < phoneNum.length; i++) {
|
||||||
|
phoneNum2.add(PhoneNumModel(
|
||||||
|
num: phoneNum[i].num,
|
||||||
|
time: phoneNum[i].time,
|
||||||
|
name: phoneNum[i].name,
|
||||||
|
state: phoneNum[i].state,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
// for (CallLogEntry entrie in entries) {
|
||||||
|
// if (!numList.contains(entrie.number)) {
|
||||||
|
// numList.add(entrie.number!);
|
||||||
|
// phoneNum.add(PhoneNumModel(
|
||||||
|
// num: entrie.number,
|
||||||
|
// time: entrie.timestamp,
|
||||||
|
// name: entrie.name,
|
||||||
|
// state: false,
|
||||||
|
// ));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ScaffoldThemeWidget(
|
||||||
|
bottom: '添加',
|
||||||
|
title: '从通话记录添加',
|
||||||
|
isBorder: true,
|
||||||
|
isOpacity: phoneNum3.isNotEmpty,
|
||||||
|
onTap: () async {
|
||||||
|
if (phoneNum3.isEmpty) {
|
||||||
|
CloudToast.show('请选择手机号');
|
||||||
|
} else {
|
||||||
|
// print(phoneNum3);
|
||||||
|
await ExcludeFunc.getContactsList(phoneNum3);
|
||||||
|
// Navigator.pop(context,true);
|
||||||
|
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();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// 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) {
|
||||||
|
return CheckboxListTile(
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() {
|
||||||
|
item.state = value!;
|
||||||
|
if (item.state) {
|
||||||
|
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,200 +0,0 @@
|
|||||||
// import 'package:call_log/call_log.dart';
|
|
||||||
// import 'package:flustars/flustars.dart';
|
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter_easyrefresh/easy_refresh.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/utils/headers.dart';
|
|
||||||
// import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
//
|
|
||||||
// import '../../../../model/phone_num_model.dart';
|
|
||||||
// import '../../../../utils/toast/cloud_toast.dart';
|
|
||||||
// import '../../../widget/scaffold_theme_widget.dart';
|
|
||||||
//
|
|
||||||
// class CallRecordsList extends StatefulWidget {
|
|
||||||
// const CallRecordsList({Key? key}) : super(key: key);
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// _CallRecordsListState createState() => _CallRecordsListState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _CallRecordsListState extends State<CallRecordsList> {
|
|
||||||
// List<PhoneNumModel> phoneNum = [];
|
|
||||||
// List<PhoneNumModel> phoneNum2 = [];
|
|
||||||
// // List<ExcludePnModel> phoneNum3 = [];
|
|
||||||
// List phoneNum3=[];
|
|
||||||
// // Map<String, String> get phoneNum3 => {};
|
|
||||||
//
|
|
||||||
// final EasyRefreshController _easyRefreshController = EasyRefreshController();
|
|
||||||
// late bool notifications;
|
|
||||||
// late bool trackHistory;
|
|
||||||
// late bool instantOrders;
|
|
||||||
// late SharedPreferences prefs;
|
|
||||||
// List<String> numList = [];
|
|
||||||
//
|
|
||||||
// // List<String> =[]
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// // getList();
|
|
||||||
// getList();
|
|
||||||
// super.initState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void dispose() {
|
|
||||||
// _easyRefreshController.dispose();
|
|
||||||
// super.dispose();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// getList() async {
|
|
||||||
// phoneNum.clear();
|
|
||||||
// final Iterable<CallLogEntry> entries = await CallLog.query();
|
|
||||||
// for (CallLogEntry entrie in entries) {
|
|
||||||
// if (!numList.contains(entrie.number)) {
|
|
||||||
// numList.add(entrie.number!);
|
|
||||||
// phoneNum.add(PhoneNumModel(
|
|
||||||
// num: entrie.number,
|
|
||||||
// time: entrie.timestamp,
|
|
||||||
// name: entrie.name,
|
|
||||||
// state: false,
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// for (int i = 0; i < phoneNum.length; i++) {
|
|
||||||
// phoneNum2.add(PhoneNumModel(
|
|
||||||
// num: phoneNum[i].num,
|
|
||||||
// time: phoneNum[i].time,
|
|
||||||
// name: phoneNum[i].name,
|
|
||||||
// state: phoneNum[i].state,
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
// // for (CallLogEntry entrie in entries) {
|
|
||||||
// // if (!numList.contains(entrie.number)) {
|
|
||||||
// // numList.add(entrie.number!);
|
|
||||||
// // phoneNum.add(PhoneNumModel(
|
|
||||||
// // num: entrie.number,
|
|
||||||
// // time: entrie.timestamp,
|
|
||||||
// // name: entrie.name,
|
|
||||||
// // state: false,
|
|
||||||
// // ));
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return ScaffoldThemeWidget(
|
|
||||||
// bottom: '添加',
|
|
||||||
// title: '从通话记录添加',
|
|
||||||
// isBorder: true,
|
|
||||||
// isOpacity: phoneNum3.isNotEmpty,
|
|
||||||
// onTap: () async {
|
|
||||||
// if (phoneNum3.isEmpty) {
|
|
||||||
// CloudToast.show('请选择手机号');
|
|
||||||
// } else {
|
|
||||||
// // print(phoneNum3);
|
|
||||||
// await ExcludeFunc.getContactsList(phoneNum3);
|
|
||||||
// // Navigator.pop(context,true);
|
|
||||||
// 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();
|
|
||||||
// // }
|
|
||||||
// // });
|
|
||||||
// // 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) {
|
|
||||||
// return CheckboxListTile(
|
|
||||||
// onChanged: (bool? value) {
|
|
||||||
// setState(() {
|
|
||||||
// item.state = value!;
|
|
||||||
// if (item.state) {
|
|
||||||
// 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),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
Loading…
Reference in new issue