From d05397492acd6c6c67da56a0a492d8595b8e367e Mon Sep 17 00:00:00 2001 From: wylyl22 <2373073266@qq.com> Date: Fri, 9 Sep 2022 09:57:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/model/phone_num_model.dart | 4 +- lib/model/phone_num_model.g.dart | 1 + .../set/phone_num_list/call_records_list.dart | 67 ++++++++++++------- 3 files changed, 46 insertions(+), 26 deletions(-) diff --git a/lib/model/phone_num_model.dart b/lib/model/phone_num_model.dart index e1db27a..774be2b 100644 --- a/lib/model/phone_num_model.dart +++ b/lib/model/phone_num_model.dart @@ -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 json) =>_$PhoneNumModelFromJson(json); const PhoneNumModel({ + required this.name, required this.num, required this.time, }); @override - List get props => [num,time,]; + List get props => [num,time,name]; } \ No newline at end of file diff --git a/lib/model/phone_num_model.g.dart b/lib/model/phone_num_model.g.dart index 755cfca..f91b707 100644 --- a/lib/model/phone_num_model.g.dart +++ b/lib/model/phone_num_model.g.dart @@ -10,4 +10,5 @@ PhoneNumModel _$PhoneNumModelFromJson(Map json) => PhoneNumModel( num: json['num'] as String, time: json['time'] as int, + name: json['name'] as String, ); diff --git a/lib/ui/home/set/phone_num_list/call_records_list.dart b/lib/ui/home/set/phone_num_list/call_records_list.dart index 55c59e2..65caf7e 100644 --- a/lib/ui/home/set/phone_num_list/call_records_list.dart +++ b/lib/ui/home/set/phone_num_list/call_records_list.dart @@ -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 { List 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("") - - // ListView( - // children: [], - // ), - ), - PloneBottom(onTap: () async { - // Iterable entries = await CallLog.get(); - final Iterable entries = await CallLog.query(); - - var b = entries; - print("通话记录条数$b"); - }) - ], - ); + void dispose() { + _easyRefreshController.dispose(); + super.dispose(); } -// _getPhone(){ -// return ListView.builder(itemBuilder: (context,index){},itemCount: ,); -// } + @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 entries = await CallLog.get(); + // final Iterable entries = await CallLog.query(); + // for (CallLogEntry entrie in entries) { + // a.add(entrie.number); + // } + // // var b = entries.length; + // print("通话记录条数$a"); + // }) + // ], + // ); + } +_getBox(PhoneNumModel item){ + return ListTile( + title: Text(item.num), + ); +} }