Showing
18 changed files
with
461 additions
and
94 deletions
| @@ -18,19 +18,19 @@ if (flutterRoot == null) { | @@ -18,19 +18,19 @@ if (flutterRoot == null) { | ||
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | -def flutterVersionCode = "515" | 21 | +def flutterVersionCode = "516" |
| 22 | if (flutterVersionCode == null) { | 22 | if (flutterVersionCode == null) { |
| 23 | - flutterVersionCode = '515' | 23 | + flutterVersionCode = '516' |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | -def flutterVersionName = "5.1.5" | 30 | +def flutterVersionName = "5.1.6" |
| 31 | 31 | ||
| 32 | if (flutterVersionName == null) { | 32 | if (flutterVersionName == null) { |
| 33 | - flutterVersionName = '5.1.5' | 33 | + flutterVersionName = '5.1.6' |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | } | 36 | } |
| @@ -50,7 +50,6 @@ import 'package:flutter/services.dart'; | @@ -50,7 +50,6 @@ import 'package:flutter/services.dart'; | ||
| 50 | import 'package:permission_handler/permission_handler.dart'; | 50 | import 'package:permission_handler/permission_handler.dart'; |
| 51 | import 'package:flutter_localizations/flutter_localizations.dart'; | 51 | import 'package:flutter_localizations/flutter_localizations.dart'; |
| 52 | 52 | ||
| 53 | - | ||
| 54 | // Future<bool> _requestPermissions() async { | 53 | // Future<bool> _requestPermissions() async { |
| 55 | // Map<Permission, PermissionStatus> permissions = await [ | 54 | // Map<Permission, PermissionStatus> permissions = await [ |
| 56 | // Permission.photos, | 55 | // Permission.photos, |
| @@ -274,15 +273,17 @@ class MyAppState extends State<MyApp> { | @@ -274,15 +273,17 @@ class MyAppState extends State<MyApp> { | ||
| 274 | home: isFirst | 273 | home: isFirst |
| 275 | ? FirstPage() | 274 | ? FirstPage() |
| 276 | : isLogin | 275 | : isLogin |
| 277 | - ? ChangeNotifierProvider<TableManagerModel>( | ||
| 278 | - create: (_) => TableManagerModel(), | ||
| 279 | - child: ChangeNotifierProvider<StoreBaseIndoProvider>( | ||
| 280 | - create: (_) => StoreBaseIndoProvider(), | ||
| 281 | - child: ChangeNotifierProvider<CollectStoreProvider>( | ||
| 282 | - create: (_) => CollectStoreProvider(), | ||
| 283 | - child: ChangeNotifierProvider<BaseIndoProvider>( | ||
| 284 | - create: (_) => BaseIndoProvider(), | ||
| 285 | - child: HomePage(initialIndex: 1))))) | 276 | + ? |
| 277 | + // ChangeNotifierProvider<TableManagerModel>( | ||
| 278 | + // create: (_) => TableManagerModel(), | ||
| 279 | + // child: ChangeNotifierProvider<StoreBaseIndoProvider>( | ||
| 280 | + // create: (_) => StoreBaseIndoProvider(), | ||
| 281 | + // child: ChangeNotifierProvider<CollectStoreProvider>( | ||
| 282 | + // create: (_) => CollectStoreProvider(), | ||
| 283 | + // child: ChangeNotifierProvider<BaseIndoProvider>( | ||
| 284 | + // create: (_) => BaseIndoProvider(), | ||
| 285 | + // child: HomePage(initialIndex: 1))))) | ||
| 286 | + HomePage(initialIndex: 1) | ||
| 286 | : ChangeNotifierProvider<OtherLoginProvider>( | 287 | : ChangeNotifierProvider<OtherLoginProvider>( |
| 287 | create: (_) => OtherLoginProvider(), | 288 | create: (_) => OtherLoginProvider(), |
| 288 | child: LoginPage()), | 289 | child: LoginPage()), |
| @@ -40,7 +40,7 @@ class UserHistoryEntity extends Object with ISuspensionBean { | @@ -40,7 +40,7 @@ class UserHistoryEntity extends Object with ISuspensionBean { | ||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | String get sexStr { | 42 | String get sexStr { |
| 43 | - if (sex != '1' && sex != '2' && sex != '3') return "先生"; | 43 | + if (sex != '1' && sex != '2' && sex != '3') return ""; |
| 44 | switch (sex.toString()) { | 44 | switch (sex.toString()) { |
| 45 | case "1": //先生 | 45 | case "1": //先生 |
| 46 | case "男": | 46 | case "男": |
| 1 | +// import 'dart:html'; | ||
| 2 | + | ||
| 3 | +// import 'dart:async'; | ||
| 4 | +// import 'dart:convert'; | ||
| 5 | +import 'dart:io'; | ||
| 6 | + | ||
| 7 | +import 'package:call_log/call_log.dart'; | ||
| 1 | import 'package:easy_contact_picker/easy_contact_picker.dart'; | 8 | import 'package:easy_contact_picker/easy_contact_picker.dart'; |
| 2 | import 'package:flutter/material.dart'; | 9 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter/services.dart'; | 10 | import 'package:flutter/services.dart'; |
| @@ -17,7 +24,9 @@ import 'package:one_key/widgets/v_empty_view.dart'; | @@ -17,7 +24,9 @@ import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 17 | import 'package:permission_handler/permission_handler.dart'; | 24 | import 'package:permission_handler/permission_handler.dart'; |
| 18 | import 'package:provider/provider.dart'; | 25 | import 'package:provider/provider.dart'; |
| 19 | 26 | ||
| 27 | +import '../../models/user_history_entity.dart'; | ||
| 20 | import '../../utils/screen_util.dart'; | 28 | import '../../utils/screen_util.dart'; |
| 29 | +import '../../widgets/MyDivider.dart'; | ||
| 21 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | 30 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; |
| 22 | 31 | ||
| 23 | /** | 32 | /** |
| @@ -149,7 +158,9 @@ class _EditReserverPageState extends State<EditReserverPage> { | @@ -149,7 +158,9 @@ class _EditReserverPageState extends State<EditReserverPage> { | ||
| 149 | detailModel.nameController.text.endsWith(suffix)) { | 158 | detailModel.nameController.text.endsWith(suffix)) { |
| 150 | return; | 159 | return; |
| 151 | } | 160 | } |
| 152 | - detailModel.nameController.text = name + suffix; | 161 | + if (name != '') { |
| 162 | + detailModel.nameController.text = name + suffix; | ||
| 163 | + } | ||
| 153 | } | 164 | } |
| 154 | 165 | ||
| 155 | //姓名后缀 | 166 | //姓名后缀 |
| @@ -201,6 +212,27 @@ class _EditReserverPageState extends State<EditReserverPage> { | @@ -201,6 +212,27 @@ class _EditReserverPageState extends State<EditReserverPage> { | ||
| 201 | ); | 212 | ); |
| 202 | } | 213 | } |
| 203 | 214 | ||
| 215 | + _getCallLog() async { | ||
| 216 | + Iterable<CallLogEntry> result = await CallLog.query(); | ||
| 217 | + detailModel.userHistorys = []; | ||
| 218 | + | ||
| 219 | + List<CallLogEntry> object = Utils.removeDuplicates(result.toList()); | ||
| 220 | + | ||
| 221 | + print(object); | ||
| 222 | + object.forEach((element) { | ||
| 223 | + UserHistoryEntity userHistoryEntity = | ||
| 224 | + UserHistoryEntity(null, null, '', '', '', '', '', null); | ||
| 225 | + userHistoryEntity.rname = element.name ?? ''; | ||
| 226 | + userHistoryEntity.phone = element.number ?? ''; | ||
| 227 | + detailModel.userHistorys.add(userHistoryEntity); | ||
| 228 | + }); | ||
| 229 | + if (object.length > 0) { | ||
| 230 | + //有记录 | ||
| 231 | + showPhoneHistory = true; | ||
| 232 | + setState(() {}); | ||
| 233 | + } | ||
| 234 | + } | ||
| 235 | + | ||
| 204 | @override | 236 | @override |
| 205 | Widget build(BuildContext context) { | 237 | Widget build(BuildContext context) { |
| 206 | detailModel = Provider.of<NotebookDetailModel>(context, listen: true); | 238 | detailModel = Provider.of<NotebookDetailModel>(context, listen: true); |
| @@ -415,15 +447,34 @@ class _EditReserverPageState extends State<EditReserverPage> { | @@ -415,15 +447,34 @@ class _EditReserverPageState extends State<EditReserverPage> { | ||
| 415 | decimal: true), | 447 | decimal: true), |
| 416 | )), | 448 | )), |
| 417 | ), | 449 | ), |
| 450 | + // InkWell( | ||
| 451 | + // onTap: () { | ||
| 452 | + // _openAddressBook(); | ||
| 453 | + // }, | ||
| 454 | + // child: Container( | ||
| 455 | + // width: ScreenUtil().setWidth(84) * 3, | ||
| 456 | + // height: ScreenUtil().setWidth(48), | ||
| 457 | + // alignment: Alignment.centerRight, | ||
| 458 | + // child: Text('电话簿', | ||
| 459 | + // style: TextStyle( | ||
| 460 | + // color: MyColours.color_199095, | ||
| 461 | + // fontSize: ScreenUtil().setSp(28), | ||
| 462 | + // decoration: | ||
| 463 | + // TextDecoration.underline)), | ||
| 464 | + // ), | ||
| 465 | + // ), | ||
| 418 | InkWell( | 466 | InkWell( |
| 419 | - onTap: () { | 467 | + onTap: () async { |
| 420 | _openAddressBook(); | 468 | _openAddressBook(); |
| 469 | + // var result = await CallLogUtil.getCallLog(); | ||
| 470 | + // print(result); | ||
| 421 | }, | 471 | }, |
| 422 | child: Container( | 472 | child: Container( |
| 423 | - width: ScreenUtil().setWidth(84) * 3, | 473 | + // color: Colors.red, |
| 474 | + width: ScreenUtil().setWidth(64) * 2, | ||
| 424 | height: ScreenUtil().setWidth(48), | 475 | height: ScreenUtil().setWidth(48), |
| 425 | alignment: Alignment.centerRight, | 476 | alignment: Alignment.centerRight, |
| 426 | - child: Text('一键录入', | 477 | + child: Text('电话簿', |
| 427 | style: TextStyle( | 478 | style: TextStyle( |
| 428 | color: MyColours.color_199095, | 479 | color: MyColours.color_199095, |
| 429 | fontSize: ScreenUtil().setSp(28), | 480 | fontSize: ScreenUtil().setSp(28), |
| @@ -431,6 +482,33 @@ class _EditReserverPageState extends State<EditReserverPage> { | @@ -431,6 +482,33 @@ class _EditReserverPageState extends State<EditReserverPage> { | ||
| 431 | TextDecoration.underline)), | 482 | TextDecoration.underline)), |
| 432 | ), | 483 | ), |
| 433 | ), | 484 | ), |
| 485 | + | ||
| 486 | + if (Platform.isAndroid) | ||
| 487 | + Row( | ||
| 488 | + children: [ | ||
| 489 | + HEmptyView(20), | ||
| 490 | + MyDivider(1.0, ScreenUtil().setWidth(40)), | ||
| 491 | + HEmptyView(20), | ||
| 492 | + InkWell( | ||
| 493 | + onTap: () async { | ||
| 494 | + _getCallLog(); | ||
| 495 | + }, | ||
| 496 | + child: Container( | ||
| 497 | + // color: Colors.red, | ||
| 498 | + // width: ScreenUtil().setWidth(64) * 2, | ||
| 499 | + height: ScreenUtil().setWidth(48), | ||
| 500 | + alignment: Alignment.centerLeft, | ||
| 501 | + child: Text('通话记录', | ||
| 502 | + style: TextStyle( | ||
| 503 | + color: MyColours.color_199095, | ||
| 504 | + fontSize: | ||
| 505 | + ScreenUtil().setSp(28), | ||
| 506 | + decoration: | ||
| 507 | + TextDecoration.underline)), | ||
| 508 | + ), | ||
| 509 | + ), | ||
| 510 | + ], | ||
| 511 | + ) | ||
| 434 | ], | 512 | ], |
| 435 | ), | 513 | ), |
| 436 | ], | 514 | ], |
| @@ -652,23 +730,31 @@ class _EditReserverPageState extends State<EditReserverPage> { | @@ -652,23 +730,31 @@ class _EditReserverPageState extends State<EditReserverPage> { | ||
| 652 | onTap: () { | 730 | onTap: () { |
| 653 | setState(() { | 731 | setState(() { |
| 654 | showPhoneHistory = false; | 732 | showPhoneHistory = false; |
| 655 | - detailModel.phoneController | ||
| 656 | - .text = detailModel | 733 | + UserHistoryEntity |
| 734 | + userHistoryEntity = | ||
| 735 | + detailModel | ||
| 657 | .userHistorys[ | 736 | .userHistorys[ |
| 658 | - index] | ||
| 659 | - .phone != | ||
| 660 | - null | ||
| 661 | - ? detailModel | ||
| 662 | - .userHistorys[index] | ||
| 663 | - .phone | ||
| 664 | - : ''; | 737 | + index]; |
| 738 | + if (userHistoryEntity.sex == | ||
| 739 | + null || | ||
| 740 | + userHistoryEntity.sex == | ||
| 741 | + '') { | ||
| 742 | + userHistoryEntity.sex = | ||
| 743 | + '1'; | ||
| 744 | + } | ||
| 745 | + detailModel.phoneController | ||
| 746 | + .text = | ||
| 747 | + userHistoryEntity | ||
| 748 | + .phone != | ||
| 749 | + null | ||
| 750 | + ? userHistoryEntity | ||
| 751 | + .phone | ||
| 752 | + : ''; | ||
| 665 | for (var item in detailModel | 753 | for (var item in detailModel |
| 666 | .sexList) { | 754 | .sexList) { |
| 667 | item['select'] = false; | 755 | item['select'] = false; |
| 668 | if (item['title'] == | 756 | if (item['title'] == |
| 669 | - detailModel | ||
| 670 | - .userHistorys[ | ||
| 671 | - index] | 757 | + userHistoryEntity |
| 672 | .sexStr) { | 758 | .sexStr) { |
| 673 | item['select'] = true; | 759 | item['select'] = true; |
| 674 | } | 760 | } |
| @@ -678,13 +764,10 @@ class _EditReserverPageState extends State<EditReserverPage> { | @@ -678,13 +764,10 @@ class _EditReserverPageState extends State<EditReserverPage> { | ||
| 678 | // .userHistorys[index].rname + | 764 | // .userHistorys[index].rname + |
| 679 | // _nameSuffix(); | 765 | // _nameSuffix(); |
| 680 | _addNameSuffix( | 766 | _addNameSuffix( |
| 681 | - detailModel | ||
| 682 | - .userHistorys[index] | ||
| 683 | - .rname, | 767 | + userHistoryEntity.rname, |
| 684 | _nameSuffix()); | 768 | _nameSuffix()); |
| 685 | - nameStr = detailModel | ||
| 686 | - .userHistorys[index] | ||
| 687 | - .rname; | 769 | + nameStr = |
| 770 | + userHistoryEntity.rname; | ||
| 688 | _phoneNode.unfocus(); | 771 | _phoneNode.unfocus(); |
| 689 | detailModel.userHistorys | 772 | detailModel.userHistorys |
| 690 | .clear(); | 773 | .clear(); |
| @@ -526,7 +526,7 @@ | @@ -526,7 +526,7 @@ | ||
| 526 | // height: ScreenUtil().setWidth(48), | 526 | // height: ScreenUtil().setWidth(48), |
| 527 | // alignment: Alignment.center, | 527 | // alignment: Alignment.center, |
| 528 | // child: Text( | 528 | // child: Text( |
| 529 | -// '一键录入', | 529 | +// '电话簿', |
| 530 | // style: TextStyle( | 530 | // style: TextStyle( |
| 531 | // color: MyColours.color_353535, | 531 | // color: MyColours.color_353535, |
| 532 | // fontSize: ScreenUtil().setSp(34)), | 532 | // fontSize: ScreenUtil().setSp(34)), |
| 1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
| 2 | +import 'dart:io'; | ||
| 2 | import 'dart:ui'; | 3 | import 'dart:ui'; |
| 3 | 4 | ||
| 5 | +import 'package:call_log/call_log.dart'; | ||
| 4 | import 'package:common_utils/common_utils.dart'; | 6 | import 'package:common_utils/common_utils.dart'; |
| 5 | 7 | ||
| 6 | // import 'package:contacts_service/contacts_service.dart'; | 8 | // import 'package:contacts_service/contacts_service.dart'; |
| @@ -35,6 +37,7 @@ import 'package:provider/provider.dart'; | @@ -35,6 +37,7 @@ import 'package:provider/provider.dart'; | ||
| 35 | import 'package:one_key/models/table_list.dart' as t; | 37 | import 'package:one_key/models/table_list.dart' as t; |
| 36 | import 'dart:convert' as convert; | 38 | import 'dart:convert' as convert; |
| 37 | import 'package:easy_contact_picker/easy_contact_picker.dart'; | 39 | import 'package:easy_contact_picker/easy_contact_picker.dart'; |
| 40 | +import '../../models/user_history_entity.dart'; | ||
| 38 | import '../../utils/screen_util.dart'; | 41 | import '../../utils/screen_util.dart'; |
| 39 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | 42 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; |
| 40 | 43 | ||
| @@ -528,7 +531,9 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -528,7 +531,9 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 528 | _notebookDetailChangeModel.nameController.text.endsWith(suffix)) { | 531 | _notebookDetailChangeModel.nameController.text.endsWith(suffix)) { |
| 529 | return; | 532 | return; |
| 530 | } | 533 | } |
| 531 | - _notebookDetailChangeModel.nameController.text = name + suffix; | 534 | + if (name != '') { |
| 535 | + _notebookDetailChangeModel.nameController.text = name + suffix; | ||
| 536 | + } | ||
| 532 | } | 537 | } |
| 533 | /** | 538 | /** |
| 534 | _bottomWidget() { | 539 | _bottomWidget() { |
| @@ -557,7 +562,7 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -557,7 +562,7 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 557 | height: ScreenUtil().setWidth(48), | 562 | height: ScreenUtil().setWidth(48), |
| 558 | alignment: Alignment.center, | 563 | alignment: Alignment.center, |
| 559 | child: Text( | 564 | child: Text( |
| 560 | - '一键录入', | 565 | + '电话簿', |
| 561 | style: TextStyle( | 566 | style: TextStyle( |
| 562 | color: MyColours.color_353535, | 567 | color: MyColours.color_353535, |
| 563 | fontSize: ScreenUtil().setSp(34)), | 568 | fontSize: ScreenUtil().setSp(34)), |
| @@ -1048,6 +1053,27 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -1048,6 +1053,27 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 1048 | ); | 1053 | ); |
| 1049 | } | 1054 | } |
| 1050 | 1055 | ||
| 1056 | + _getCallLog() async { | ||
| 1057 | + Iterable<CallLogEntry> result = await CallLog.query(); | ||
| 1058 | + _notebookDetailChangeModel.userHistorys = []; | ||
| 1059 | + | ||
| 1060 | + List<CallLogEntry> object = Utils.removeDuplicates(result.toList()); | ||
| 1061 | + | ||
| 1062 | + print(object); | ||
| 1063 | + object.forEach((element) { | ||
| 1064 | + UserHistoryEntity userHistoryEntity = | ||
| 1065 | + UserHistoryEntity(null, null, '', '', '', '', '', null); | ||
| 1066 | + userHistoryEntity.rname = element.name ?? ''; | ||
| 1067 | + userHistoryEntity.phone = element.number ?? ''; | ||
| 1068 | + _notebookDetailChangeModel.userHistorys.add(userHistoryEntity); | ||
| 1069 | + }); | ||
| 1070 | + if (object.length > 0) { | ||
| 1071 | + //有记录 | ||
| 1072 | + showPhoneHistory = true; | ||
| 1073 | + setState(() {}); | ||
| 1074 | + } | ||
| 1075 | + } | ||
| 1076 | + | ||
| 1051 | _openAddressBook() async { | 1077 | _openAddressBook() async { |
| 1052 | if (!(await checkContactPermission())) { | 1078 | if (!(await checkContactPermission())) { |
| 1053 | PermissionStatus permissionStatus = await contactPermissionStatus(); | 1079 | PermissionStatus permissionStatus = await contactPermissionStatus(); |
| @@ -1737,14 +1763,17 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -1737,14 +1763,17 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 1737 | )), | 1763 | )), |
| 1738 | ), | 1764 | ), |
| 1739 | InkWell( | 1765 | InkWell( |
| 1740 | - onTap: () { | 1766 | + onTap: () async { |
| 1741 | _openAddressBook(); | 1767 | _openAddressBook(); |
| 1768 | + // var result = await CallLogUtil.getCallLog(); | ||
| 1769 | + // print(result); | ||
| 1742 | }, | 1770 | }, |
| 1743 | child: Container( | 1771 | child: Container( |
| 1744 | - width: ScreenUtil().setWidth(84) * 3, | 1772 | + // color: Colors.red, |
| 1773 | + width: ScreenUtil().setWidth(64) * 2, | ||
| 1745 | height: ScreenUtil().setWidth(48), | 1774 | height: ScreenUtil().setWidth(48), |
| 1746 | alignment: Alignment.centerRight, | 1775 | alignment: Alignment.centerRight, |
| 1747 | - child: Text('一键录入', | 1776 | + child: Text('电话簿', |
| 1748 | style: TextStyle( | 1777 | style: TextStyle( |
| 1749 | color: MyColours.color_199095, | 1778 | color: MyColours.color_199095, |
| 1750 | fontSize: | 1779 | fontSize: |
| @@ -1753,6 +1782,34 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -1753,6 +1782,34 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 1753 | TextDecoration.underline)), | 1782 | TextDecoration.underline)), |
| 1754 | ), | 1783 | ), |
| 1755 | ), | 1784 | ), |
| 1785 | + if (Platform.isAndroid) | ||
| 1786 | + Row( | ||
| 1787 | + children: [ | ||
| 1788 | + HEmptyView(20), | ||
| 1789 | + MyDivider( | ||
| 1790 | + 1.0, ScreenUtil().setWidth(40)), | ||
| 1791 | + HEmptyView(20), | ||
| 1792 | + InkWell( | ||
| 1793 | + onTap: () async { | ||
| 1794 | + _getCallLog(); | ||
| 1795 | + }, | ||
| 1796 | + child: Container( | ||
| 1797 | + // color: Colors.red, | ||
| 1798 | + // width: ScreenUtil().setWidth(64) * 2, | ||
| 1799 | + height: ScreenUtil().setWidth(48), | ||
| 1800 | + alignment: Alignment.centerLeft, | ||
| 1801 | + child: Text('通话记录', | ||
| 1802 | + style: TextStyle( | ||
| 1803 | + color: MyColours | ||
| 1804 | + .color_199095, | ||
| 1805 | + fontSize: ScreenUtil() | ||
| 1806 | + .setSp(28), | ||
| 1807 | + decoration: TextDecoration | ||
| 1808 | + .underline)), | ||
| 1809 | + ), | ||
| 1810 | + ), | ||
| 1811 | + ], | ||
| 1812 | + ) | ||
| 1756 | ], | 1813 | ], |
| 1757 | ), | 1814 | ), |
| 1758 | ], | 1815 | ], |
| @@ -1912,11 +1969,19 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -1912,11 +1969,19 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 1912 | onTap: () { | 1969 | onTap: () { |
| 1913 | setState(() { | 1970 | setState(() { |
| 1914 | showPhoneHistory = false; | 1971 | showPhoneHistory = false; |
| 1972 | + UserHistoryEntity | ||
| 1973 | + userHistoryEntity = | ||
| 1974 | + _notebookDetailChangeModel | ||
| 1975 | + .userHistorys[index]; | ||
| 1915 | _notebookDetailChangeModel | 1976 | _notebookDetailChangeModel |
| 1916 | .phoneController.text = | 1977 | .phoneController.text = |
| 1917 | - _notebookDetailChangeModel | ||
| 1918 | - .userHistorys[index] | ||
| 1919 | - .phone; | 1978 | + userHistoryEntity.phone; |
| 1979 | + if (userHistoryEntity.sex == | ||
| 1980 | + null || | ||
| 1981 | + userHistoryEntity.sex == | ||
| 1982 | + '') { | ||
| 1983 | + userHistoryEntity.sex = '1'; | ||
| 1984 | + } | ||
| 1920 | // _homeEnterModel.nameController.text = | 1985 | // _homeEnterModel.nameController.text = |
| 1921 | // _homeEnterModel | 1986 | // _homeEnterModel |
| 1922 | // .userHistorys[index].rname + | 1987 | // .userHistorys[index].rname + |
| @@ -1926,21 +1991,38 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -1926,21 +1991,38 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 1926 | .sexList) { | 1991 | .sexList) { |
| 1927 | item['select'] = false; | 1992 | item['select'] = false; |
| 1928 | if (item['title'] == | 1993 | if (item['title'] == |
| 1929 | - _notebookDetailChangeModel | ||
| 1930 | - .userHistorys[index] | 1994 | + userHistoryEntity |
| 1931 | .sexStr) { | 1995 | .sexStr) { |
| 1932 | item['select'] = true; | 1996 | item['select'] = true; |
| 1933 | } | 1997 | } |
| 1934 | } | 1998 | } |
| 1935 | _addNameSuffix( | 1999 | _addNameSuffix( |
| 1936 | - _notebookDetailChangeModel | ||
| 1937 | - .userHistorys[index] | ||
| 1938 | - .rname, | 2000 | + userHistoryEntity.rname, |
| 1939 | _nameSuffix()); | 2001 | _nameSuffix()); |
| 1940 | - nameStr = | ||
| 1941 | - _notebookDetailChangeModel | ||
| 1942 | - .userHistorys[index] | ||
| 1943 | - .rname; | 2002 | + if (userHistoryEntity.rname == |
| 2003 | + null || | ||
| 2004 | + userHistoryEntity.rname == | ||
| 2005 | + '') { | ||
| 2006 | + nameStr = | ||
| 2007 | + _notebookDetailChangeModel | ||
| 2008 | + .nameController.text; | ||
| 2009 | + if (nameStr.endsWith('女士')) { | ||
| 2010 | + nameStr = nameStr | ||
| 2011 | + .replaceAll('女士', ''); | ||
| 2012 | + } | ||
| 2013 | + if (nameStr.endsWith('先生')) { | ||
| 2014 | + nameStr = nameStr | ||
| 2015 | + .replaceAll('先生', ''); | ||
| 2016 | + } | ||
| 2017 | + if (nameStr.endsWith('公司')) { | ||
| 2018 | + nameStr = nameStr | ||
| 2019 | + .replaceAll('公司', ''); | ||
| 2020 | + } | ||
| 2021 | + } else { | ||
| 2022 | + nameStr = | ||
| 2023 | + userHistoryEntity.rname; | ||
| 2024 | + } | ||
| 2025 | + | ||
| 1944 | _phoneNode.unfocus(); | 2026 | _phoneNode.unfocus(); |
| 1945 | _notebookDetailChangeModel | 2027 | _notebookDetailChangeModel |
| 1946 | .userHistorys | 2028 | .userHistorys |
| @@ -2104,7 +2186,7 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -2104,7 +2186,7 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 2104 | : await _notebookDetailChangeModel | 2186 | : await _notebookDetailChangeModel |
| 2105 | .setReserveInfo(context, nameStr, | 2187 | .setReserveInfo(context, nameStr, |
| 2106 | widget.detailEntity.uid); | 2188 | widget.detailEntity.uid); |
| 2107 | - if (_model!= null) { | 2189 | + if (_model != null) { |
| 2108 | if (ObjectUtil.isNotEmpty(_model.row) || | 2190 | if (ObjectUtil.isNotEmpty(_model.row) || |
| 2109 | ObjectUtil.isNotEmpty(_model.row.id)) { | 2191 | ObjectUtil.isNotEmpty(_model.row.id)) { |
| 2110 | print('成功'); | 2192 | print('成功'); |
| @@ -2646,15 +2646,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -2646,15 +2646,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 2646 | )), | 2646 | )), |
| 2647 | ), | 2647 | ), |
| 2648 | InkWell( | 2648 | InkWell( |
| 2649 | - onTap: () { | 2649 | + onTap: |
| 2650 | + () async { | ||
| 2650 | _openAddressBook(); | 2651 | _openAddressBook(); |
| 2652 | + // var result = await CallLogUtil.getCallLog(); | ||
| 2653 | + // print(result); | ||
| 2651 | }, | 2654 | }, |
| 2652 | child: | 2655 | child: |
| 2653 | Container( | 2656 | Container( |
| 2657 | + // color: Colors.red, | ||
| 2654 | width: ScreenUtil() | 2658 | width: ScreenUtil() |
| 2655 | .setWidth( | 2659 | .setWidth( |
| 2656 | - 84) * | ||
| 2657 | - 3, | 2660 | + 64) * |
| 2661 | + 2, | ||
| 2658 | height: ScreenUtil() | 2662 | height: ScreenUtil() |
| 2659 | .setWidth( | 2663 | .setWidth( |
| 2660 | 48), | 2664 | 48), |
| @@ -2662,7 +2666,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -2662,7 +2666,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 2662 | Alignment | 2666 | Alignment |
| 2663 | .centerRight, | 2667 | .centerRight, |
| 2664 | child: Text( | 2668 | child: Text( |
| 2665 | - '一键录入', | 2669 | + '电话簿', |
| 2666 | style: TextStyle( | 2670 | style: TextStyle( |
| 2667 | color: MyColours | 2671 | color: MyColours |
| 2668 | .color_199095, | 2672 | .color_199095, |
| @@ -2672,6 +2676,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -2672,6 +2676,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 2672 | TextDecoration.underline)), | 2676 | TextDecoration.underline)), |
| 2673 | ), | 2677 | ), |
| 2674 | ), | 2678 | ), |
| 2679 | + if (Platform | ||
| 2680 | + .isAndroid) | ||
| 2681 | + Row(children: [ | ||
| 2682 | + HEmptyView( | ||
| 2683 | + 20), | ||
| 2684 | + MyDivider( | ||
| 2685 | + 1.0, | ||
| 2686 | + ScreenUtil() | ||
| 2687 | + .setWidth( | ||
| 2688 | + 40)), | ||
| 2689 | + HEmptyView( | ||
| 2690 | + 20), | ||
| 2691 | + InkWell( | ||
| 2692 | + onTap: | ||
| 2693 | + () async { | ||
| 2694 | + // _getCallLog(); | ||
| 2695 | + }, | ||
| 2696 | + child: | ||
| 2697 | + Container( | ||
| 2698 | + // color: Colors.red, | ||
| 2699 | + // width: ScreenUtil().setWidth(64) * 2, | ||
| 2700 | + height: ScreenUtil() | ||
| 2701 | + .setWidth( | ||
| 2702 | + 48), | ||
| 2703 | + alignment: | ||
| 2704 | + Alignment | ||
| 2705 | + .centerLeft, | ||
| 2706 | + child: Text( | ||
| 2707 | + '通话记录', | ||
| 2708 | + style: TextStyle( | ||
| 2709 | + color: MyColours.color_199095, | ||
| 2710 | + fontSize: ScreenUtil().setSp(28), | ||
| 2711 | + decoration: TextDecoration.underline)), | ||
| 2712 | + ), | ||
| 2713 | + ), | ||
| 2714 | + ]), | ||
| 2675 | ], | 2715 | ], |
| 2676 | ), | 2716 | ), |
| 2677 | ], | 2717 | ], |
| @@ -2777,7 +2817,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -2777,7 +2817,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 2777 | '', | 2817 | '', |
| 2778 | needBtn: | 2818 | needBtn: |
| 2779 | false, | 2819 | false, |
| 2780 | - mid:widget.mid); | 2820 | + mid: widget |
| 2821 | + .mid); | ||
| 2781 | } | 2822 | } |
| 2782 | }, | 2823 | }, |
| 2783 | )) | 2824 | )) |
| @@ -378,7 +378,7 @@ class _HomeEnterPageState extends State<HomeEnterPage> | @@ -378,7 +378,7 @@ class _HomeEnterPageState extends State<HomeEnterPage> | ||
| 378 | height: ScreenUtil().setWidth(48), | 378 | height: ScreenUtil().setWidth(48), |
| 379 | alignment: Alignment.center, | 379 | alignment: Alignment.center, |
| 380 | child: Text( | 380 | child: Text( |
| 381 | - '一键录入', | 381 | + '电话簿', |
| 382 | style: TextStyle( | 382 | style: TextStyle( |
| 383 | color: MyColours.color_199095, | 383 | color: MyColours.color_199095, |
| 384 | fontSize: ScreenUtil().setSp(30)), | 384 | fontSize: ScreenUtil().setSp(30)), |
| @@ -5,6 +5,7 @@ import 'dart:typed_data'; | @@ -5,6 +5,7 @@ import 'dart:typed_data'; | ||
| 5 | import 'dart:ui'; | 5 | import 'dart:ui'; |
| 6 | 6 | ||
| 7 | import 'package:cached_network_image/cached_network_image.dart'; | 7 | import 'package:cached_network_image/cached_network_image.dart'; |
| 8 | +import 'package:call_log/call_log.dart'; | ||
| 8 | import 'package:common_utils/common_utils.dart'; | 9 | import 'package:common_utils/common_utils.dart'; |
| 9 | import 'package:easy_contact_picker/easy_contact_picker.dart'; | 10 | import 'package:easy_contact_picker/easy_contact_picker.dart'; |
| 10 | import 'package:flutter/material.dart'; | 11 | import 'package:flutter/material.dart'; |
| @@ -48,6 +49,7 @@ import 'dart:ui' as ui; | @@ -48,6 +49,7 @@ import 'dart:ui' as ui; | ||
| 48 | import '../../app.dart'; | 49 | import '../../app.dart'; |
| 49 | 50 | ||
| 50 | import '../../models/sms_info.dart'; | 51 | import '../../models/sms_info.dart'; |
| 52 | +import '../../models/user_history_entity.dart'; | ||
| 51 | import '../../provider/SmsModel.dart'; | 53 | import '../../provider/SmsModel.dart'; |
| 52 | import '../../provider/customer_provider.dart'; | 54 | import '../../provider/customer_provider.dart'; |
| 53 | import '../../provider/marketing_center_provider.dart'; | 55 | import '../../provider/marketing_center_provider.dart'; |
| @@ -584,7 +586,13 @@ class InvicationPageState extends State<InvicationPage> | @@ -584,7 +586,13 @@ class InvicationPageState extends State<InvicationPage> | ||
| 584 | // _homeEnterModel | 586 | // _homeEnterModel |
| 585 | // .userHistorys[index].rname + | 587 | // .userHistorys[index].rname + |
| 586 | // _nameSuffix(); | 588 | // _nameSuffix(); |
| 587 | - _addNameSuffix(_baseIndoProvider.userHistorys[index].rname, sexStr); | 589 | + |
| 590 | + if (_baseIndoProvider.userHistorys[index].rname != null && | ||
| 591 | + _baseIndoProvider.userHistorys[index].rname.trim().length > 0) { | ||
| 592 | + _addNameSuffix( | ||
| 593 | + _baseIndoProvider.userHistorys[index].rname, sexStr); | ||
| 594 | + } | ||
| 595 | + | ||
| 588 | nameStr = _baseIndoProvider.userHistorys[index].rname; | 596 | nameStr = _baseIndoProvider.userHistorys[index].rname; |
| 589 | _phoneNode.unfocus(); | 597 | _phoneNode.unfocus(); |
| 590 | _baseIndoProvider.userHistorys.clear(); | 598 | _baseIndoProvider.userHistorys.clear(); |
| @@ -1041,6 +1049,21 @@ class InvicationPageState extends State<InvicationPage> | @@ -1041,6 +1049,21 @@ class InvicationPageState extends State<InvicationPage> | ||
| 1041 | customController.text.trim().length == 0) { | 1049 | customController.text.trim().length == 0) { |
| 1042 | return; | 1050 | return; |
| 1043 | } | 1051 | } |
| 1052 | + if ((nameStr == null || nameStr.trim().length == 0) && | ||
| 1053 | + _baseIndoProvider.phoneController.text.replaceAll(' ', '').length > 0 && | ||
| 1054 | + oldName == null) { | ||
| 1055 | + Utils.showToast('请输入顾客姓名!'); | ||
| 1056 | + | ||
| 1057 | + return; | ||
| 1058 | + } | ||
| 1059 | + if ((nameStr != null && nameStr.trim().length > 0) && | ||
| 1060 | + _baseIndoProvider.phoneController.text.replaceAll(' ', '').length == | ||
| 1061 | + 0 && | ||
| 1062 | + oldPhone == null) { | ||
| 1063 | + Utils.showToast('请输入顾客电话!'); | ||
| 1064 | + | ||
| 1065 | + return; | ||
| 1066 | + } | ||
| 1044 | String phone; | 1067 | String phone; |
| 1045 | String name; | 1068 | String name; |
| 1046 | String sex; | 1069 | String sex; |
| @@ -2109,20 +2132,47 @@ class InvicationPageState extends State<InvicationPage> | @@ -2109,20 +2132,47 @@ class InvicationPageState extends State<InvicationPage> | ||
| 2109 | TextInputType.numberWithOptions(decimal: true), | 2132 | TextInputType.numberWithOptions(decimal: true), |
| 2110 | )), | 2133 | )), |
| 2111 | InkWell( | 2134 | InkWell( |
| 2112 | - onTap: () { | 2135 | + onTap: () async { |
| 2113 | _openAddressBook(); | 2136 | _openAddressBook(); |
| 2137 | + // var result = await CallLogUtil.getCallLog(); | ||
| 2138 | + // print(result); | ||
| 2114 | }, | 2139 | }, |
| 2115 | child: Container( | 2140 | child: Container( |
| 2116 | - width: ScreenUtil().setWidth(74) * 2, | 2141 | + // color: Colors.red, |
| 2142 | + width: ScreenUtil().setWidth(64) * 2, | ||
| 2117 | height: ScreenUtil().setWidth(48), | 2143 | height: ScreenUtil().setWidth(48), |
| 2118 | alignment: Alignment.centerRight, | 2144 | alignment: Alignment.centerRight, |
| 2119 | - child: Text('一键录入', | 2145 | + child: Text('电话簿', |
| 2120 | style: TextStyle( | 2146 | style: TextStyle( |
| 2121 | color: MyColours.color_515151, | 2147 | color: MyColours.color_515151, |
| 2122 | fontSize: ScreenUtil().setSp(28), | 2148 | fontSize: ScreenUtil().setSp(28), |
| 2123 | )), | 2149 | )), |
| 2124 | ), | 2150 | ), |
| 2125 | ), | 2151 | ), |
| 2152 | + if (Platform.isAndroid) | ||
| 2153 | + Row( | ||
| 2154 | + children: [ | ||
| 2155 | + HEmptyView(20), | ||
| 2156 | + MyDivider(1.0, ScreenUtil().setWidth(40)), | ||
| 2157 | + HEmptyView(20), | ||
| 2158 | + InkWell( | ||
| 2159 | + onTap: () async { | ||
| 2160 | + _getCallLog(); | ||
| 2161 | + }, | ||
| 2162 | + child: Container( | ||
| 2163 | + // color: Colors.red, | ||
| 2164 | + // width: ScreenUtil().setWidth(64) * 2, | ||
| 2165 | + height: ScreenUtil().setWidth(48), | ||
| 2166 | + alignment: Alignment.centerLeft, | ||
| 2167 | + child: Text('通话记录', | ||
| 2168 | + style: TextStyle( | ||
| 2169 | + color: MyColours.color_515151, | ||
| 2170 | + fontSize: ScreenUtil().setSp(28), | ||
| 2171 | + )), | ||
| 2172 | + ), | ||
| 2173 | + ), | ||
| 2174 | + ], | ||
| 2175 | + ) | ||
| 2126 | ], | 2176 | ], |
| 2127 | )), | 2177 | )), |
| 2128 | Stack( | 2178 | Stack( |
| @@ -2524,14 +2574,20 @@ class InvicationPageState extends State<InvicationPage> | @@ -2524,14 +2574,20 @@ class InvicationPageState extends State<InvicationPage> | ||
| 2524 | itemBuilder: (context, index) { | 2574 | itemBuilder: (context, index) { |
| 2525 | return GestureDetector( | 2575 | return GestureDetector( |
| 2526 | onTap: () { | 2576 | onTap: () { |
| 2527 | - sexStr = _baseIndoProvider | ||
| 2528 | - .userHistorys[index].sexStr; | 2577 | + UserHistoryEntity userHistoryEntity = |
| 2578 | + _baseIndoProvider | ||
| 2579 | + .userHistorys[index]; | ||
| 2580 | + if (userHistoryEntity.sex == null || | ||
| 2581 | + userHistoryEntity.sex == '') { | ||
| 2582 | + userHistoryEntity.sex = '1'; | ||
| 2583 | + } | ||
| 2584 | + sexStr = userHistoryEntity.sexStr; | ||
| 2529 | 2585 | ||
| 2530 | sexSelectIndex = | 2586 | sexSelectIndex = |
| 2531 | sexList.indexOf(sexStr); | 2587 | sexList.indexOf(sexStr); |
| 2532 | 2588 | ||
| 2533 | - _getIsMemberByPhone(_baseIndoProvider | ||
| 2534 | - .userHistorys[index].phone); | 2589 | + _getIsMemberByPhone( |
| 2590 | + userHistoryEntity.phone); | ||
| 2535 | needHistory = true; | 2591 | needHistory = true; |
| 2536 | _showConfirmWidget( | 2592 | _showConfirmWidget( |
| 2537 | needHistory: true, index: index); | 2593 | needHistory: true, index: index); |
| @@ -3560,7 +3616,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -3560,7 +3616,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 3560 | width: ScreenUtil().setWidth(84) * 3, | 3616 | width: ScreenUtil().setWidth(84) * 3, |
| 3561 | height: ScreenUtil().setWidth(48), | 3617 | height: ScreenUtil().setWidth(48), |
| 3562 | alignment: Alignment.centerRight, | 3618 | alignment: Alignment.centerRight, |
| 3563 | - child: Text('一键录入', | 3619 | + child: Text('电话簿', |
| 3564 | style: TextStyle( | 3620 | style: TextStyle( |
| 3565 | color: MyColours.color_199095, | 3621 | color: MyColours.color_199095, |
| 3566 | fontSize: ScreenUtil().setSp(28), | 3622 | fontSize: ScreenUtil().setSp(28), |
| @@ -3855,6 +3911,27 @@ class InvicationPageState extends State<InvicationPage> | @@ -3855,6 +3911,27 @@ class InvicationPageState extends State<InvicationPage> | ||
| 3855 | } | 3911 | } |
| 3856 | } | 3912 | } |
| 3857 | 3913 | ||
| 3914 | + _getCallLog() async { | ||
| 3915 | + Iterable<CallLogEntry> result = await CallLog.query(); | ||
| 3916 | + _baseIndoProvider.userHistorys = []; | ||
| 3917 | + | ||
| 3918 | + List<CallLogEntry> object = Utils.removeDuplicates(result.toList()); | ||
| 3919 | + | ||
| 3920 | + print(object); | ||
| 3921 | + object.forEach((element) { | ||
| 3922 | + UserHistoryEntity userHistoryEntity = | ||
| 3923 | + UserHistoryEntity(null, null, '', '', '', '', '', null); | ||
| 3924 | + userHistoryEntity.rname = element.name ?? ''; | ||
| 3925 | + userHistoryEntity.phone = element.number ?? ''; | ||
| 3926 | + _baseIndoProvider.userHistorys.add(userHistoryEntity); | ||
| 3927 | + }); | ||
| 3928 | + if (object.length > 0) { | ||
| 3929 | + //有记录 | ||
| 3930 | + showPhoneHistory = true; | ||
| 3931 | + setState(() {}); | ||
| 3932 | + } | ||
| 3933 | + } | ||
| 3934 | + | ||
| 3858 | _openAddressBook() async { | 3935 | _openAddressBook() async { |
| 3859 | if (!(await checkContactPermission())) { | 3936 | if (!(await checkContactPermission())) { |
| 3860 | PermissionStatus permissionStatus = await contactPermissionStatus(); | 3937 | PermissionStatus permissionStatus = await contactPermissionStatus(); |
| @@ -1663,7 +1663,7 @@ | @@ -1663,7 +1663,7 @@ | ||
| 1663 | // width: ScreenUtil().setWidth(84) * 3, | 1663 | // width: ScreenUtil().setWidth(84) * 3, |
| 1664 | // height: ScreenUtil().setWidth(48), | 1664 | // height: ScreenUtil().setWidth(48), |
| 1665 | // alignment: Alignment.centerRight, | 1665 | // alignment: Alignment.centerRight, |
| 1666 | -// child: Text('一键录入', | 1666 | +// child: Text('电话簿', |
| 1667 | // style: TextStyle( | 1667 | // style: TextStyle( |
| 1668 | // color: MyColours.color_199095, | 1668 | // color: MyColours.color_199095, |
| 1669 | // fontSize: ScreenUtil().setSp(28), | 1669 | // fontSize: ScreenUtil().setSp(28), |
| @@ -79,7 +79,9 @@ class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> { | @@ -79,7 +79,9 @@ class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> { | ||
| 79 | alignment: Alignment.centerRight, | 79 | alignment: Alignment.centerRight, |
| 80 | child: TextField( | 80 | child: TextField( |
| 81 | maxLines: 1, | 81 | maxLines: 1, |
| 82 | - keyboardType: TextInputType.numberWithOptions(decimal: true), //由于某些机型键盘并不能做到强制故再条件上加上FilteringTextInputFormatter.allow(RegExp('[0-9.,]+') | 82 | + keyboardType: TextInputType.numberWithOptions( |
| 83 | + decimal: | ||
| 84 | + true), //由于某些机型键盘并不能做到强制故再条件上加上FilteringTextInputFormatter.allow(RegExp('[0-9.,]+') | ||
| 83 | inputFormatters: title == '出库数量' | 85 | inputFormatters: title == '出库数量' |
| 84 | ? [ | 86 | ? [ |
| 85 | PrecisionLimitFormatter(2), | 87 | PrecisionLimitFormatter(2), |
| @@ -167,7 +169,7 @@ class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> { | @@ -167,7 +169,7 @@ class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> { | ||
| 167 | // width: ScreenUtil().setWidth(74) * 2, | 169 | // width: ScreenUtil().setWidth(74) * 2, |
| 168 | // height: ScreenUtil().setWidth(48), | 170 | // height: ScreenUtil().setWidth(48), |
| 169 | // alignment: Alignment.centerRight, | 171 | // alignment: Alignment.centerRight, |
| 170 | - // child: Text('一键录入', | 172 | + // child: Text('电话簿', |
| 171 | // style: TextStyle( | 173 | // style: TextStyle( |
| 172 | // color: MyColours.color_515151, | 174 | // color: MyColours.color_515151, |
| 173 | // fontSize: ScreenUtil().setSp(28), | 175 | // fontSize: ScreenUtil().setSp(28), |
| @@ -232,7 +232,7 @@ class _CreateStoreWinePageState extends State<CreateStoreWinePage> { | @@ -232,7 +232,7 @@ class _CreateStoreWinePageState extends State<CreateStoreWinePage> { | ||
| 232 | // width: ScreenUtil().setWidth(74) * 2, | 232 | // width: ScreenUtil().setWidth(74) * 2, |
| 233 | // height: ScreenUtil().setWidth(48), | 233 | // height: ScreenUtil().setWidth(48), |
| 234 | // alignment: Alignment.centerRight, | 234 | // alignment: Alignment.centerRight, |
| 235 | - // child: Text('一键录入', | 235 | + // child: Text('电话簿', |
| 236 | // style: TextStyle( | 236 | // style: TextStyle( |
| 237 | // color: MyColours.color_515151, | 237 | // color: MyColours.color_515151, |
| 238 | // fontSize: ScreenUtil().setSp(28), | 238 | // fontSize: ScreenUtil().setSp(28), |
| @@ -126,7 +126,7 @@ class _CreateWineItemPageState extends State<CreateWineItemPage> { | @@ -126,7 +126,7 @@ class _CreateWineItemPageState extends State<CreateWineItemPage> { | ||
| 126 | // width: ScreenUtil().setWidth(74) * 2, | 126 | // width: ScreenUtil().setWidth(74) * 2, |
| 127 | // height: ScreenUtil().setWidth(48), | 127 | // height: ScreenUtil().setWidth(48), |
| 128 | // alignment: Alignment.centerRight, | 128 | // alignment: Alignment.centerRight, |
| 129 | - // child: Text('一键录入', | 129 | + // child: Text('电话簿', |
| 130 | // style: TextStyle( | 130 | // style: TextStyle( |
| 131 | // color: MyColours.color_515151, | 131 | // color: MyColours.color_515151, |
| 132 | // fontSize: ScreenUtil().setSp(28), | 132 | // fontSize: ScreenUtil().setSp(28), |
| 1 | import 'dart:async'; | 1 | import 'dart:async'; |
| 2 | import 'dart:convert'; | 2 | import 'dart:convert'; |
| 3 | +import 'dart:io'; | ||
| 3 | 4 | ||
| 5 | +import 'package:call_log/call_log.dart'; | ||
| 4 | import 'package:common_utils/common_utils.dart'; | 6 | import 'package:common_utils/common_utils.dart'; |
| 5 | import 'package:dotted_border/dotted_border.dart'; | 7 | import 'package:dotted_border/dotted_border.dart'; |
| 6 | import 'package:easy_contact_picker/easy_contact_picker.dart'; | 8 | import 'package:easy_contact_picker/easy_contact_picker.dart'; |
| @@ -14,6 +16,7 @@ import 'package:one_key/models/guest_info_model.dart'; | @@ -14,6 +16,7 @@ import 'package:one_key/models/guest_info_model.dart'; | ||
| 14 | 16 | ||
| 15 | import 'package:one_key/models/reserve_info_model.dart'; | 17 | import 'package:one_key/models/reserve_info_model.dart'; |
| 16 | import 'package:one_key/models/sms_info.dart'; | 18 | import 'package:one_key/models/sms_info.dart'; |
| 19 | +import 'package:one_key/models/user_history_entity.dart'; | ||
| 17 | 20 | ||
| 18 | import 'package:one_key/pages/table/area_item_table.dart'; | 21 | import 'package:one_key/pages/table/area_item_table.dart'; |
| 19 | import 'package:one_key/provider/base_info_provider.dart'; | 22 | import 'package:one_key/provider/base_info_provider.dart'; |
| @@ -26,7 +29,7 @@ import 'package:one_key/res/colors.dart'; | @@ -26,7 +29,7 @@ import 'package:one_key/res/colors.dart'; | ||
| 26 | import 'package:one_key/utils/dialog_util.dart'; | 29 | import 'package:one_key/utils/dialog_util.dart'; |
| 27 | import 'package:one_key/utils/event_bus.dart'; | 30 | import 'package:one_key/utils/event_bus.dart'; |
| 28 | import 'package:one_key/route/navigator_util.dart'; | 31 | import 'package:one_key/route/navigator_util.dart'; |
| 29 | -import 'package:one_key/utils/get_call_log.dart'; | 32 | + |
| 30 | import 'package:one_key/utils/misc.dart'; | 33 | import 'package:one_key/utils/misc.dart'; |
| 31 | import 'package:one_key/utils/utils.dart'; | 34 | import 'package:one_key/utils/utils.dart'; |
| 32 | import 'package:one_key/widgets/MyDivider.dart'; | 35 | import 'package:one_key/widgets/MyDivider.dart'; |
| @@ -656,6 +659,27 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -656,6 +659,27 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 656 | } | 659 | } |
| 657 | } | 660 | } |
| 658 | 661 | ||
| 662 | + _getCallLog() async { | ||
| 663 | + Iterable<CallLogEntry> result = await CallLog.query(); | ||
| 664 | + _baseIndoProvider.userHistorys = []; | ||
| 665 | + | ||
| 666 | + List<CallLogEntry> object = Utils.removeDuplicates(result.toList()); | ||
| 667 | + | ||
| 668 | + print(object); | ||
| 669 | + object.forEach((element) { | ||
| 670 | + UserHistoryEntity userHistoryEntity = | ||
| 671 | + UserHistoryEntity(null, null, '', '', '', '', '', null); | ||
| 672 | + userHistoryEntity.rname = element.name ?? ''; | ||
| 673 | + userHistoryEntity.phone = element.number ?? ''; | ||
| 674 | + _baseIndoProvider.userHistorys.add(userHistoryEntity); | ||
| 675 | + }); | ||
| 676 | + if (object.length > 0) { | ||
| 677 | + //有记录 | ||
| 678 | + showPhoneHistory = true; | ||
| 679 | + setState(() {}); | ||
| 680 | + } | ||
| 681 | + } | ||
| 682 | + | ||
| 659 | _getContactData() async { | 683 | _getContactData() async { |
| 660 | Contact contact = await _contactPicker.selectContactWithNative(); | 684 | Contact contact = await _contactPicker.selectContactWithNative(); |
| 661 | 685 | ||
| @@ -680,10 +704,12 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -680,10 +704,12 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 680 | 704 | ||
| 681 | _addNameSuffix(String name, String suffix) { | 705 | _addNameSuffix(String name, String suffix) { |
| 682 | if (name == _baseIndoProvider.nameController.text && | 706 | if (name == _baseIndoProvider.nameController.text && |
| 683 | - _baseIndoProvider.nameController.text.endsWith(suffix)) { | 707 | + _baseIndoProvider.nameController.text.endsWith(suffix ?? '')) { |
| 684 | return; | 708 | return; |
| 685 | } | 709 | } |
| 686 | - _baseIndoProvider.nameController.text = name + suffix; | 710 | + if (name != '') { |
| 711 | + _baseIndoProvider.nameController.text = name + suffix ?? ''; | ||
| 712 | + } | ||
| 687 | } | 713 | } |
| 688 | 714 | ||
| 689 | //姓名后缀 | 715 | //姓名后缀 |
| @@ -924,16 +950,41 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -924,16 +950,41 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 924 | // print(result); | 950 | // print(result); |
| 925 | }, | 951 | }, |
| 926 | child: Container( | 952 | child: Container( |
| 927 | - width: ScreenUtil().setWidth(74) * 2, | 953 | + // color: Colors.red, |
| 954 | + width: ScreenUtil().setWidth(64) * 2, | ||
| 928 | height: ScreenUtil().setWidth(48), | 955 | height: ScreenUtil().setWidth(48), |
| 929 | alignment: Alignment.centerRight, | 956 | alignment: Alignment.centerRight, |
| 930 | - child: Text('一键录入', | 957 | + child: Text('电话簿', |
| 931 | style: TextStyle( | 958 | style: TextStyle( |
| 932 | color: MyColours.color_515151, | 959 | color: MyColours.color_515151, |
| 933 | fontSize: ScreenUtil().setSp(28), | 960 | fontSize: ScreenUtil().setSp(28), |
| 934 | )), | 961 | )), |
| 935 | ), | 962 | ), |
| 936 | ), | 963 | ), |
| 964 | + if (Platform.isAndroid) | ||
| 965 | + Row( | ||
| 966 | + children: [ | ||
| 967 | + HEmptyView(20), | ||
| 968 | + MyDivider(1.0, ScreenUtil().setWidth(40)), | ||
| 969 | + HEmptyView(20), | ||
| 970 | + InkWell( | ||
| 971 | + onTap: () async { | ||
| 972 | + _getCallLog(); | ||
| 973 | + }, | ||
| 974 | + child: Container( | ||
| 975 | + // color: Colors.red, | ||
| 976 | + // width: ScreenUtil().setWidth(64) * 2, | ||
| 977 | + height: ScreenUtil().setWidth(48), | ||
| 978 | + alignment: Alignment.centerLeft, | ||
| 979 | + child: Text('通话记录', | ||
| 980 | + style: TextStyle( | ||
| 981 | + color: MyColours.color_515151, | ||
| 982 | + fontSize: ScreenUtil().setSp(28), | ||
| 983 | + )), | ||
| 984 | + ), | ||
| 985 | + ), | ||
| 986 | + ], | ||
| 987 | + ) | ||
| 937 | ], | 988 | ], |
| 938 | )), | 989 | )), |
| 939 | Stack( | 990 | Stack( |
| @@ -1310,6 +1361,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -1310,6 +1361,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 1310 | return GestureDetector( | 1361 | return GestureDetector( |
| 1311 | onTap: () { | 1362 | onTap: () { |
| 1312 | setState(() { | 1363 | setState(() { |
| 1364 | + sexStr = '先生'; | ||
| 1313 | showPhoneHistory = false; | 1365 | showPhoneHistory = false; |
| 1314 | _baseIndoProvider.phoneController | 1366 | _baseIndoProvider.phoneController |
| 1315 | .text = _baseIndoProvider | 1367 | .text = _baseIndoProvider |
| @@ -1345,8 +1397,34 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -1345,8 +1397,34 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 1345 | .userHistorys[index] | 1397 | .userHistorys[index] |
| 1346 | .rname, | 1398 | .rname, |
| 1347 | sexStr); | 1399 | sexStr); |
| 1348 | - nameStr = _baseIndoProvider | ||
| 1349 | - .userHistorys[index].rname; | 1400 | + if (_baseIndoProvider |
| 1401 | + .userHistorys[index] | ||
| 1402 | + .rname == | ||
| 1403 | + null || | ||
| 1404 | + _baseIndoProvider | ||
| 1405 | + .userHistorys[index] | ||
| 1406 | + .rname == | ||
| 1407 | + '') { | ||
| 1408 | + nameStr = _baseIndoProvider | ||
| 1409 | + .nameController.text; | ||
| 1410 | + | ||
| 1411 | + if (nameStr.endsWith('女士')) { | ||
| 1412 | + nameStr = nameStr.replaceAll( | ||
| 1413 | + '女士', ''); | ||
| 1414 | + } | ||
| 1415 | + if (nameStr.endsWith('先生')) { | ||
| 1416 | + nameStr = nameStr.replaceAll( | ||
| 1417 | + '先生', ''); | ||
| 1418 | + } | ||
| 1419 | + if (nameStr.endsWith('公司')) { | ||
| 1420 | + nameStr = nameStr.replaceAll( | ||
| 1421 | + '公司', ''); | ||
| 1422 | + } | ||
| 1423 | + } else { | ||
| 1424 | + nameStr = _baseIndoProvider | ||
| 1425 | + .userHistorys[index].rname; | ||
| 1426 | + } | ||
| 1427 | + | ||
| 1350 | _phoneNode.unfocus(); | 1428 | _phoneNode.unfocus(); |
| 1351 | _baseIndoProvider.userHistorys | 1429 | _baseIndoProvider.userHistorys |
| 1352 | .clear(); | 1430 | .clear(); |
lib/utils/get_call_log.dart
deleted
100644 → 0
| @@ -56,6 +56,7 @@ Future<PermissionStatus> contactPermissionStatus() async { | @@ -56,6 +56,7 @@ Future<PermissionStatus> contactPermissionStatus() async { | ||
| 56 | return permissionStatus; | 56 | return permissionStatus; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | + | ||
| 59 | Future<bool> requestContactPermission() async { | 60 | Future<bool> requestContactPermission() async { |
| 60 | final permissions = await [Permission.contacts].request(); | 61 | final permissions = await [Permission.contacts].request(); |
| 61 | if (permissions[Permission.contacts] == PermissionStatus.granted) { | 62 | if (permissions[Permission.contacts] == PermissionStatus.granted) { |
| @@ -3,6 +3,7 @@ import 'dart:io'; | @@ -3,6 +3,7 @@ import 'dart:io'; | ||
| 3 | import 'dart:math'; | 3 | import 'dart:math'; |
| 4 | import 'dart:typed_data'; | 4 | import 'dart:typed_data'; |
| 5 | 5 | ||
| 6 | +import 'package:call_log/call_log.dart'; | ||
| 6 | import 'package:common_utils/common_utils.dart'; | 7 | import 'package:common_utils/common_utils.dart'; |
| 7 | import 'package:connectivity/connectivity.dart'; | 8 | import 'package:connectivity/connectivity.dart'; |
| 8 | import 'package:contacts_service/contacts_service.dart'; | 9 | import 'package:contacts_service/contacts_service.dart'; |
| @@ -50,6 +51,17 @@ import '../models/recharge_list_model.dart'; | @@ -50,6 +51,17 @@ import '../models/recharge_list_model.dart'; | ||
| 50 | typedef BookTimeSetCallback = void Function(bool needChange); | 51 | typedef BookTimeSetCallback = void Function(bool needChange); |
| 51 | 52 | ||
| 52 | class Utils { | 53 | class Utils { |
| 54 | + static List<CallLogEntry> removeDuplicates(List<CallLogEntry> items) { | ||
| 55 | + List<CallLogEntry> uniqueItems = []; // uniqueList | ||
| 56 | + var uniqueIDs = items | ||
| 57 | + .map((e) => e.number) | ||
| 58 | + .toSet(); //list if UniqueID to remove duplicates | ||
| 59 | + uniqueIDs.forEach((e) { | ||
| 60 | + uniqueItems.add(items.firstWhere((i) => i.number == e)); | ||
| 61 | + }); // populate uniqueItems with equivalent original Batch items | ||
| 62 | + return uniqueItems; //send back the unique items list | ||
| 63 | + } | ||
| 64 | + | ||
| 53 | /// 十六进制颜色 | 65 | /// 十六进制颜色 |
| 54 | /// colorString,字符串,例如:'0x000000' '0xff000000' '#000000' '#000000', | 66 | /// colorString,字符串,例如:'0x000000' '0xff000000' '#000000' '#000000', |
| 55 | /// alpha,透明度[0.0, 1.0] | 67 | /// alpha,透明度[0.0, 1.0] |
-
Please register or login to post a comment