页面效果添加

master
王亚玲 2 years ago
parent 5cdb5e7ff9
commit b2effe383b

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

@ -12,14 +12,20 @@ import 'package:flutter/widgets.dart';
class $AssetsIconsGen { class $AssetsIconsGen {
const $AssetsIconsGen(); const $AssetsIconsGen();
/// File path: assets/icons/home_ selected.png /// File path: assets/icons/Start.png
AssetGenImage get homeSelected => AssetGenImage get start => const AssetGenImage('assets/icons/Start.png');
const AssetGenImage('assets/icons/home_selected.png');
/// File path: assets/icons/home_noSelected.png /// File path: assets/icons/home_noSelected.png
AssetGenImage get homeNoSelected => AssetGenImage get homeNoSelected =>
const AssetGenImage('assets/icons/home_noSelected.png'); const AssetGenImage('assets/icons/home_noSelected.png');
/// File path: assets/icons/home_selected.png
AssetGenImage get homeSelected =>
const AssetGenImage('assets/icons/home_selected.png');
/// File path: assets/icons/horn.png
AssetGenImage get horn => const AssetGenImage('assets/icons/horn.png');
/// File path: assets/icons/my_noselected.png /// File path: assets/icons/my_noselected.png
AssetGenImage get myNoselected => AssetGenImage get myNoselected =>
const AssetGenImage('assets/icons/my_noselected.png'); const AssetGenImage('assets/icons/my_noselected.png');
@ -35,6 +41,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/privacy.png /// File path: assets/icons/privacy.png
AssetGenImage get privacy => const AssetGenImage('assets/icons/privacy.png'); AssetGenImage get privacy => const AssetGenImage('assets/icons/privacy.png');
/// File path: assets/icons/right.png
AssetGenImage get right => const AssetGenImage('assets/icons/right.png');
/// File path: assets/icons/sms.png /// File path: assets/icons/sms.png
AssetGenImage get sms => const AssetGenImage('assets/icons/sms.png'); AssetGenImage get sms => const AssetGenImage('assets/icons/sms.png');
@ -47,17 +56,14 @@ class $AssetsIconsGen {
/// File path: assets/icons/zhifubao.png /// File path: assets/icons/zhifubao.png
AssetGenImage get zhifubao => AssetGenImage get zhifubao =>
const AssetGenImage('assets/icons/zhifubao.png'); const AssetGenImage('assets/icons/zhifubao.png');
/// File path: assets/icons/right.png
AssetGenImage get right =>
const AssetGenImage('assets/icons/right.png');
/// File path: assets/icons/horn.png
AssetGenImage get horn =>
const AssetGenImage('assets/icons/horn.png');
} }
class $AssetsImagesGen { class $AssetsImagesGen {
const $AssetsImagesGen(); const $AssetsImagesGen();
/// File path: assets/images/Start.png
AssetGenImage get start => const AssetGenImage('assets/images/Start.png');
/// File path: assets/images/answer.png /// File path: assets/images/answer.png
AssetGenImage get answer => const AssetGenImage('assets/images/answer.png'); AssetGenImage get answer => const AssetGenImage('assets/images/answer.png');
@ -67,6 +73,10 @@ class $AssetsImagesGen {
/// File path: assets/images/bg.png /// File path: assets/images/bg.png
AssetGenImage get bg => const AssetGenImage('assets/images/bg.png'); AssetGenImage get bg => const AssetGenImage('assets/images/bg.png');
/// File path: assets/images/emptylist.png
AssetGenImage get emptylist =>
const AssetGenImage('assets/images/emptylist.png');
/// File path: assets/images/home_bg.png /// File path: assets/images/home_bg.png
AssetGenImage get homeBg => const AssetGenImage('assets/images/home_bg.png'); AssetGenImage get homeBg => const AssetGenImage('assets/images/home_bg.png');
@ -87,8 +97,6 @@ class $AssetsImagesGen {
/// File path: assets/images/vipbg.png /// File path: assets/images/vipbg.png
AssetGenImage get vipbg => const AssetGenImage('assets/images/vipbg.png'); AssetGenImage get vipbg => const AssetGenImage('assets/images/vipbg.png');
/// File path: assets/images/Start.png
AssetGenImage get Start => const AssetGenImage('assets/images/Start.png');
} }
class Assets { class Assets {

@ -25,25 +25,8 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:telephony/telephony.dart'; import 'package:telephony/telephony.dart';
import 'package:project_telephony/utils/hive_store.dart'; import 'package:project_telephony/utils/hive_store.dart';
void main() async { void main() async {
// SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( //
// statusBarColor: Colors.transparent,
// statusBarIconBrightness: Brightness.dark,
// ));
//
// WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();//
// FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
//
// await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp] );
// FlutterError.onError = (details) {
// LoggerData.addData(details);
// FlutterError.presentError(details);
// };
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
// await initializeService(); // await initializeService();
// Workmanager().initialize( // Workmanager().initialize(

@ -0,0 +1,272 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.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/centertipsalterwidget.dart';
import 'add_sms_page.dart';
class AnswerIdleList extends StatefulWidget {
final EasyRefreshController refreshController;
final bool isIdle;
// final List contant;
const AnswerIdleList(
{Key? key, required this.refreshController, required this.isIdle})
: super(key: key);
@override
_AnswerIdleListState createState() => _AnswerIdleListState();
}
class _AnswerIdleListState extends State<AnswerIdleList>
with AutomaticKeepAliveClientMixin {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容'];
List<String> textListSMS = [];
List<int> smsIdList = [];
int isCheck = 0;
bool val = false;
// final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override
Widget build(BuildContext context) {
return Column(
children: [
_getText(),
32.hb,
widget.isIdle
? val
? Expanded(
// width: 662.w,
// height: 800.w,
child: EasyRefresh.custom(
firstRefresh: true,
controller: widget.refreshController,
header: MaterialHeader(),
// footer: MaterialFooter(),
onRefresh: () async {
await userProvider.updateUserInfo();
userProvider.updateRefSms();
updateList();
setState(() {});
},
slivers: [
SliverList(
delegate:
SliverChildBuilderDelegate((context, index) {
return _getBox(textListSMS[index], index);
}, childCount: textListSMS.length))
]))
: _getEmptyList()
: Expanded(
// width: 662.w,
// height: 800.w,
child: EasyRefresh.custom(
firstRefresh: true,
controller: widget.refreshController,
header: MaterialHeader(),
// footer: MaterialFooter(),
onRefresh: () async {
await userProvider.updateUserInfo();
userProvider.updateRefSms();
updateList();
setState(() {});
},
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate((context, index) {
return _getBox(textListSMS[index], index);
}, childCount: textListSMS.length))
]))
],
);
// ListView.builder(
// itemBuilder: (context, index) {
// return _getBox(textListSMS[index], index);
// },
// itemCount: textListSMS.length,
// ),
}
updateList() async {
if (userProvider.isLogin) {
textListSMS.clear();
smsIdList.clear();
int i = 0;
userProvider.userInfo.contentRef?.forEach((model) {
textListSMS.add(model.content);
smsIdList.add(model.id);
if (model.isChecked == 1) {
isCheck = i;
}
i++;
});
textListSMS.add("自定义短信内容");
} else {
textListSMS = textList;
}
}
_getText() {
return Container(
height: 128.w,
// margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.only(left: 40.w, top: 45.w),
child: ListTile(
title: Text(
"功能讲解",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp),
),
subtitle: Text(
widget.isIdle
? "您给朋友去电接听后所发送的短信":"朋友给你来电接听后所发送的短信",
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
),
trailing: widget.isIdle
? Switch(
value: val,
onChanged: (value) async {
// if(!value){
//
// }
// await prefs.setBool("kg", value);
// print("这是数据${prefs.getBool("kg")}");
setState(() {
val = value;
});
})
: const SizedBox()),
);
}
_getBox(String content, int index) {
return GestureDetector(
onTap: () async {
if (content != "自定义短信内容") {
BaseModel res = await apiClient.request(API.app.checked,
data: {'id': smsIdList[index], 'status': 1});
if (res.code == 0) {
setState(() {});
userProvider.updateUserInfo();
userProvider.updateConSms();
widget.refreshController.callRefresh();
} else {
CloudToast.show(res.msg);
}
} else {
if (userProvider.userInfo.isVip == 1) {
if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else {
Get.to(AddSmsPage(
status: 1,
ploneBack: (String textContent) {
widget.refreshController.callRefresh();
},
));
}
} else {
BotToast.showText(text: '请先开通会员');
}
}
setState(() {});
},
onLongPress: () {
if (content != "自定义短信内容") {
if (textListSMS.length == 2 || isCheck == index) {
if (textListSMS.length == 2) {
BotToast.showText(text: '最后一条内容不可删除');
} else if (isCheck == index) {
BotToast.showText(text: '当前为选中内容,不可删除');
}
} else {
showDialog(
context: context,
builder: (context) {
return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板',
id: smsIdList[index],
callback: (bool status) {
widget.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),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
index == isCheck
? const Color(0xFF1890FF)
: const Color(0xFFF9F9F9),
index == isCheck
? const Color(0xFF74BCFF)
: const Color(0xFFF9F9F9),
]),
),
child: Text(
content,
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: index == isCheck
? const Color(0xFFF9F9F9)
: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),
);
}
_getEmptyList() {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
234.hb,
Image.asset(
Assets.images.emptylist.path,
width: 240.w,
height: 212.w,
fit: BoxFit.fill,
),
48.hb,
Text(
"功能已关闭",
style: TextStyle(
color: const Color(0xFF999999),
fontWeight: FontWeight.bold,
fontSize: 36.sp),
),
16.hb,
Text(
"去电接听后将不会发送短信",
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
),
],
);
}
@override
bool get wantKeepAlive => true;
}

@ -0,0 +1,275 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:project_telephony/extensions/num_ext.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/centertipsalterwidget.dart';
import 'add_sms_page.dart';
class CallingIdleList extends StatefulWidget {
final EasyRefreshController refreshController;
final bool isIdle;
// final List contant;
const CallingIdleList(
{Key? key, required this.refreshController, required this.isIdle})
: super(key: key);
@override
_CallingIdleListState createState() => _CallingIdleListState();
}
class _CallingIdleListState extends State<CallingIdleList>
with AutomaticKeepAliveClientMixin {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容'];
List<String> textListSMS = [];
List<int> smsIdList = [];
int isCheck = 0;
bool val = false;
// final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override
Widget build(BuildContext context) {
return Column(
children: [
_getText(),
32.hb,
widget.isIdle
? val
? Expanded(
// width: 662.w,
// height: 800.w,
child: EasyRefresh.custom(
firstRefresh: true,
controller: widget.refreshController,
header: MaterialHeader(),
// footer: MaterialFooter(),
onRefresh: () async {
await userProvider.updateUserInfo();
userProvider.updateRefSms();
updateList();
setState(() {});
},
slivers: [
SliverList(
delegate:
SliverChildBuilderDelegate((context, index) {
return _getBox(textListSMS[index], index);
}, childCount: textListSMS.length))
]))
: _getEmptyList()
: Expanded(
// width: 662.w,
// height: 800.w,
child: EasyRefresh.custom(
firstRefresh: true,
controller: widget.refreshController,
header: MaterialHeader(),
// footer: MaterialFooter(),
onRefresh: () async {
await userProvider.updateUserInfo();
userProvider.updateRefSms();
updateList();
setState(() {});
},
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate((context, index) {
return _getBox(textListSMS[index], index);
}, childCount: textListSMS.length))
]))
],
);
// ListView.builder(
// itemBuilder: (context, index) {
// return _getBox(textListSMS[index], index);
// },
// itemCount: textListSMS.length,
// ),
}
updateList() async {
if (userProvider.isLogin) {
textListSMS.clear();
smsIdList.clear();
int i = 0;
userProvider.userInfo.contentRef?.forEach((model) {
textListSMS.add(model.content);
smsIdList.add(model.id);
if (model.isChecked == 1) {
isCheck = i;
}
i++;
});
textListSMS.add("自定义短信内容");
} else {
textListSMS = textList;
}
}
_getText() {
return Container(
height: 128.w,
// margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.only(left: 40.w, top: 45.w),
child: ListTile(
title: Text(
"功能讲解",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp),
),
subtitle: Text(
widget.isIdle
? "您给朋友去电拒接/未接后所发送的短信":"朋友给你来电接听后所发送的短信",
style: TextStyle(color: const Color(0xFF999999), fontSize: 27.sp),
),
trailing: widget.isIdle
? Switch(
value: val,
onChanged: (value) async {
// if(!value){
//
// }
// await prefs.setBool("kg", value);
// print("这是数据${prefs.getBool("kg")}");
setState(() {
val = value;
});
})
: const SizedBox()),
);
}
_getBox(String content, int index) {
return GestureDetector(
onTap: () async {
if (content != "自定义短信内容") {
BaseModel res = await apiClient.request(API.app.checked,
data: {'id': smsIdList[index], 'status': 2});
if (res.code == 0) {
setState(() {});
userProvider.updateUserInfo();
userProvider.updateRefSms();
widget.refreshController.callRefresh();
} else {
CloudToast.show(res.msg);
}
} else {
if (userProvider.userInfo.isVip == 1) {
if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else {
Get.to(AddSmsPage(
status: 2,
ploneBack: (String textContent) {
widget.refreshController.callRefresh();
},
));
}
} else {
BotToast.showText(text: '请先开通会员');
}
}
setState(() {});
},
onLongPress: () {
if (content != "自定义短信内容") {
if (textListSMS.length == 2 || isCheck == index) {
if (textListSMS.length == 2) {
BotToast.showText(text: '最后一条内容不可删除');
} else if (isCheck == index) {
BotToast.showText(text: '当前为选中内容,不可删除');
}
} else {
showDialog(
context: context,
builder: (context) {
return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板',
id: smsIdList[index],
callback: (bool status) {
widget.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),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
index == isCheck
? const Color(0xFF13CA9D)
: const Color(0xFFF9F9F9),
index == isCheck
? const Color(0xFF72E4C8)
: const Color(0xFFF9F9F9),
]),
),
child: Text(
content,
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: index == isCheck
? const Color(0xFFF9F9F9)
: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),
);
}
_getEmptyList() {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
234.hb,
Image.asset(
Assets.images.emptylist.path,
width: 240.w,
height: 212.w,
fit: BoxFit.fill,
),
48.hb,
Text(
"功能已关闭",
style: TextStyle(
color: const Color(0xFF999999),
fontWeight: FontWeight.bold,
fontSize: 36.sp),
),
16.hb,
Text(
"去电拒接/未接后将不会发送短信",
style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp),
),
],
);
}
@override
bool get wantKeepAlive => true;
}

