|
|
@ -2,8 +2,6 @@ import 'package:bot_toast/bot_toast.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/ui/home/func/contant_func.dart';
|
|
|
|
|
|
|
|
import 'package:project_telephony/ui/widget/plone_bottom.dart';
|
|
|
|
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -23,13 +21,8 @@ class AnswerIdleList extends StatefulWidget {
|
|
|
|
final bool isIdle;
|
|
|
|
final bool isIdle;
|
|
|
|
final int num;
|
|
|
|
final int num;
|
|
|
|
|
|
|
|
|
|
|
|
// final List contant;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const AnswerIdleList(
|
|
|
|
const AnswerIdleList(
|
|
|
|
{Key? key,
|
|
|
|
{Key? key, required this.refreshController, required this.isIdle,required this.num})
|
|
|
|
required this.refreshController,
|
|
|
|
|
|
|
|
required this.isIdle,
|
|
|
|
|
|
|
|
required this.num})
|
|
|
|
|
|
|
|
: super(key: key);
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
@ -47,7 +40,6 @@ class _AnswerIdleListState extends State<AnswerIdleList>
|
|
|
|
int isCheck = 0;
|
|
|
|
int isCheck = 0;
|
|
|
|
bool val = false;
|
|
|
|
bool val = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// final EasyRefreshController _easyRefreshController = EasyRefreshController();
|
|
|
|
// final EasyRefreshController _easyRefreshController = EasyRefreshController();
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
@ -66,12 +58,10 @@ class _AnswerIdleListState extends State<AnswerIdleList>
|
|
|
|
header: MaterialHeader(),
|
|
|
|
header: MaterialHeader(),
|
|
|
|
// footer: MaterialFooter(),
|
|
|
|
// footer: MaterialFooter(),
|
|
|
|
onRefresh: () async {
|
|
|
|
onRefresh: () async {
|
|
|
|
// await userProvider.updateUserInfo();
|
|
|
|
await userProvider.updateUserInfo();
|
|
|
|
// answerList =
|
|
|
|
print("这是数据$answerList");
|
|
|
|
// await ContantFunc.getFindByStatus(widget.num);
|
|
|
|
// userProvider.updateRefSms();
|
|
|
|
// print("这是数据$answerList");
|
|
|
|
// updateList();
|
|
|
|
// // userProvider.updateRefSms();
|
|
|
|
|
|
|
|
updateList();
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
slivers: [
|
|
|
|
slivers: [
|
|
|
@ -92,8 +82,6 @@ class _AnswerIdleListState extends State<AnswerIdleList>
|
|
|
|
// footer: MaterialFooter(),
|
|
|
|
// footer: MaterialFooter(),
|
|
|
|
onRefresh: () async {
|
|
|
|
onRefresh: () async {
|
|
|
|
await userProvider.updateUserInfo();
|
|
|
|
await userProvider.updateUserInfo();
|
|
|
|
answerList =
|
|
|
|
|
|
|
|
await ContantFunc.getFindByStatus(widget.num);
|
|
|
|
|
|
|
|
print("这是数据$answerList");
|
|
|
|
print("这是数据$answerList");
|
|
|
|
// userProvider.updateRefSms();
|
|
|
|
// userProvider.updateRefSms();
|
|
|
|
// updateList();
|
|
|
|
// updateList();
|
|
|
@ -101,27 +89,11 @@ class _AnswerIdleListState extends State<AnswerIdleList>
|
|
|
|
},
|
|
|
|
},
|
|
|
|
slivers: [
|
|
|
|
slivers: [
|
|
|
|
SliverList(
|
|
|
|
SliverList(
|
|
|
|
delegate: SliverChildBuilderDelegate((context, index) {
|
|
|
|
delegate:
|
|
|
|
|
|
|
|
SliverChildBuilderDelegate((context, index) {
|
|
|
|
return _getBox(answerList[index], index);
|
|
|
|
return _getBox(answerList[index], index);
|
|
|
|
}, childCount: answerList.length))
|
|
|
|
}, childCount: answerList.length))
|
|
|
|
])),
|
|
|
|
]))
|
|
|
|
PloneBottom(onTap: () {
|
|
|
|
|
|
|
|
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(() {});
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -132,8 +104,7 @@ class _AnswerIdleListState extends State<AnswerIdleList>
|
|
|
|
// smsIdList.clear();
|
|
|
|
// smsIdList.clear();
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
|
// contentRef
|
|
|
|
// contentRef
|
|
|
|
var base = await apiClient
|
|
|
|
var base = await apiClient.request(API.content.findByStatus, data: {'status': 1});
|
|
|
|
.request(API.content.findByStatus, data: {'status': 1});
|
|
|
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
if (base.code == 0) {
|
|
|
|
_model=(base.data as List)
|
|
|
|
_model=(base.data as List)
|
|
|
|
.map((e) => SmsContentModel.fromJson(e))
|
|
|
|
.map((e) => SmsContentModel.fromJson(e))
|
|
|
@ -166,7 +137,8 @@ class _AnswerIdleListState extends State<AnswerIdleList>
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp),
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: Text(
|
|
|
|
subtitle: Text(
|
|
|
|
widget.isIdle ? "您给朋友去电接听后所发送的短信" : "朋友给你来电接听后所发送的短信",
|
|
|
|
widget.isIdle
|
|
|
|
|
|
|
|
? "您给朋友去电接听后所发送的短信":"朋友给你来电接听后所发送的短信",
|
|
|
|
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
|
|
|
|
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
trailing: widget.isIdle
|
|
|
|
trailing: widget.isIdle
|
|
|
@ -190,8 +162,8 @@ class _AnswerIdleListState extends State<AnswerIdleList>
|
|
|
|
return GestureDetector(
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () async {
|
|
|
|
onTap: () async {
|
|
|
|
if (item.content != "自定义短信内容") {
|
|
|
|
if (item.content != "自定义短信内容") {
|
|
|
|
BaseModel res = await apiClient
|
|
|
|
BaseModel res = await apiClient.request(API.content.checked,
|
|
|
|
.request(API.content.checked, data: {'id': item.id, 'status': 1});
|
|
|
|
data: {'id': item.id, 'status': 1});
|
|
|
|
if (res.code == 0) {
|
|
|
|
if (res.code == 0) {
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
userProvider.updateUserInfo();
|
|
|
|
userProvider.updateUserInfo();
|
|
|
|