You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.2 KiB

2 years ago
import 'package:flutter/material.dart';
import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/home/content_details_page.dart';
2 years ago
import 'package:project_telephony/ui/widget/centertipsalterwidget.dart';
2 years ago
import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart';
class ContentPage extends StatefulWidget {
2 years ago
final bool? isAnswer; //true接听false未接听
const ContentPage({Key? key, required this.isAnswer}) : super(key: key);
2 years ago
@override
_ContentPageState createState() => _ContentPageState();
}
class _ContentPageState extends State<ContentPage> {
2 years ago
int _select = 0;
List<String> textList = ['欢迎你的来电', '祝您生活愉快', '感谢您的来电我们会尽快处理的', '自定义短信内容'];
List<String> textList1 = ['自定义短信内容'];
2 years ago
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
2 years ago
elevation: 0,
2 years ago
title: Text(
'选择短信内容',
style: Theme.of(context).textTheme.headline6,
),
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor,
),
2 years ago
backgroundColor: Colors.white,
2 years ago
body: Column(children: [
Expanded(
child: _getList(),
),
]),
);
}
_getList() {
return ListView.builder(
itemBuilder: (context, index) {
2 years ago
return _getBox(textList[index], index == _select, index);
2 years ago
},
itemCount: textList.length,
);
}
2 years ago
_getBox(String content, bool pd, int index) {
2 years ago
return GestureDetector(
2 years ago
onTap: () async {
_select = index;
2 years ago
if (index == textList.length - 1) {
2 years ago
await Get.to(() => ContentDetailsPage(
content: "",
ploneBack: (String textContent) {
// print("这是数据" + textContent);
textList.setAll(index, {textContent});
},
));
2 years ago
} else {}
setState(() {});
2 years ago
// print("这是数据" + textList[_s lect]);
// print(index);
},
onLongPress: () {
2 years ago
if (index != textList.length - 1) {
2 years ago
showDialog(
context: context,
builder: (context) {
return const Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板',
);
});
}
2 years ago
setState(() {});
2 years ago
},
child: Container(
2 years ago
// 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
2 years ago
: const Color(0xFF72E4C8)
2 years ago
: const Color(0xFFF9F9F9),
),
child: Text(
content,
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: pd ? const Color(0xFFF9F9F9) : BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),
2 years ago
);
}
}