diff --git a/lib/constants/api.dart b/lib/constants/api.dart index a2aba97..938341a 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -30,6 +30,7 @@ class API { static _App app = _App(); static _Pay pay = _Pay(); static _Exclude exclude = _Exclude(); + static _Content content=_Content(); } class _App { @@ -48,6 +49,11 @@ class _App { ///短信标签 String get addTag => '/app/user/addTag'; + ///更新VIP状态(已合并至用户信息) + String get updateVip => '/app/user/updateVip'; +} + +class _Content{ ///自定义短信 String get content => '/app/user/content'; @@ -57,11 +63,11 @@ class _App { ///选择自定义短信 String get checked => '/app/user/content/checked'; - ///查找短信 + ///查找已选短信 String get find => '/app/user/content/find'; - ///更新VIP状态(已合并至用户信息) - String get updateVip => '/app/user/updateVip'; + ///查看所有短信列表 + String get findByStatus=>'/app/user/content/findByStatus'; } class _Pay { diff --git a/lib/model/sms_content_model.dart b/lib/model/sms_content_model.dart new file mode 100644 index 0000000..fdb527e --- /dev/null +++ b/lib/model/sms_content_model.dart @@ -0,0 +1,24 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; +part 'sms_content_model.g.dart'; + + +@JsonSerializable() +class SmsContentModel extends Equatable{ + final int id; + final String content; + final int isChecked; + + factory SmsContentModel.fromJson(Map json) =>_$SmsContentModelFromJson(json); + Map toJson()=> _$SmsContentModelToJson(this); + + const SmsContentModel({ + required this.id, + required this.content, + required this.isChecked, + }); + + @override + List get props => [id, content, isChecked]; + +} \ No newline at end of file diff --git a/lib/model/sms_content_model.g.dart b/lib/model/sms_content_model.g.dart new file mode 100644 index 0000000..550a40e --- /dev/null +++ b/lib/model/sms_content_model.g.dart @@ -0,0 +1,18 @@ + +// GENERATED CODE - DO NOT MODIFY BY HAND +part of 'sms_content_model.dart'; +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SmsContentModel _$SmsContentModelFromJson(Map json) => SmsContentModel( + id: json['id'] as int, + content: json['content'] as String, + isChecked: json['is_checked'] as int, +); + +Map _$SmsContentModelToJson(SmsContentModel instance) => { + 'id': instance.id, + 'content': instance.content, + 'is_checked':instance.isChecked, +}; \ No newline at end of file diff --git a/lib/model/user_info_model.dart b/lib/model/user_info_model.dart index d35ed39..cc3678f 100644 --- a/lib/model/user_info_model.dart +++ b/lib/model/user_info_model.dart @@ -10,6 +10,7 @@ class UserInfoModel extends Equatable { final String name; final String phone; final int isVip; + final int isTrial; final String tag; final int status; final int start; @@ -27,6 +28,7 @@ class UserInfoModel extends Equatable { name: '', phone: '', isVip: 0, + isTrial: 0, tag: '', status: 0, start: 0, @@ -40,6 +42,7 @@ class UserInfoModel extends Equatable { required this.name, required this.phone, required this.isVip, + required this.isTrial, required this.tag, required this.status, required this.start, @@ -49,8 +52,19 @@ class UserInfoModel extends Equatable { }); @override - List get props => - [id, name, phone, isVip, tag, status, start, end, contentCon, contentRef]; + List get props => [ + id, + name, + phone, + isVip, + isTrial, + tag, + status, + start, + end, + contentCon, + contentRef + ]; } @JsonSerializable() diff --git a/lib/model/user_info_model.g.dart b/lib/model/user_info_model.g.dart index 4e82a93..f07ef90 100644 --- a/lib/model/user_info_model.g.dart +++ b/lib/model/user_info_model.g.dart @@ -12,16 +12,17 @@ UserInfoModel _$UserInfoModelFromJson(Map json) => name: json['name'] as String, phone: json['phone'] as String, isVip: json['is_vip'] as int, - tag: json['tag']as String, + isTrial: json['is_trial'] as int, + tag: json['tag'] as String, status: json['status'] as int, - start: json['start']as int, - end: json['end']as int, - contentCon:(json['content_con'] as List?) + start: json['start'] as int, + end: json['end'] as int, + contentCon: (json['content_con'] as List?) + ?.map((e) => Content.fromJson(e as Map)) + .toList(), + contentRef: (json['content_ref'] as List?) ?.map((e) => Content.fromJson(e as Map)) .toList(), - contentRef:(json['content_ref'] as List?) - ?.map((e) => Content.fromJson(e as Map)) - .toList(), ); Map _$UserInfoModelToJson(UserInfoModel instance) => @@ -29,23 +30,24 @@ Map _$UserInfoModelToJson(UserInfoModel instance) => 'id': instance.id, 'name': instance.name, 'phone': instance.phone, - 'is_vip':instance.isVip, - 'tag':instance.tag, + 'is_vip': instance.isVip, + 'is_trial': instance.isTrial, + 'tag': instance.tag, 'status': instance.status, - 'start':instance.start, - 'end':instance.end, - 'content_con':instance.contentCon, - 'content_ref':instance.contentRef, + 'start': instance.start, + 'end': instance.end, + 'content_con': instance.contentCon, + 'content_ref': instance.contentRef, }; Content _$ContentFromJson(Map json) => Content( id: json['id'] as int, content: json['content'] as String, isChecked: json['is_checked'] as int, -); + ); Map _$ContentToJson(Content instance) => { 'id': instance.id, 'content': instance.content, - 'is_checked':instance.isChecked, -}; \ No newline at end of file + 'is_checked': instance.isChecked, + }; diff --git a/lib/providers/user_provider.dart b/lib/providers/user_provider.dart index 8f1caae..e5978fc 100644 --- a/lib/providers/user_provider.dart +++ b/lib/providers/user_provider.dart @@ -78,7 +78,7 @@ class UserProvider extends ChangeNotifier { Future updateConSms() async { final prefs = await SharedPreferences.getInstance(); final service = FlutterBackgroundService(); - var base = await apiClient.request(API.app.find, data: {'status': 1}); + var base = await apiClient.request(API.content.find, data: {'status': 1}); if (base.code == 0) { await prefs.remove('conSms'); await prefs.setString( @@ -101,7 +101,7 @@ class UserProvider extends ChangeNotifier { Future updateRefSms() async { final prefs = await SharedPreferences.getInstance(); final service = FlutterBackgroundService(); - var base = await apiClient.request(API.app.find, data: {'status': 2}); + var base = await apiClient.request(API.content.find, data: {'status': 2}); if (base.code == 0) { await prefs.remove('refSms'); await prefs.setString( diff --git a/lib/ui/home/add_sms_page.dart b/lib/ui/home/add_sms_page.dart index 492eabc..fefc85e 100644 --- a/lib/ui/home/add_sms_page.dart +++ b/lib/ui/home/add_sms_page.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:project_telephony/model/sms_content_model.dart'; import 'package:project_telephony/utils/user_tool.dart'; import 'package:provider/provider.dart'; @@ -8,6 +9,7 @@ import '../../base/base_style.dart'; import '../../constants/api.dart'; import '../../model/network/api_client.dart'; import '../../model/network/base_model.dart'; +import '../../model/user_info_model.dart'; import '../../providers/user_provider.dart'; import '../../utils/toast/cloud_toast.dart'; import '../user/content_details_page.dart'; @@ -25,7 +27,6 @@ class AddSmsPage extends StatefulWidget { class _AddSmsPageState extends State { late TextEditingController _controller; - String contant=""; @override void initState() { @@ -91,7 +92,7 @@ class _AddSmsPageState extends State { border: _controller.text.isEmpty, opacity: contant.isEmpty ? 0.4 : 1, onTap: () async { - BaseModel res = await apiClient.request(API.app.content, data: { + BaseModel res = await apiClient.request(API.content.content, data: { 'content': _controller.text, 'status': widget.status, }); diff --git a/lib/ui/home/answer_idle.dart b/lib/ui/home/answer_idle.dart index 7e6ea85..eae8ff2 100644 --- a/lib/ui/home/answer_idle.dart +++ b/lib/ui/home/answer_idle.dart @@ -9,6 +9,7 @@ import '../../base/base_style.dart'; import '../../constants/api.dart'; import '../../model/network/api_client.dart'; import '../../model/network/base_model.dart'; +import '../../model/sms_content_model.dart'; import '../../providers/user_provider.dart'; import '../../utils/toast/cloud_toast.dart'; import '../widget/centertipsalterwidget.dart'; @@ -32,6 +33,7 @@ class _AnswerIdleListState extends State with AutomaticKeepAliveClientMixin { final userProvider = Provider.of(Get.context!, listen: false); List textList = ['现在无法接听。有什么事吗?', '自定义短信内容']; + List _model = []; List textListSMS = []; List smsIdList = []; int isCheck = 0; @@ -90,13 +92,6 @@ class _AnswerIdleListState extends State ])) ], ); - - // ListView.builder( - // itemBuilder: (context, index) { - // return _getBox(textListSMS[index], index); - // }, - // itemCount: textListSMS.length, - // ), } updateList() async { @@ -105,14 +100,22 @@ class _AnswerIdleListState extends State smsIdList.clear(); int i = 0; // contentRef - userProvider.userInfo.contentCon?.forEach((model) { + var base = await apiClient.request(API.content.findByStatus, data: {'status': 1}); + if (base.code == 0) { + _model=(base.data as List) + .map((e) => SmsContentModel.fromJson(e)) + .toList(); + } else { + CloudToast.show(base.msg); + } + for (var model in _model) { textListSMS.add(model.content); smsIdList.add(model.id); if (model.isChecked == 1) { isCheck = i; } i++; - }); + } textListSMS.add("自定义短信内容"); } else { textListSMS = textList; @@ -155,7 +158,7 @@ class _AnswerIdleListState extends State return GestureDetector( onTap: () async { if (content != "自定义短信内容") { - BaseModel res = await apiClient.request(API.app.checked, + BaseModel res = await apiClient.request(API.content.checked, data: {'id': smsIdList[index], 'status': 1}); if (res.code == 0) { setState(() {}); diff --git a/lib/ui/home/calling_idle_list.dart b/lib/ui/home/calling_idle_list.dart index 009ff79..4bd632a 100644 --- a/lib/ui/home/calling_idle_list.dart +++ b/lib/ui/home/calling_idle_list.dart @@ -12,6 +12,7 @@ import '../../base/base_style.dart'; import '../../constants/api.dart'; import '../../model/network/api_client.dart'; import '../../model/network/base_model.dart'; +import '../../model/sms_content_model.dart'; import '../../providers/user_provider.dart'; import '../../utils/toast/cloud_toast.dart'; import '../widget/centertipsalterwidget.dart'; @@ -19,13 +20,19 @@ import 'add_sms_page.dart'; class CallingIdleList extends StatefulWidget { final EasyRefreshController refreshController; - final bool isIdle; + final String title; + final int status; + final bool? isIdle; + final Color themeColor; - // final List contant; - - const CallingIdleList( - {Key? key, required this.refreshController, required this.isIdle}) - : super(key: key); + const CallingIdleList({ + Key? key, + required this.title, + required this.status, + this.isIdle = false, + required this.themeColor, + required this.refreshController, + }) : super(key: key); @override _CallingIdleListState createState() => _CallingIdleListState(); @@ -35,13 +42,17 @@ class _CallingIdleListState extends State with AutomaticKeepAliveClientMixin { final userProvider = Provider.of(Get.context!, listen: false); List textList = ['现在无法接听。有什么事吗?', '自定义短信内容']; + List _model = []; List textListSMS = []; List smsIdList = []; int isCheck = 0; bool val = false; - // final EasyRefreshController _easyRefreshController = EasyRefreshController(); - + @override + void initState() { + super.initState(); + updateList(); + } @override Widget build(BuildContext context) { @@ -49,59 +60,54 @@ class _CallingIdleListState extends State children: [ _getText(), 32.hb, - widget.isIdle + 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: [ + firstRefresh: true, + controller: widget.refreshController, + header: MaterialHeader(), + // footer: MaterialFooter(), + onRefresh: () async { + await userProvider.updateUserInfo(); + userProvider.updateRefSms(); + await updateList(); + setState(() {}); + }, + slivers: [ SliverList( - delegate: - SliverChildBuilderDelegate((context, index) { - return _getBox(textListSMS[index], index); - }, childCount: textListSMS.length)) - ])) + 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: [ + firstRefresh: true, + controller: widget.refreshController, + header: MaterialHeader(), + // footer: MaterialFooter(), + onRefresh: () async { + await userProvider.updateUserInfo(); + userProvider.updateRefSms(); + await updateList(); + setState(() {}); + }, + slivers: [ SliverList( - delegate: SliverChildBuilderDelegate((context, index) { - return _getBox(textListSMS[index], index); - }, childCount: textListSMS.length)) - ])) + 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 { @@ -109,14 +115,23 @@ class _CallingIdleListState extends State textListSMS.clear(); smsIdList.clear(); int i = 0; - userProvider.userInfo.contentRef?.forEach((model) { + var base = await apiClient + .request(API.content.findByStatus, data: {'status': widget.status}); + if (base.code == 0) { + _model = (base.data as List) + .map((e) => SmsContentModel.fromJson(e)) + .toList(); + } else { + CloudToast.show(base.msg); + } + for (var model in _model) { textListSMS.add(model.content); smsIdList.add(model.id); if (model.isChecked == 1) { isCheck = i; } i++; - }); + } textListSMS.add("自定义短信内容"); } else { textListSMS = textList; @@ -126,7 +141,6 @@ class _CallingIdleListState extends State _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( @@ -134,19 +148,13 @@ class _CallingIdleListState extends State style: TextStyle(fontWeight: FontWeight.bold, fontSize: 36.sp), ), subtitle: Text( - widget.isIdle - ? "您给朋友去电拒接/未接后所发送的短信":"朋友给你来电接听后所发送的短信", + widget.title, style: TextStyle(color: const Color(0xFF999999), fontSize: 27.sp), ), - trailing: widget.isIdle + trailing: widget.isIdle! ? Switch( value: val, onChanged: (value) async { - // if(!value){ - // - // } - // await prefs.setBool("kg", value); - // print("这是数据${prefs.getBool("kg")}"); setState(() { val = value; }); @@ -159,7 +167,7 @@ class _CallingIdleListState extends State return GestureDetector( onTap: () async { if (content != "自定义短信内容") { - BaseModel res = await apiClient.request(API.app.checked, + BaseModel res = await apiClient.request(API.content.checked, data: {'id': smsIdList[index], 'status': 2}); if (res.code == 0) { setState(() {}); @@ -223,12 +231,8 @@ class _CallingIdleListState extends State begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ - index == isCheck - ? const Color(0xFF13CA9D) - : const Color(0xFFF9F9F9), - index == isCheck - ? const Color(0xFF72E4C8) - : const Color(0xFFF9F9F9), + index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9), + index == isCheck ? widget.themeColor : const Color(0xFFF9F9F9), ]), ), child: Text( diff --git a/lib/ui/home/content_connect_page.dart b/lib/ui/home/content_connect_page.dart index 1e0ad22..ccda0e9 100644 --- a/lib/ui/home/content_connect_page.dart +++ b/lib/ui/home/content_connect_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:project_telephony/base/base_style.dart'; @@ -10,7 +9,6 @@ import 'package:tab_indicator_styler/tab_indicator_styler.dart'; import 'answer_idle.dart'; - class ContentConnectPage extends StatefulWidget { const ContentConnectPage({Key? key}) : super(key: key); @@ -22,9 +20,9 @@ class _ContentConnectPageState extends State with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin { late TabController _tabController; final EasyRefreshController _answerRefreshController = - EasyRefreshController(); + EasyRefreshController(); final EasyRefreshController _wasAnswerRefreshController = - EasyRefreshController(); + EasyRefreshController(); @override void initState() { @@ -44,89 +42,76 @@ class _ContentConnectPageState extends State Widget build(BuildContext context) { super.build(context); return Scaffold( - appBar: AppBar( - elevation: 0, - title: Text( - '选择短信内容', - style: Theme.of(context).textTheme.headline6, - ), - leading: const CloudBackButton(isSpecial: true), - backgroundColor: kForeGroundColor, + appBar: AppBar( + elevation: 0, + title: Text( + '选择短信内容', + style: Theme.of(context).textTheme.headline6, ), - backgroundColor: Colors.white, - body: Column( - children: [ - Container( - width:double.infinity, - 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, - labelColor:const Color(0xFF1890FF), - unselectedLabelColor:const Color(0xFF999999), - unselectedLabelStyle:const TextStyle(fontWeight:FontWeight.bold), - labelStyle:const TextStyle(fontWeight:FontWeight.bold), - onTap: (num) { - if(num==0){ - _answerRefreshController.callRefresh(); - }else{ - _wasAnswerRefreshController.callRefresh(); - } - // - }, - indicator: RectangularIndicator( - color: Colors.white, - bottomLeftRadius: 44.w, - bottomRightRadius: 44.w, - topLeftRadius: 44.w, - topRightRadius: 44.w, - // paintingStyle: PaintingStyle.fill, - ), - // indicatorSize: TabBarIndicatorSize.label, - // isScrollable: true, - tabs: const [ - // _tab(0, "被叫接听"),_tab(1, "主叫接听"), - Tab(text: "被叫接听",),Tab(text: "主叫接听",) - - ]), - - - ), - Expanded( - child: TabBarView(controller: _tabController, children: [ - // _getBox(), - AnswerIdleList( - // contant: const [], - refreshController: _answerRefreshController, isIdle: false, + leading: const CloudBackButton(isSpecial: true), + backgroundColor: kForeGroundColor, + ), + backgroundColor: Colors.white, + body: Column( + children: [ + Container( + width: double.infinity, + 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( + controller: _tabController, + labelColor: const Color(0xFF1890FF), + unselectedLabelColor: const Color(0xFF999999), + unselectedLabelStyle: + const TextStyle(fontWeight: FontWeight.bold), + labelStyle: const TextStyle(fontWeight: FontWeight.bold), + onTap: (num) { + if (num == 0) { + _answerRefreshController.callRefresh(); + } else { + _wasAnswerRefreshController.callRefresh(); + } + }, + indicator: RectangularIndicator( + color: Colors.white, + bottomLeftRadius: 44.w, + bottomRightRadius: 44.w, + topLeftRadius: 44.w, + topRightRadius: 44.w, + ), + tabs: const [ + Tab( + text: "被叫接听", ), - AnswerIdleList( - // contant: const [], - refreshController: _wasAnswerRefreshController, isIdle: true, + Tab( + text: "主叫接听", ) - ])) - ], - )); + ]), + ), + Expanded( + child: TabBarView( + controller: _tabController, + children: [ + AnswerIdleList( + refreshController: _answerRefreshController, + isIdle: false, + ), + AnswerIdleList( + refreshController: _wasAnswerRefreshController, + isIdle: true, + ), + ], + ), + ), + ], + ), + ); } - // _getBox() { - // return Container( - // color: Colors.red, - // width: 200.w, - // height: 200.w, - // ); - // } - // - // _tab(int int, String string) { - // return Text( - // string, - // style: TextStyle( - // fontSize: BaseStyle.fontSize28, color:const Color(0xFF1890FF) ), - // ); - // } - @override bool get wantKeepAlive => true; } diff --git a/lib/ui/home/content_refuse_page.dart b/lib/ui/home/content_refuse_page.dart index 8c0af24..207eb2e 100644 --- a/lib/ui/home/content_refuse_page.dart +++ b/lib/ui/home/content_refuse_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:project_telephony/base/base_style.dart'; @@ -41,87 +40,79 @@ class _ContentRefusePageState extends State Widget build(BuildContext context) { super.build(context); return Scaffold( - appBar: AppBar( - elevation: 0, - title: Text( - '选择短信内容', - style: Theme.of(context).textTheme.headline6, - ), - leading: const CloudBackButton(isSpecial: true), - backgroundColor: kForeGroundColor, + appBar: AppBar( + elevation: 0, + title: Text( + '选择短信内容', + style: Theme.of(context).textTheme.headline6, ), - backgroundColor: Colors.white, - body: Column( - children: [ - Container( - width:double.infinity, - 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, - labelColor:const Color(0xFF1890FF), - unselectedLabelColor:const Color(0xFF999999), - unselectedLabelStyle:const TextStyle(fontWeight:FontWeight.bold), - labelStyle:const TextStyle(fontWeight:FontWeight.bold), - onTap: (num) { - if(num==0){ - _callingRefreshController.callRefresh(); - }else{ - _wasCalledRefreshController.callRefresh(); - } - // - }, - indicator: RectangularIndicator( - color: Colors.white, - bottomLeftRadius: 44.w, - bottomRightRadius: 44.w, - topLeftRadius: 44.w, - topRightRadius: 44.w, - // paintingStyle: PaintingStyle.fill, - ), - // indicatorSize: TabBarIndicatorSize.label, - // isScrollable: true, - tabs: const [ - // _tab(0, "被叫接听"),_tab(1, "主叫接听"), - Tab(text: "被叫拒接/未接",),Tab(text: "主叫拒接/未接",) - ]), - - - ), - Expanded( - child: TabBarView(controller: _tabController, children: [ - // _getBox(), - CallingIdleList( - // contant: const [], - refreshController: _callingRefreshController, - isIdle: false, + leading: const CloudBackButton(isSpecial: true), + backgroundColor: kForeGroundColor, + ), + backgroundColor: Colors.white, + body: Column( + children: [ + Container( + width: double.infinity, + 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, + labelColor: const Color(0xFF1890FF), + unselectedLabelColor: const Color(0xFF999999), + unselectedLabelStyle: + const TextStyle(fontWeight: FontWeight.bold), + labelStyle: const TextStyle(fontWeight: FontWeight.bold), + onTap: (num) { + if (num == 0) { + _callingRefreshController.callRefresh(); + } else { + _wasCalledRefreshController.callRefresh(); + } + }, + indicator: RectangularIndicator( + color: Colors.white, + bottomLeftRadius: 44.w, + bottomRightRadius: 44.w, + topLeftRadius: 44.w, + topRightRadius: 44.w, ), - CallingIdleList( - // contant: const [], - refreshController: _wasCalledRefreshController, isIdle: true, - ) - ])) - ], - )); - } - - _getBox() { - return Container( - color: Colors.red, - width: 200.w, - height: 200.w, - ); - } - - _tab(int int, String string) { - return Text( - string, - style: TextStyle( - fontSize: BaseStyle.fontSize28, color:const Color(0xFF1890FF) ), + tabs: const [ + Tab( + text: "被叫拒接/未接", + ), + Tab( + text: "主叫拒接/未接", + ), + ], + ), + ), + Expanded( + child: TabBarView( + controller: _tabController, + children:[ + CallingIdleList( + isIdle: false, + status: 2, + themeColor: const Color(0xFF13CA9D), + title: '朋友给你来电接听后所发送的短信', refreshController: _callingRefreshController, + ), + CallingIdleList( + isIdle: true, + status: 4, + title: '您给朋友去电拒接/未接后所发送的短信', + themeColor: const Color(0xFF13CA9D), refreshController: _wasCalledRefreshController, + ), + ], + ), + ), + ], + ), ); } diff --git a/lib/ui/widget/centertipsalterwidget.dart b/lib/ui/widget/centertipsalterwidget.dart index ccbe800..a36732f 100644 --- a/lib/ui/widget/centertipsalterwidget.dart +++ b/lib/ui/widget/centertipsalterwidget.dart @@ -57,7 +57,7 @@ class _CentertipsalterwidgetState extends State { CupertinoDialogAction( child: const Text('确定'), onPressed: () async { - BaseModel res = await apiClient.request(API.app.delete, data: { + BaseModel res = await apiClient.request(API.content.delete, data: { 'id': widget.id, }); if (res.code == 0) {