@ -1,18 +1,15 @@
import 'package:bot_toast/bot_toast.dart';
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/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/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/user_tool.dart';
import 'package:provider/provider.dart'; import 'package:tab_indicator_styler/tab_indicator_styler.dart';
import '../../constants/api.dart';
import '../../model/network/api_client.dart'; import 'answer_idle.dart';
import '../../model/network/base_model.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart';
class ContentConnectPage extends StatefulWidget { class ContentConnectPage extends StatefulWidget {
const ContentConnectPage({Key? key}) : super(key: key); const ContentConnectPage({Key? key}) : super(key: key);
@ -21,48 +18,31 @@ class ContentConnectPage extends StatefulWidget {
_ContentConnectPageState createState() => _ContentConnectPageState(); _ContentConnectPageState createState() => _ContentConnectPageState();
} }
class _ContentConnectPageState extends State<ContentConnectPage> { class _ContentConnectPageState extends State<ContentConnectPage>
List<String> textList = ['欢迎您的来电,祝您生活愉快','自定义短信内容']; with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
List<int> smsIdList = []; late TabController _tabController;
List<String> textListSMS = []; final EasyRefreshController _callingRefreshController =
int isCheck=0; EasyRefreshController();
final EasyRefreshController _wasCalledRefreshController =
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); EasyRefreshController();
final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override @override
void initState() { void initState() {
_tabController = TabController(length: 2, initialIndex: 0, vsync: this);
super.initState(); super.initState();
updateList();
} }
@override @override
void dispose() { void dispose() {
_easyRefreshController.dispose(); _tabController.dispose();
_callingRefreshController.dispose();
_wasCalledRefreshController.dispose();
super.dispose(); super.dispose();
} }
updateList() {
if (UserTool.userProvider.isLogin) {
textListSMS.clear();
smsIdList.clear();
int i=0;
UserTool.userProvider.userInfo.contentCon?.forEach((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) {
super.build(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
@ -74,155 +54,74 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
backgroundColor: kForeGroundColor, backgroundColor: kForeGroundColor,
), ),
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: _getList() body: Column(
children: [
// Column(children: [ Container(
// // _getEditContent(), width:double.infinity,
// Expanded(child: _getList()), height: 88.w,
// margin: EdgeInsets.symmetric(horizontal: 66.w),
// padding: EdgeInsets.all(8.w),
// ]), decoration:BoxDecoration(color: const Color(0xFFF9F9F9),borderRadius: BorderRadius.all(Radius.circular(44.w))),
); child: TabBar(
} // indicator: Decoration(),
controller: _tabController,
_getList() { labelColor:const Color(0xFF1890FF),
return unselectedLabelColor:const Color(0xFF999999),
EasyRefresh( unselectedLabelStyle:const TextStyle(fontWeight:FontWeight.bold),
firstRefresh: true, labelStyle:const TextStyle(fontWeight:FontWeight.bold),
header: MaterialHeader(), // onTap: () async{
footer: MaterialFooter(), // _refreshController.callRefresh();
controller: _easyRefreshController, // },
onRefresh: () async { indicator: RectangularIndicator(
await UserTool.userProvider.updateUserInfo(); color: Colors.white,
userProvider.updateConSms(); bottomLeftRadius: 44.w,
updateList(); bottomRightRadius: 44.w,
setState(() {}); topLeftRadius: 44.w,
}, topRightRadius: 44.w,
child: ListView.builder( // paintingStyle: PaintingStyle.fill,
shrinkWrap:true,
itemBuilder: (context, index) {
return _getBox(textListSMS[index], index);
},
itemCount: textListSMS.length,
), ),
); // indicatorSize: TabBarIndicatorSize.label,
} // isScrollable: true,
tabs: const [
// _tab(0, "被叫接听"),_tab(1, "主叫接听"),
Tab(text: "被叫接听",),Tab(text: "主叫接听",)
_getBox(String content, int index) { ]),
return GestureDetector(
onTap: () async {
if (content != "自定义短信内容") { ),
BaseModel res = await apiClient.request(API.app.checked, Expanded(
data: {'id': smsIdList[index], 'status': 1}); child: TabBarView(controller: _tabController, children: [
if (res.code == 0) { // _getBox(),
setState(() {}); AnswerIdleList(
UserTool.userProvider.updateUserInfo(); // contant: const [],
UserTool.userProvider.updateConSms(); refreshController: _callingRefreshController, isIdle: false,
_easyRefreshController.callRefresh(); ),
} else { AnswerIdleList(
CloudToast.show(res.msg); // contant: const [],
} refreshController: _callingRefreshController, isIdle: true,
} else { )
if (UserTool.userProvider.userInfo.isVip==1) { ]))
if (textListSMS.length > 5) { ],
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else {
Get.to(AddSmsPage(
status: 1,
ploneBack: (String textContent) {
_easyRefreshController.callRefresh();
},
)); ));
} }
} else {
BotToast.showText(text: '请先开通会员'); _getBox() {
} return Container(
} color: Colors.red,
setState(() {}); width: 200.w,
}, height: 200.w,
onLongPress: () {
if (content != "自定义短信内容") {
if (textListSMS.length == 2 || isCheck == index) {
if(textListSMS.length == 2){
BotToast.showText(text: '最后一条内容不可删除');
}else if(isCheck == index){
BotToast.showText(text: '当前为选中内容,不可删除');
}
} else {
showDialog(
context: context,
builder: (context) {
return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板',
id: smsIdList[index],
callback: (bool status) {
_easyRefreshController.callRefresh();
},
); );
});
}
} }
setState(() {});
}, _tab(int int, String string) {
child: Container( return Text(
// width: 686.w, string,
margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w),
padding: EdgeInsets.all(40.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
index==isCheck? const Color(0xFF74BCFF):const Color(0xFFF9F9F9),
index==isCheck? const Color(0xFF1890FF):const Color(0xFFF9F9F9),
]),
),
child: Text(
content,
style: TextStyle( style: TextStyle(
fontSize: BaseStyle.fontSize28, fontSize: BaseStyle.fontSize28, color:const Color(0xFF1890FF) ),
color: index==isCheck?const Color(0xFFF9F9F9):BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),
); );
} }
// _getEditContent(){
// return GestureDetector( @override
// onTap: (){ bool get wantKeepAlive => true;
// if (UserTool.userProvider.userInfo.isVip==1) {
// if (textListSMS.length > 5) {
// BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
// } else {
// Get.to(AddSmsPage(
// status: 2,
// ploneBack: (String textContent) {
// _easyRefreshController.callRefresh();
// },
// ));
// }
// } else {
// BotToast.showText(text: '请先开通会员');
// }
// }
// ,child: Container(
// width: double.infinity,
// height: 128.w,
// margin: EdgeInsets.symmetric(horizontal: 64.w),
// padding: EdgeInsets.only(left: 40.w,top: 45.w),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(16),
// color: const Color(0xFFF9F9F9),
// ),
// child: Text(
// "定义短信内容",
// style: TextStyle(
// fontSize: BaseStyle.fontSize28,
// color: BaseStyle.color333333,
// fontWeight: FontWeight.bold),
// ),
// ),);
// }
} }

