王亚玲 2 years ago
parent 221820c0d8
commit d05397492a

@ -7,13 +7,15 @@ part 'phone_num_model.g.dart';
class PhoneNumModel extends Equatable{
final String num;
final int time;
final String name;
factory PhoneNumModel.fromJson(Map<String, dynamic> json) =>_$PhoneNumModelFromJson(json);
const PhoneNumModel({
required this.name,
required this.num,
required this.time,
});
@override
List<Object?> get props => [num,time,];
List<Object?> get props => [num,time,name];
}

@ -10,4 +10,5 @@ PhoneNumModel _$PhoneNumModelFromJson(Map<String, dynamic> json) =>
PhoneNumModel(
num: json['num'] as String,
time: json['time'] as int,
name: json['name'] as String,
);

@ -2,7 +2,7 @@ import 'package:call_log/call_log.dart';
import 'package:flutter/material.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import '../../../../model/phone_num_model.dart';
@ -15,35 +15,52 @@ class CallRecordsList extends StatefulWidget {
class _CallRecordsListState extends State<CallRecordsList> {
List<PhoneNumModel> phoneNum = [];
final EasyRefreshController _easyRefreshController = EasyRefreshController();
List a = [];
int b = 0;
@override
Widget build(BuildContext context) {
return Column(
children: [
Container(
width: 750.w,
height: 1000.w,
child: Text("")
void dispose() {
_easyRefreshController.dispose();
super.dispose();
}
// ListView(
// children: [],
@override
Widget build(BuildContext context) {
return
Expanded(
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {},
child: ListView.builder(itemBuilder: (context, index) {
return _getBox(phoneNum[index]);
}),
));
// Column(
// children: [
// Container(width: 750.w, height: 1000.w, child: Text("")
//
// // ListView(
// // children: [],
// // ),
// ),
),
PloneBottom(onTap: () async {
// Iterable<CallLogEntry> entries = await CallLog.get();
final Iterable<CallLogEntry> entries = await CallLog.query();
// PloneBottom(onTap: () async {
// // Iterable<CallLogEntry> entries = await CallLog.get();
// final Iterable<CallLogEntry> entries = await CallLog.query();
// for (CallLogEntry entrie in entries) {
// a.add(entrie.number);
// }
// // var b = entries.length;
// print("通话记录条数$a");
// })
// ],
// );
}
var b = entries;
print("通话记录条数$b");
})
],
_getBox(PhoneNumModel item){
return ListTile(
title: Text(item.num),
);
}
// _getPhone(){
// return ListView.builder(itemBuilder: (context,index){},itemCount: ,);
// }
}

Loading…
Cancel
Save