列表刷新

master
王亚玲 2 years ago
parent 3b0bdfac3a
commit cd8ed0c77f

@ -104,7 +104,8 @@ class _AnswerIdleListState extends State<AnswerIdleList>
textListSMS.clear();
smsIdList.clear();
int i = 0;
userProvider.userInfo.contentRef?.forEach((model) {
// contentRef
userProvider.userInfo.contentCon?.forEach((model) {
textListSMS.add(model.content);
smsIdList.add(model.id);
if (model.isChecked == 1) {

@ -49,7 +49,10 @@ void onStart(ServiceInstance service) async {
int flag = 0;
String? phoneNum = "";
int? callRecords = 0;
String? state1="";
// CallType? state1;
String callState;
final Iterable<CallLogEntry> entry = await CallLog.query();
service.on('stopService').listen((event) {
service.stopSelf();
});
@ -63,33 +66,49 @@ void onStart(ServiceInstance service) async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
CallState state = await Telephony.instance.callState;
callState = state.name;
// print(entry.first.duration);
print(callState+"$flag");
String? ref = prefs.getString('refSms');
String? con = prefs.getString('conSms');
// print(con);
if (callState == "IDLE") {
//
if (flag != 0) {
final Iterable<CallLogEntry> entry = await CallLog.query();
phoneNum = entry.first.number;
callRecords = entry.first.duration;
print(phoneNum);
if (flag > 0) {
print("2");
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!);
print("来电拒接/未接");
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!);
print("发送成功");
} else {
print("3");
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: con!);
} else if(flag==-1){
print("来电接听");
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: con!);
}else {
print(entry.first.callType);
print(entry.first.duration);
if(entry.first.duration!>0){
print("去电接听");
}else{
print("去电未接");
}
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: con!);
print("发送成功");
}
flag = 0;
}
} else if (callState == "RINGING") {
flag++;
//
flag=1;
print('通话');
} else if (callState == "OFFHOOK") {
//
if (flag > 0) flag *= -1;
if(flag==0)flag=-2;
print('不通话');
}
});
}
}

@ -41,6 +41,8 @@ class _CallingIdleListState extends State<CallingIdleList>
bool val = false;
// final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override
Widget build(BuildContext context) {
return Column(

@ -21,9 +21,9 @@ class ContentConnectPage extends StatefulWidget {
class _ContentConnectPageState extends State<ContentConnectPage>
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
late TabController _tabController;
final EasyRefreshController _callingRefreshController =
final EasyRefreshController _answerRefreshController =
EasyRefreshController();
final EasyRefreshController _wasCalledRefreshController =
final EasyRefreshController _wasAnswerRefreshController =
EasyRefreshController();
@override
@ -35,8 +35,8 @@ class _ContentConnectPageState extends State<ContentConnectPage>
@override
void dispose() {
_tabController.dispose();
_callingRefreshController.dispose();
_wasCalledRefreshController.dispose();
_answerRefreshController.dispose();
_wasAnswerRefreshController.dispose();
super.dispose();
}
@ -69,9 +69,14 @@ class _ContentConnectPageState extends State<ContentConnectPage>
unselectedLabelColor:const Color(0xFF999999),
unselectedLabelStyle:const TextStyle(fontWeight:FontWeight.bold),
labelStyle:const TextStyle(fontWeight:FontWeight.bold),
// onTap: () async{
// _refreshController.callRefresh();
// },
onTap: (num) {
if(num==0){
_answerRefreshController.callRefresh();
}else{
_wasAnswerRefreshController.callRefresh();
}
//
},
indicator: RectangularIndicator(
color: Colors.white,
bottomLeftRadius: 44.w,
@ -95,32 +100,32 @@ class _ContentConnectPageState extends State<ContentConnectPage>
// _getBox(),
AnswerIdleList(
// contant: const [],
refreshController: _callingRefreshController, isIdle: false,
refreshController: _answerRefreshController, isIdle: false,
),
AnswerIdleList(
// contant: const [],
refreshController: _callingRefreshController, isIdle: true,
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) ),
);
}
// _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;

@ -1,20 +1,11 @@
import 'dart:async';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/widget/centertipsalterwidget.dart';
import 'package:project_telephony/ui/widget/plone_back_button.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 '../../model/network/base_model.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart';
import 'add_sms_page.dart';
import 'calling_idle_list.dart';
class ContentRefusePage extends StatefulWidget {
@ -69,15 +60,21 @@ class _ContentRefusePageState extends State<ContentRefusePage>
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: () async{
// _refreshController.callRefresh();
// },
onTap: (num) {
if(num==0){
_callingRefreshController.callRefresh();
}else{
_wasCalledRefreshController.callRefresh();
}
//
},
indicator: RectangularIndicator(
color: Colors.white,
bottomLeftRadius: 44.w,
@ -91,7 +88,6 @@ class _ContentRefusePageState extends State<ContentRefusePage>
tabs: const [
// _tab(0, "被叫接听"),_tab(1, "主叫接听"),
Tab(text: "被叫拒接/未接",),Tab(text: "主叫拒接/未接",)
]),
@ -101,11 +97,12 @@ class _ContentRefusePageState extends State<ContentRefusePage>
// _getBox(),
CallingIdleList(
// contant: const [],
refreshController: _callingRefreshController, isIdle: false,
refreshController: _callingRefreshController,
isIdle: false,
),
CallingIdleList(
// contant: const [],
refreshController: _callingRefreshController, isIdle: true,
refreshController: _wasCalledRefreshController, isIdle: true,
)
]))
],

@ -28,11 +28,11 @@ class _LoadingState extends State<Loading> {
void initState() {
super.initState();
final userProvider = Provider.of<UserProvider>(context, listen: false);
// var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
// if (kDebugMode) {
// print('env :$env');
// }
// DevEV.instance.setEnvironment( context, environment: env == 'dev',);
var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
if (kDebugMode) {
print('env :$env');
}
DevEV.instance.setEnvironment( context, environment: env == 'dev',);
Future.delayed(const Duration(milliseconds: 1000), () async {
await initialAll();
if (!await userProvider.init()) {

Loading…
Cancel
Save