|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:project_telephony/utils/user_tool.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;
|
|
|
|
|
|
|
|
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 {
|
|
|
|
BaseModel res = await apiClient.request(API.app.content, data: {
|
|
|
|
'content': _controller.text,
|
|
|
|
'status': widget.status,
|
|
|
|
});
|
|
|
|
if (res.code == 0) {
|
|
|
|
setState(() {});
|
|
|
|
widget.ploneBack(_controller.text);
|
|
|
|
UserTool.userProvider.updateUserInfo();
|
|
|
|
// userProvider.updateUserInfo();
|
|
|
|
} else {
|
|
|
|
CloudToast.show(res.msg);
|
|
|
|
}
|
|
|
|
Get.back();
|
|
|
|
},
|
|
|
|
text: "保存",
|
|
|
|
).paddingOnly(bottom: 30.w),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|