短信模板

master
戴余标 3 years ago
parent c1ce6b68ae
commit 8fc8aa6683

@ -54,6 +54,34 @@ class _CallingIdleListState extends State<CallingIdleList>
updateList(); updateList();
} }
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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
@ -110,34 +138,6 @@ class _CallingIdleListState extends State<CallingIdleList>
); );
} }
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;
}
}
_getText() { _getText() {
return Container( return Container(
height: 128.w, height: 128.w,
@ -182,12 +182,14 @@ class _CallingIdleListState extends State<CallingIdleList>
if (textListSMS.length > 5) { if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信'); BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else { } else {
Get.to(AddSmsPage( Get.to(
status: 2, AddSmsPage(
status: widget.status,
ploneBack: (String textContent) { ploneBack: (String textContent) {
widget.refreshController.callRefresh(); widget.refreshController.callRefresh();
}, },
)); ),
);
} }
} else { } else {
BotToast.showText(text: '请先开通会员'); BotToast.showText(text: '请先开通会员');
@ -232,7 +234,9 @@ class _CallingIdleListState extends State<CallingIdleList>
end: Alignment.centerRight, end: Alignment.centerRight,
colors: [ colors: [
index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9), index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9),
index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9), index == isCheck
? widget.themeColor.withOpacity(0.5)
: const Color(0xFFF9F9F9),
]), ]),
), ),
child: Text( child: Text(

@ -1,15 +1,13 @@
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/base/base_style.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/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart'; import 'package:tab_indicator_styler/tab_indicator_styler.dart';
import 'answer_idle.dart';
class ContentConnectPage extends StatefulWidget { class ContentConnectPage extends StatefulWidget {
const ContentConnectPage({Key? key}) : super(key: key); const ContentConnectPage({Key? key}) : super(key: key);
@ -27,7 +25,11 @@ class _ContentConnectPageState extends State<ContentConnectPage>
@override @override
void initState() { void initState() {
_tabController = TabController(length: 2, initialIndex: 0, vsync: this); _tabController = TabController(
length: 2,
initialIndex: 0,
vsync: this,
);
super.initState(); super.initState();
} }
@ -60,13 +62,15 @@ class _ContentConnectPageState extends State<ContentConnectPage>
height: 88.w, height: 88.w,
margin: EdgeInsets.symmetric(horizontal: 66.w), margin: EdgeInsets.symmetric(horizontal: 66.w),
padding: EdgeInsets.all(8.w), padding: EdgeInsets.all(8.w),
decoration:BoxDecoration(color: const Color(0xFFF9F9F9),borderRadius: BorderRadius.all(Radius.circular(44.w))), decoration: BoxDecoration(
color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.all(Radius.circular(44.w))),
child: TabBar( child: TabBar(
// indicator: Decoration(),
controller: _tabController, controller: _tabController,
labelColor: const Color(0xFF1890FF), labelColor: const Color(0xFF1890FF),
unselectedLabelColor: const Color(0xFF999999), unselectedLabelColor: const Color(0xFF999999),
unselectedLabelStyle:const TextStyle(fontWeight:FontWeight.bold), unselectedLabelStyle:
const TextStyle(fontWeight: FontWeight.bold),
labelStyle: const TextStyle(fontWeight: FontWeight.bold), labelStyle: const TextStyle(fontWeight: FontWeight.bold),
onTap: (num) { onTap: (num) {
if (num == 0) { if (num == 0) {
@ -83,30 +87,39 @@ class _ContentConnectPageState extends State<ContentConnectPage>
topRightRadius: 44.w, topRightRadius: 44.w,
// paintingStyle: PaintingStyle.fill, // paintingStyle: PaintingStyle.fill,
), ),
// indicatorSize: TabBarIndicatorSize.label,
// isScrollable: true,
tabs: const [ tabs: const [
// _tab(0, "被叫接听"),_tab(1, "主叫接听"), Tab(
Tab(text: "被叫接听",),Tab(text: "主叫接听",) text: "被叫接听",
),
]), Tab(
text: "主叫接听",
),
],
),
), ),
Expanded( Expanded(
child: TabBarView(controller: _tabController, children: [ child: TabBarView(
// _getBox(), controller: _tabController,
AnswerIdleList( children: [
// contant: const [], CallingIdleList(
refreshController: _answerRefreshController, isIdle: false, refreshController: _answerRefreshController,
title: '朋友给你来电接听后所发送的短信',
status: 1,
themeColor: const Color(0xFF1890FF),
),
CallingIdleList(
refreshController: _answerRefreshController,
isIdle: true,
title: '您给朋友去电接听后所发送的短信',
status: 3,
themeColor: const Color(0xFF1890FF),
), ),
AnswerIdleList(
// contant: const [],
refreshController: _wasAnswerRefreshController, isIdle: true,
)
]))
], ],
)); ),
),
],
),
);
} }
@override @override

Loading…
Cancel
Save