@ -8,12 +8,14 @@ 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:project_telephony/utils/user_tool.dart'; import 'package:project_telephony/utils/user_tool.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
import '../../model/network/base_model.dart'; import '../../model/network/base_model.dart';
import '../../providers/user_provider.dart'; import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; import '../../utils/toast/cloud_toast.dart';
import 'add_sms_page.dart'; import 'add_sms_page.dart';
import 'calling_idle_list.dart';
class ContentRefusePage extends StatefulWidget { class ContentRefusePage extends StatefulWidget {
const ContentRefusePage({Key? key}) : super(key: key); const ContentRefusePage({Key? key}) : super(key: key);
@ -22,47 +24,31 @@ class ContentRefusePage extends StatefulWidget {
_ContentRefusePageState createState() => _ContentRefusePageState(); _ContentRefusePageState createState() => _ContentRefusePageState();
} }
class _ContentRefusePageState extends State<ContentRefusePage> { class _ContentRefusePageState extends State<ContentRefusePage>
List<String> textList = ['现在无法接听。有什么事吗?', '自定义短信内容']; with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
List<String> textListSMS = []; late TabController _tabController;
List<int> smsIdList = []; final EasyRefreshController _callingRefreshController =
int isCheck=0; EasyRefreshController();
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); final EasyRefreshController _wasCalledRefreshController =
final EasyRefreshController _easyRefreshController = EasyRefreshController(); EasyRefreshController();
@override @override
void initState() { void initState() {
_tabController = TabController(length: 2, initialIndex: 0, vsync: this);
super.initState(); super.initState();
updateList();
} }
@override @override
void dispose() { void dispose() {
_easyRefreshController.dispose(); _tabController.dispose();
_callingRefreshController.dispose();
_wasCalledRefreshController.dispose();
super.dispose(); super.dispose();
} }
updateList() async {
if (userProvider.isLogin) {
textListSMS.clear();
smsIdList.clear();
int i=0;
userProvider.userInfo.contentRef?.forEach((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) {
super.build(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
@ -74,162 +60,74 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
backgroundColor: kForeGroundColor, backgroundColor: kForeGroundColor,
), ),
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: _getList() body: Column(
// Column(children: [ children: [
// _getEditContent(), Container(
// Expanded( width:double.infinity,
// child: _getList(), height: 88.w,
// ), margin: EdgeInsets.symmetric(horizontal: 66.w),
// padding: EdgeInsets.all(8.w),
// ]), decoration:BoxDecoration(color: const Color(0xFFF9F9F9),borderRadius: BorderRadius.all(Radius.circular(44.w))),
// bottomNavigationBar: _getEditContent(), child: TabBar(
); // indicator: Decoration(),
} controller: _tabController,
labelColor:const Color(0xFF1890FF),
_getList() { unselectedLabelColor:const Color(0xFF999999),
return EasyRefresh( unselectedLabelStyle:const TextStyle(fontWeight:FontWeight.bold),
firstRefresh: true, labelStyle:const TextStyle(fontWeight:FontWeight.bold),
header: MaterialHeader(), // onTap: () async{
footer: MaterialFooter(), // _refreshController.callRefresh();
controller: _easyRefreshController, // },
onRefresh: () async { indicator: RectangularIndicator(
await userProvider.updateUserInfo(); color: Colors.white,
userProvider.updateRefSms(); bottomLeftRadius: 44.w,
updateList(); bottomRightRadius: 44.w,
setState(() {}); topLeftRadius: 44.w,
}, topRightRadius: 44.w,
child: ListView.builder( // paintingStyle: PaintingStyle.fill,
itemBuilder: (context, index) {
return _getBox(textListSMS[index], index);
},
itemCount: textListSMS.length,
), ),
); // indicatorSize: TabBarIndicatorSize.label,
} // isScrollable: true,
tabs: const [
// _tab(0, "被叫接听"),_tab(1, "主叫接听"),
Tab(text: "被叫拒接/未接",),Tab(text: "主叫拒接/未接",)
]),
_getBox(String content, int index) {
return GestureDetector(
onTap: () async {
if (content != "自定义短信内容") {
BaseModel res = await apiClient.request(API.app.checked,
data: {'id': smsIdList[index], 'status': 2});
if (res.code == 0) {
setState(() {});
userProvider.updateUserInfo();
userProvider.updateRefSms();
_easyRefreshController.callRefresh();
} else {
CloudToast.show(res.msg);
}
} else {
if (userProvider.userInfo.isVip==1) {
if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else {
Get.to(AddSmsPage(
status: 2,
ploneBack: (String textContent) {
_easyRefreshController.callRefresh(); ),
}, Expanded(
child: TabBarView(controller: _tabController, children: [
// _getBox(),
CallingIdleList(
// contant: const [],
refreshController: _callingRefreshController, isIdle: false,
),
CallingIdleList(
// contant: const [],
refreshController: _callingRefreshController, isIdle: true,
)
]))
],
)); ));
} }
} else {
BotToast.showText(text: '请先开通会员');
}
}
setState(() {});
},
onLongPress: () {
if (content != "自定义短信内容") { _getBox() {
if (textListSMS.length == 2 || isCheck == index) { return Container(
if(textListSMS.length == 2){ color: Colors.red,
BotToast.showText(text: '最后一条内容不可删除'); width: 200.w,
}else if(isCheck == index){ height: 200.w,
BotToast.showText(text: '当前为选中内容,不可删除');
}
} else {
showDialog(
context: context,
builder: (context) {
return Centertipsalterwidget(
desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
title: '删除短信模板',
id: smsIdList[index],
callback: (bool status) {
_easyRefreshController.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),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
index==isCheck? const Color(0xFF13CA9D):const Color(0xFFF9F9F9),
index==isCheck? const Color(0xFF72E4C8):const Color(0xFFF9F9F9),
]),
), _tab(int int, String string) {
child: Text( return Text(
content, string,
style: TextStyle( style: TextStyle(
fontSize: BaseStyle.fontSize28, fontSize: BaseStyle.fontSize28, color:const Color(0xFF1890FF) ),
color: index==isCheck?const Color(0xFFF9F9F9):BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
),
); );
} }
// int _getEasyRefresh(){
// return EasyRefresh(onRefresh: ,child: ,); @override
// } bool get wantKeepAlive => true;
// _getEditContent(){
// return GestureDetector(
// onTap: (){
// if (userProvider.userInfo.isVip==1) {
// if (textListSMS.length > 5) {
// BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
// } else {
// Get.to(AddSmsPage(
// status: 2,
// ploneBack: (String textContent) {
// _easyRefreshController.callRefresh();
// },
// ));
// }
// } else {
// BotToast.showText(text: '请先开通会员');
// }
// }
// ,child: Container(
// width: double.infinity,
// height: 128.w,
// margin: EdgeInsets.symmetric(horizontal: 64.w),
// padding: EdgeInsets.only(left: 40.w,top: 45.w),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(16),
// color: const Color(0xFFF9F9F9),
// ),
// child: Text(
// "定义短信内容",
// style: TextStyle(
// fontSize: BaseStyle.fontSize28,
// color: BaseStyle.color333333,
// fontWeight: FontWeight.bold),
// ),
// ),);
// }
} }

@ -193,12 +193,12 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
_getContainer(String title, String text, String image, Color cl1, Color cl2) { _getContainer(String title, String text, String image, Color cl1, Color cl2) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
print(title); // print(title);
if (title == "接听后") { if (title == "接听后") {
Get.to(() => const ContentConnectPage()); Get.to(() => const ContentConnectPage());
} else { } else {
Get.to(() => const ContentRefusePage()); Get.to(() => const ContentRefusePage());
print("未接听"); // print("未接听");
} }
}, },
child: Container( child: Container(

@ -57,7 +57,7 @@ class _LoadingState extends State<Loading> {
bottom: 158.w, bottom: 158.w,
left: 143.w, left: 143.w,
child: Image.asset( child: Image.asset(
Assets.images.Start.path,width:434.sp,height:148.sp , fit: BoxFit.fill),), Assets.images.start.path,width:434.sp,height:148.sp , fit: BoxFit.fill),),
], ],
)); ));

@ -1,12 +1,15 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/user/privacy_rights_page.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:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
class PrivacyRightsPage extends StatefulWidget { class PrivacyRightsPage extends StatefulWidget {
final String name; final String name;

@ -1018,6 +1018,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0+2" version: "3.0.0+2"
tab_indicator_styler:
dependency: "direct main"
description:
name: tab_indicator_styler
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
telephony: telephony:
dependency: "direct main" dependency: "direct main"
description: description:

@ -91,7 +91,8 @@ dependencies:
flutter_easyrefresh: ^2.2.1 flutter_easyrefresh: ^2.2.1
# 链接 # 链接
url_launcher: ^6.1.5 url_launcher: ^6.1.5
#tabBar样式切换
tab_indicator_styler: ^2.0.0
# # jdk # # jdk
# jverify: ^2.2.5 # jverify: ^2.2.5
## pub 集成 ## pub 集成

Loading…
Cancel
Save