parent
375cba91ec
commit
1071e60061
@ -1 +0,0 @@
|
||||
/Users/datang/fvm/versions/2.8.0
|
@ -0,0 +1,106 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:provider/provider.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;
|
||||
const AddSmsPage({Key? key, required this.status, required this.ploneBack}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AddSmsPageState createState() => _AddSmsPageState();
|
||||
}
|
||||
|
||||
class _AddSmsPageState extends State<AddSmsPage> {
|
||||
late TextEditingController _controller;
|
||||
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = TextEditingController();
|
||||
}
|
||||
|
||||
@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,
|
||||
),
|
||||
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: _controller.text.isNotEmpty ? 1 : 0.4,
|
||||
onTap: () async {
|
||||
BaseModel res = await apiClient.request(API.app.content, data: {
|
||||
'content': _controller.text,
|
||||
'status': widget.status,
|
||||
});
|
||||
if (res.code == 0) {
|
||||
setState(() {});
|
||||
widget.ploneBack(_controller.text);
|
||||
userProvider.updateUserInfo();
|
||||
} else {
|
||||
CloudToast.show(res.msg);
|
||||
}
|
||||
Get.back();
|
||||
},
|
||||
text: "保存",
|
||||
).paddingOnly(bottom: 30.w),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
import 'package:bot_toast/bot_toast.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/add_sms_page.dart';
|
||||
import 'package:project_telephony/ui/widget/centertipsalterwidget.dart';
|
||||
import 'package:project_telephony/ui/widget/plone_back_button.dart';
|
||||
import 'package:project_telephony/utils/headers.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
|
||||
class ContentConnectPage extends StatefulWidget {
|
||||
const ContentConnectPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ContentConnectPageState createState() => _ContentConnectPageState();
|
||||
}
|
||||
|
||||
class _ContentConnectPageState extends State<ContentConnectPage> {
|
||||
int _select = 0;
|
||||
List<String> textList = [
|
||||
'欢迎您的来电,祝您生活愉快',
|
||||
'祝您万事顺心',
|
||||
'感谢您的来电,我们会尽快处理的',
|
||||
"自定义短信内容"
|
||||
];
|
||||
List<int> smsIdList =[];
|
||||
List<String> textListSMS = [];
|
||||
|
||||
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
||||
final EasyRefreshController _easyRefreshController = EasyRefreshController();
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
updateList();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_easyRefreshController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
updateList(){
|
||||
if (userProvider.isLogin) {
|
||||
textListSMS.clear();
|
||||
smsIdList.clear();
|
||||
userProvider.userInfo.contentCon?.forEach((model) {
|
||||
textListSMS.add(model.content);
|
||||
smsIdList.add(model.id);
|
||||
});
|
||||
textListSMS.add("自定义短信内容");
|
||||
} else {
|
||||
textListSMS = textList;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext 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: [
|
||||
Expanded(
|
||||
child: _getList(),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
_getList() {
|
||||
return EasyRefresh(
|
||||
firstRefresh: true,
|
||||
header: MaterialHeader(),
|
||||
footer: MaterialFooter(),
|
||||
controller: _easyRefreshController,
|
||||
onRefresh: () async {
|
||||
await userProvider.updateUserInfo();
|
||||
updateList();
|
||||
setState(() {});
|
||||
},
|
||||
child:ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return _getBox(textListSMS[index], index == _select, index);
|
||||
},
|
||||
itemCount: textListSMS.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_getBox(String content, bool pd, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
if (content != "自定义短信内容") {
|
||||
_select = index;
|
||||
} else {
|
||||
if(userProvider.isLogin){
|
||||
if(textListSMS.length>5){
|
||||
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
|
||||
}else{
|
||||
Get.to(AddSmsPage(
|
||||
status: 1, ploneBack: (String textContent) {
|
||||
_easyRefreshController.callRefresh();
|
||||
},
|
||||
));
|
||||
}
|
||||
}else{
|
||||
BotToast.showText(text: '请先登录');
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
onLongPress: () {
|
||||
if(content != "自定义短信内容"){
|
||||
if (textListSMS.length<2 ) {
|
||||
BotToast.showText(text: '不能再删了');
|
||||
}else{
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Centertipsalterwidget(
|
||||
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
|
||||
title: '删除短信模板', id: smsIdList[index],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
// width: 686.w,
|
||||
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
|
||||
padding: EdgeInsets.all(40.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
color: pd ? Colors.blue : const Color(0xFFF9F9F9),
|
||||
),
|
||||
child: Text(
|
||||
content,
|
||||
style: TextStyle(
|
||||
fontSize: BaseStyle.fontSize28,
|
||||
color: pd ? const Color(0xFFF9F9F9) : BaseStyle.color333333,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:project_telephony/utils/headers.dart';
|
||||
|
||||
import '../../base/base_style.dart';
|
||||
import '../widget/plone_back_button.dart';
|
||||
import '../widget/plone_bottom.dart';
|
||||
|
||||
typedef TextCallback = Function(String textContent);
|
||||
|
||||
class ContentDetailsPage extends StatefulWidget {
|
||||
final TextCallback ploneBack;
|
||||
final String content;
|
||||
const ContentDetailsPage(
|
||||
{Key? key, required this.content, required this.ploneBack})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_ContentDetailsPageState createState() => _ContentDetailsPageState();
|
||||
}
|
||||
|
||||
String content = "";
|
||||
|
||||
class _ContentDetailsPageState extends State<ContentDetailsPage> {
|
||||
late TextEditingController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = TextEditingController(text: widget.content);
|
||||
}
|
||||
|
||||
@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: _getBox(),
|
||||
);
|
||||
}
|
||||
|
||||
_getBox() {
|
||||
return Column(children: [
|
||||
Container(
|
||||
width: 622.w,
|
||||
height: 960.w,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF9F9F9),
|
||||
borderRadius: BorderRadius.circular(16.w)),
|
||||
margin: EdgeInsets.only(top: 32.w, bottom: 298.w),
|
||||
child: Container(
|
||||
// color: kForeGroundColor,
|
||||
margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w),
|
||||
child: TextField(
|
||||
maxLines: 100,
|
||||
keyboardType: TextInputType.text,
|
||||
onEditingComplete: () {
|
||||
setState(() {});
|
||||
// _refreshController.callRefresh();
|
||||
},
|
||||
onChanged: (text) {
|
||||
content = text;
|
||||
// print(content);
|
||||
setState(() {});
|
||||
},
|
||||
style: TextStyle(
|
||||
color: BaseStyle.color333333,
|
||||
fontSize: BaseStyle.fontSize28,
|
||||
),
|
||||
controller: _controller,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
filled: true,
|
||||
isDense: true,
|
||||
fillColor: Colors.white,
|
||||
hintText: widget.content != "" ? "" : "请输入短信内容",
|
||||
hintStyle: TextStyle(
|
||||
color: widget.content != ""
|
||||
? const Color(0xFF333333)
|
||||
: Colors.grey.shade500,
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.bold),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Text(widget.content,),
|
||||
),
|
||||
PloneBottom(
|
||||
border: !content.isNotEmpty,
|
||||
opacity: content.isNotEmpty ? 1 : 0.4,
|
||||
onTap: () {
|
||||
setState(() {});
|
||||
widget.ploneBack(content);
|
||||
Get.back();
|
||||
// print(content);
|
||||
},
|
||||
text: "保存",
|
||||
)
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
|
||||
import 'package:call_log/call_log.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
import 'package:project_telephony/base/base_style.dart';
|
||||
import 'package:project_telephony/ui/home/content_details_page.dart';
|
||||
import 'package:project_telephony/ui/widget/centertipsalterwidget.dart';
|
||||
|
||||
import 'package:project_telephony/ui/widget/plone_back_button.dart';
|
||||
import 'package:project_telephony/utils/headers.dart';
|
||||
|
||||
|
||||
class ContentPage extends StatefulWidget {
|
||||
final bool? isAnswer; //true接听false未接听
|
||||
const ContentPage({Key? key, required this.isAnswer}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ContentPageState createState() => _ContentPageState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
class _ContentPageState extends State<ContentPage> {
|
||||
int _select = 0;
|
||||
List<String> textList = ['欢迎你的来电', '祝您生活愉快', '感谢您的来电我们会尽快处理的', '自定义短信内容'];
|
||||
List<String> textList1 = ['自定义短信内容'];
|
||||
late String phoneNum;
|
||||
late String callState;
|
||||
@override
|
||||
Widget build(BuildContext 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: [
|
||||
Expanded(
|
||||
child: _getList(),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
_getList() {
|
||||
return ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return _getBox(textList[index], index == _select, index);
|
||||
},
|
||||
itemCount: textList.length,
|
||||
);
|
||||
}
|
||||
|
||||
_getBox(String content, bool pd, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
_select = index;
|
||||
if (index == textList.length - 1) {
|
||||
await Get.to(() => ContentDetailsPage(
|
||||
content: "",
|
||||
ploneBack: (String textContent) {
|
||||
// print("这是数据" + textContent);
|
||||
textList.setAll(index, {textContent});
|
||||
},
|
||||
));
|
||||
} else {
|
||||
final Iterable<CallLogEntry> result = await CallLog.query();
|
||||
phoneNum = result.first.number!;
|
||||
}
|
||||
setState(() {});
|
||||
// print("这是数据" + textList[_s lect]);
|
||||
|
||||
// print(index);
|
||||
},
|
||||
onLongPress: () {
|
||||
if (index != textList.length - 1) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const Centertipsalterwidget(
|
||||
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
|
||||
title: '删除短信模板',
|
||||
);
|
||||
});
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
// width: 686.w,
|
||||
height: 135.w,
|
||||
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
|
||||
padding: EdgeInsets.only(left: 40.w, top: 50.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
color: pd
|
||||
? widget.isAnswer!
|
||||
? Colors.blue
|
||||
: const Color(0xFF72E4C8)
|
||||
: const Color(0xFFF9F9F9),
|
||||
),
|
||||
child: Text(
|
||||
content,
|
||||
style: TextStyle(
|
||||
fontSize: BaseStyle.fontSize28,
|
||||
color: pd ? const Color(0xFFF9F9F9) : BaseStyle.color333333,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
import 'dart:async';
|
||||
import 'package:bot_toast/bot_toast.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/widget/centertipsalterwidget.dart';
|
||||
import 'package:project_telephony/ui/widget/plone_back_button.dart';
|
||||
import 'package:project_telephony/utils/headers.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
import 'add_sms_page.dart';
|
||||
|
||||
class ContentRefusePage extends StatefulWidget {
|
||||
const ContentRefusePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ContentRefusePageState createState() => _ContentRefusePageState();
|
||||
}
|
||||
|
||||
class _ContentRefusePageState extends State<ContentRefusePage> {
|
||||
int _select = 0;
|
||||
List<String> textList = ['现在无法接听。有什么事吗?', '我马上会打给你。', '我稍后会打给你。', "自定义短信内容"];
|
||||
List<String> textListSMS = [];
|
||||
List<int> smsIdList =[];
|
||||
|
||||
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
||||
final EasyRefreshController _easyRefreshController = EasyRefreshController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
updateList();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_easyRefreshController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future updateList() async{
|
||||
if (userProvider.isLogin) {
|
||||
textListSMS.clear();
|
||||
userProvider.userInfo.contentRef?.forEach((model) {
|
||||
textListSMS.add(model.content);
|
||||
smsIdList.add(model.id);
|
||||
});
|
||||
textListSMS.add("自定义短信内容");
|
||||
} else {
|
||||
textListSMS = textList;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext 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: [
|
||||
Expanded(
|
||||
child: _getList(),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
_getList() {
|
||||
return EasyRefresh(
|
||||
firstRefresh: true,
|
||||
header: MaterialHeader(),
|
||||
footer: MaterialFooter(),
|
||||
controller: _easyRefreshController,
|
||||
onRefresh: () async {
|
||||
await updateList();
|
||||
},
|
||||
child:ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return _getBox(textListSMS[index], index == _select, index);
|
||||
},
|
||||
itemCount: textListSMS.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_getBox(String content, bool pd, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
if (content != "自定义短信内容") {
|
||||
_select = index;
|
||||
} else {
|
||||
if(userProvider.isLogin){
|
||||
if(textListSMS.length>5){
|
||||
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
|
||||
}else{
|
||||
Get.to(AddSmsPage(
|
||||
status: 2, ploneBack: (String textContent) { },
|
||||
));
|
||||
}
|
||||
}else{
|
||||
BotToast.showText(text: '请先登录');
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
onLongPress: () {
|
||||
if(content != "自定义短信内容"){
|
||||
if (textListSMS.length<2 ) {
|
||||
BotToast.showText(text: '不能再删了');
|
||||
}else{
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Centertipsalterwidget(
|
||||
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
|
||||
title: '删除短信模板', id: smsIdList[index],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
_easyRefreshController.callRefresh();
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
// width: 686.w,
|
||||
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
|
||||
padding: EdgeInsets.all(40.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
color: pd ? const Color(0xFF72E4C8) : const Color(0xFFF9F9F9),
|
||||
),
|
||||
child: Text(
|
||||
content,
|
||||
style: TextStyle(
|
||||
fontSize: BaseStyle.fontSize28,
|
||||
color: pd ? const Color(0xFFF9F9F9) : BaseStyle.color333333,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:project_telephony/utils/headers.dart';
|
||||
import 'package:provider/provider.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 '../widget/plone_back_button.dart';
|
||||
import '../widget/plone_bottom.dart';
|
||||
|
||||
typedef TextCallback = Function(String textContent);
|
||||
|
||||
class ContentDetailsPage extends StatefulWidget {
|
||||
final TextCallback ploneBack;
|
||||
final String content;
|
||||
const ContentDetailsPage(
|
||||
{Key? key, required this.content, required this.ploneBack})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_ContentDetailsPageState createState() => _ContentDetailsPageState();
|
||||
}
|
||||
|
||||
class _ContentDetailsPageState extends State<ContentDetailsPage> {
|
||||
late TextEditingController _controller;
|
||||
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = TextEditingController(text: widget.content);
|
||||
}
|
||||
|
||||
|
||||
@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: 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,
|
||||
),
|
||||
controller: _controller,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
filled: true,
|
||||
isDense: true,
|
||||
fillColor: Colors.transparent ,
|
||||
hintText: widget.content.isNotEmpty ? "" : "请输入所需短信标签",
|
||||
hintStyle: TextStyle(
|
||||
color: widget.content != ""
|
||||
? const Color(0xFF333333)
|
||||
: Colors.grey.shade500,
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.bold),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: PloneBottom(
|
||||
border: _controller.text.isEmpty,
|
||||
opacity: _controller.text.isNotEmpty ? 1 : 0.4,
|
||||
onTap: () async {
|
||||
BaseModel res =
|
||||
await apiClient.request(API.app.addTag, data: {'tag': _controller.text});
|
||||
if (res.code == 0) {
|
||||
setState(() {});
|
||||
widget.ploneBack(_controller.text);
|
||||
userProvider.updateUserInfo();
|
||||
Get.back();
|
||||
} else {
|
||||
CloudToast.show(res.msg);
|
||||
}
|
||||
},
|
||||
text: "保存",
|
||||
).paddingOnly(bottom: 30.w),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue