戴余标 2 years ago
commit 91b738ce4b

@ -7,13 +7,15 @@ part 'phone_num_model.g.dart';
class PhoneNumModel extends Equatable{ class PhoneNumModel extends Equatable{
final String num; final String num;
final int time; final int time;
final String name;
factory PhoneNumModel.fromJson(Map<String, dynamic> json) =>_$PhoneNumModelFromJson(json); factory PhoneNumModel.fromJson(Map<String, dynamic> json) =>_$PhoneNumModelFromJson(json);
const PhoneNumModel({ const PhoneNumModel({
required this.name,
required this.num, required this.num,
required this.time, required this.time,
}); });
@override @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( PhoneNumModel(
num: json['num'] as String, num: json['num'] as String,
time: json['time'] as int, 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:flutter/material.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart'; import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/utils/headers.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'; import '../../../../model/phone_num_model.dart';
@ -15,35 +15,52 @@ class CallRecordsList extends StatefulWidget {
class _CallRecordsListState extends State<CallRecordsList> { class _CallRecordsListState extends State<CallRecordsList> {
List<PhoneNumModel> phoneNum = []; List<PhoneNumModel> phoneNum = [];
final EasyRefreshController _easyRefreshController = EasyRefreshController();
List a = []; List a = [];
int b = 0; int b = 0;
@override @override
Widget build(BuildContext context) { void dispose() {
return Column( _easyRefreshController.dispose();
children: [ super.dispose();
Container( }
width: 750.w,
height: 1000.w,
child: Text("")
// ListView( @override
// children: [], 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 {
PloneBottom(onTap: () async { // // Iterable<CallLogEntry> entries = await CallLog.get();
// Iterable<CallLogEntry> entries = await CallLog.get(); // final Iterable<CallLogEntry> entries = await CallLog.query();
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; _getBox(PhoneNumModel item){
print("通话记录条数$b"); return ListTile(
}) title: Text(item.num),
],
); );
} }
// _getPhone(){
// return ListView.builder(itemBuilder: (context,index){},itemCount: ,);
// }
} }

Loading…
Cancel
Save