parent
c575c16cce
commit
634a3fcdd1
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,24 @@
|
|||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:project_telephony/model/phone_num_model.dart';
|
||||||
|
part 'mass_list_model.g.dart';
|
||||||
|
|
||||||
|
|
||||||
|
@JsonSerializable()
|
||||||
|
class MassListModel extends Equatable{
|
||||||
|
final String title;
|
||||||
|
final String time;
|
||||||
|
bool state;
|
||||||
|
final List<PhoneNumModel> list;
|
||||||
|
factory MassListModel.fromJson(Map<String, dynamic> json) =>_$MassListModelFromJson(json);
|
||||||
|
|
||||||
|
|
||||||
|
MassListModel({
|
||||||
|
required this.title,
|
||||||
|
required this.time,
|
||||||
|
required this.state,
|
||||||
|
required this.list,
|
||||||
|
});
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [title,time,state,list];
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'mass_list_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
MassListModel _$MassListModelFromJson(Map<String, dynamic> json) =>
|
||||||
|
MassListModel(
|
||||||
|
title: json['title'] as String,
|
||||||
|
time: json['time'] as String,
|
||||||
|
state: json['state'] as bool,
|
||||||
|
list: json['list'] as List<PhoneNumModel>,
|
||||||
|
);
|
@ -0,0 +1,193 @@
|
|||||||
|
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 = [];
|
||||||
|
|
||||||
|
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 {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
// import 'package:flutter/material.dart';
|
||||||
|
// import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
// import 'package:project_telephony/utils/headers.dart';
|
||||||
|
//
|
||||||
|
// class UpdateDialog extends Dialog {
|
||||||
|
// @override
|
||||||
|
// Widget build(BuildContext context) {
|
||||||
|
// final String upDateContent;
|
||||||
|
// final bool isForce;
|
||||||
|
// return Center(
|
||||||
|
// child: Column(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
// children: [
|
||||||
|
// SizedBox(
|
||||||
|
// width: 640.w,
|
||||||
|
// height: 740.w,
|
||||||
|
// child: Stack(
|
||||||
|
// children: [
|
||||||
|
// Image.asset(
|
||||||
|
// Assets.images.cardbg.path,
|
||||||
|
// fit: BoxFit.cover,
|
||||||
|
// ),
|
||||||
|
// Container(
|
||||||
|
// child: Column(
|
||||||
|
// children: [
|
||||||
|
// Container(
|
||||||
|
// child: Text(
|
||||||
|
// "发现新版本",
|
||||||
|
// style: TextStyle(fontSize: 32.w,color: Colors.),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
Loading…
Reference in new issue