Compare commits

..

No commits in common. 'c85c2ebd1073f2884e9607e2ceaee3b474efd0b1' and '91b738ce4b4e6da1c54b37b6c220df349d348950' have entirely different histories.

@ -14,7 +14,6 @@ import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:power_logger/power_logger.dart'; import 'package:power_logger/power_logger.dart';
import 'package:project_telephony/providers/phone_num_provider.dart';
import 'package:project_telephony/providers/user_provider.dart'; import 'package:project_telephony/providers/user_provider.dart';
import 'package:project_telephony/ui/home/call.dart'; import 'package:project_telephony/ui/home/call.dart';
@ -72,7 +71,6 @@ class _MyAppState extends State<MyApp> {
return MultiProvider( return MultiProvider(
providers: [ providers: [
ChangeNotifierProvider(create: (context) => UserProvider()), ChangeNotifierProvider(create: (context) => UserProvider()),
ChangeNotifierProvider(create: (context)=>PhoneNumProvider()),
], ],
child: MediaQuery( child: MediaQuery(
data: MediaQueryData.fromWindow(WidgetsBinding.instance.window), data: MediaQueryData.fromWindow(WidgetsBinding.instance.window),

@ -2,22 +2,20 @@ import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
part 'phone_num_model.g.dart'; part 'phone_num_model.g.dart';
@JsonSerializable()
@JsonSerializable()
class PhoneNumModel extends Equatable{ class PhoneNumModel extends Equatable{
final String? num; final String num;
final int? time; final int time;
final String? name; final String name;
bool state ;
factory PhoneNumModel.fromJson(Map<String, dynamic> json) =>_$PhoneNumModelFromJson(json); factory PhoneNumModel.fromJson(Map<String, dynamic> json) =>_$PhoneNumModelFromJson(json);
PhoneNumModel({ const PhoneNumModel({
required this.name, required this.name,
required this.num, required this.num,
required this.time, required this.time,
required this.state,
}); });
@override @override
List<Object?> get props => [num,time,name,state]; List<Object?> get props => [num,time,name];
} }

@ -11,5 +11,4 @@ PhoneNumModel _$PhoneNumModelFromJson(Map<String, dynamic> json) =>
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, name: json['name'] as String,
state: json['state']as bool,
); );

@ -1,28 +0,0 @@
import 'package:call_log/call_log.dart';
import 'package:flutter/material.dart';
import '../model/phone_num_model.dart';
import '../utils/hive_store.dart';
class PhoneNumProvider extends ChangeNotifier{
final List<PhoneNumModel> _phoneNum=[PhoneNumModel(num: "",time: 0,name: "", state:false)];
List<PhoneNumModel> get phoneNum=>_phoneNum;
Future list(List<PhoneNumModel> phoneList) async{
// await HiveStore.dataBox!.get();
// final Iterable<CallLogEntry> entries = await CallLog.query();
// for (CallLogEntry entrie in entries) {
// _phoneNum.add(PhoneNumModel(
// num: entrie.number,
// time: entrie.timestamp,
// name: entrie.name,
// state: false,
// ));
// // a.add(entrie.number);
// }
// final phoneList=_phoneNum.toSet();
// final phoneList= HiveStore.dataBox?.get(phoneNum);
return ;
}
// Future
}

@ -1,14 +1,10 @@
import 'package:call_log/call_log.dart'; import 'package:call_log/call_log.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import '../../../../model/phone_num_model.dart';
import '../../../widget/scaffold_theme_widget.dart';
import '../../../../model/phone_num_model.dart';
class CallRecordsList extends StatefulWidget { class CallRecordsList extends StatefulWidget {
const CallRecordsList({Key? key}) : super(key: key); const CallRecordsList({Key? key}) : super(key: key);
@ -19,69 +15,28 @@ class CallRecordsList extends StatefulWidget {
class _CallRecordsListState extends State<CallRecordsList> { class _CallRecordsListState extends State<CallRecordsList> {
List<PhoneNumModel> phoneNum = []; List<PhoneNumModel> phoneNum = [];
List<PhoneNumModel> phoneNum2 = [];
final EasyRefreshController _easyRefreshController = EasyRefreshController(); final EasyRefreshController _easyRefreshController = EasyRefreshController();
late bool notifications; List a = [];
late bool trackHistory; int b = 0;
late bool instantOrders;
late SharedPreferences prefs;
List<String> numList=[];
@override
void initState() {
// getList();
getList();
super.initState();
}
@override @override
void dispose() { void dispose() {
_easyRefreshController.dispose(); _easyRefreshController.dispose();
super.dispose(); super.dispose();
} }
getList() async {
phoneNum.clear();
final Iterable<CallLogEntry> entries = await CallLog.query();
for (CallLogEntry entrie in entries) {
if(!numList.contains(entrie.number)){
numList.add(entrie.number!);
phoneNum.add(PhoneNumModel(
num: entrie.number,
time: entrie.timestamp,
name: entrie.name,
state: false,
));
}
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var profileBuilder = FutureBuilder( return
future: getList() , // a Future<String> or null Expanded(
builder: (BuildContext context, AsyncSnapshot<String> snapshot) { child: EasyRefresh(
if(snapshot.connectionState==ConnectionState.done){ firstRefresh: true,
return ListView.builder( header: MaterialHeader(),
itemBuilder: (context, index) { onRefresh: () async {},
return _getBox(phoneNum[index]); child: ListView.builder(itemBuilder: (context, index) {
}, return _getBox(phoneNum[index]);
itemCount: phoneNum.length, }),
); ));
}else{
return const SizedBox();
}
});
return ScaffoldThemeWidget(
bottom: '添加',
title: '从通话记录添加',
isBorder: true,
isOpacity: false,
onTap: () {
},
child: profileBuilder
);
// Column( // Column(
// children: [ // children: [
// Container(width: 750.w, height: 1000.w, child: Text("") // Container(width: 750.w, height: 1000.w, child: Text("")
@ -103,32 +58,9 @@ return ScaffoldThemeWidget(
// ); // );
} }
_getBox(PhoneNumModel item) { _getBox(PhoneNumModel item){
return CheckboxListTile( return ListTile(
onChanged: (bool? value) { title: Text(item.num),
setState((){
item.state = value!;
});
},
value: item.state,
title: Text(
item.num!,
style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold),
),
subtitle: Row(
children: [
Text(
DateUtil.formatDateMs(item.time! * 1000, format: 'MM/dd HH:mm'),
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
),
30.wb,
Text(
item.name == null ? "" : item.name!,
style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999),
)
],
),
); );
} }
} }

@ -1,5 +1,3 @@
import 'package:call_log/call_log.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/ui/exclude/exclude_contacts_page.dart'; import 'package:project_telephony/ui/exclude/exclude_contacts_page.dart';
@ -11,8 +9,7 @@ import 'package:project_telephony/ui/widget/plone_bottom.dart';
import '../../../base/base_style.dart'; import '../../../base/base_style.dart';
import '../../../model/phone_num_model.dart'; import '../../widget/plone_back_button.dart';
import '../../widget/scaffold_theme_widget.dart'; import '../../widget/scaffold_theme_widget.dart';
class SpecifyPhonePage extends StatefulWidget { class SpecifyPhonePage extends StatefulWidget {

@ -1,16 +1,10 @@
// import 'package:project_telephony/providers/phone_provider.dart'; // import 'package:project_telephony/providers/phone_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../providers/phone_num_provider.dart';
import '../providers/user_provider.dart'; import '../providers/user_provider.dart';
import 'headers.dart'; import 'headers.dart';
class UserTool { class UserTool {
static UserProvider userProvider = static UserProvider userProvider =
Provider.of<UserProvider>(Get.context!, listen: false); Provider.of<UserProvider>(Get.context!, listen: false);
// static PhoneProvider phoneProvider=Provider.of<PhoneProvider>(Get.context!, listen: false); // static PhoneProvider phoneProvider=Provider.of<PhoneProvider>(Get.context!, listen: false);
}
class PhoneTool {
static PhoneNumProvider phoneNumProvider =
Provider.of<PhoneNumProvider>(Get.context!, listen: false);
} }

Loading…
Cancel
Save