Commit caaa04b618b3ff9bf8dd4c0a14a97f94ae19c9aa

Authored by wdn127929
1 parent f491a2de

防抖

@@ -26,6 +26,7 @@ import 'package:provider/provider.dart'; @@ -26,6 +26,7 @@ import 'package:provider/provider.dart';
26 26
27 import '../../models/user_history_entity.dart'; 27 import '../../models/user_history_entity.dart';
28 import '../../utils/call_log_utils.dart'; 28 import '../../utils/call_log_utils.dart';
  29 +import '../../utils/common_utils.dart';
29 import '../../utils/screen_util.dart'; 30 import '../../utils/screen_util.dart';
30 import '../../widgets/MyDivider.dart'; 31 import '../../widgets/MyDivider.dart';
31 import '../../widgets/special_text/my_extended_text_selection_controls.dart'; 32 import '../../widgets/special_text/my_extended_text_selection_controls.dart';
@@ -419,8 +420,10 @@ class _EditReserverPageState extends State<EditReserverPage> { @@ -419,8 +420,10 @@ class _EditReserverPageState extends State<EditReserverPage> {
419 .user 420 .user
420 .sellerid, 421 .sellerid,
421 }; 422 };
422 - detailModel.getUserHistorys(  
423 - context, params); 423 + JhCommonUtils.debounce(() =>
  424 + detailModel.getUserHistorys(
  425 + context, params));
  426 +
424 }, 427 },
425 onEditingComplete: () { 428 onEditingComplete: () {
426 print('fff'); 429 print('fff');
@@ -525,8 +528,9 @@ class _EditReserverPageState extends State<EditReserverPage> { @@ -525,8 +528,9 @@ class _EditReserverPageState extends State<EditReserverPage> {
525 .user 528 .user
526 .sellerid, 529 .sellerid,
527 }; 530 };
528 - detailModel.getUserHistorys(  
529 - context, params); 531 + JhCommonUtils.debounce(() =>
  532 + detailModel.getUserHistorys(
  533 + context, params));
530 }, 534 },
531 onEditingComplete: () { 535 onEditingComplete: () {
532 _phoneNode.unfocus(); 536 _phoneNode.unfocus();
@@ -39,6 +39,7 @@ import 'dart:convert' as convert; @@ -39,6 +39,7 @@ import 'dart:convert' as convert;
39 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'; 40 import '../../models/user_history_entity.dart';
41 import '../../utils/call_log_utils.dart'; 41 import '../../utils/call_log_utils.dart';
  42 +import '../../utils/common_utils.dart';
42 import '../../utils/screen_util.dart'; 43 import '../../utils/screen_util.dart';
43 import '../../widgets/special_text/my_extended_text_selection_controls.dart'; 44 import '../../widgets/special_text/my_extended_text_selection_controls.dart';
44 import 'package:flutter_picker/flutter_picker.dart' as Picker; 45 import 'package:flutter_picker/flutter_picker.dart' as Picker;
@@ -1744,9 +1745,10 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { @@ -1744,9 +1745,10 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> {
1744 .user 1745 .user
1745 .sellerid, 1746 .sellerid,
1746 }; 1747 };
1747 - _notebookDetailChangeModel  
1748 - .getUserHistorys(  
1749 - context, params); 1748 + JhCommonUtils.debounce(() =>
  1749 + _notebookDetailChangeModel
  1750 + .getUserHistorys(
  1751 + context, params));
1750 }, 1752 },
1751 onTap: () { 1753 onTap: () {
1752 setState(() { 1754 setState(() {
@@ -1875,9 +1877,12 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { @@ -1875,9 +1877,12 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> {
1875 .user 1877 .user
1876 .sellerid, 1878 .sellerid,
1877 }; 1879 };
1878 - _notebookDetailChangeModel  
1879 - .getUserHistorys(  
1880 - context, params); 1880 +
  1881 +
  1882 + JhCommonUtils.debounce(() =>
  1883 + _notebookDetailChangeModel
  1884 + .getUserHistorys(
  1885 + context, params));
1881 }, 1886 },
1882 onEditingComplete: () { 1887 onEditingComplete: () {
1883 _phoneNode.unfocus(); 1888 _phoneNode.unfocus();
@@ -58,6 +58,7 @@ import '../../provider/customer_provider.dart'; @@ -58,6 +58,7 @@ import '../../provider/customer_provider.dart';
58 import '../../provider/marketing_center_provider.dart'; 58 import '../../provider/marketing_center_provider.dart';
59 import '../../provider/my_model.dart'; 59 import '../../provider/my_model.dart';
60 import '../../utils/call_log_utils.dart'; 60 import '../../utils/call_log_utils.dart';
  61 +import '../../utils/common_utils.dart';
61 import '../../utils/screen_util.dart'; 62 import '../../utils/screen_util.dart';
62 import '../../widgets/special_text/my_extended_text_selection_controls.dart'; 63 import '../../widgets/special_text/my_extended_text_selection_controls.dart';
63 import 'package:flutter_picker/flutter_picker.dart' as Picker; 64 import 'package:flutter_picker/flutter_picker.dart' as Picker;
@@ -1793,6 +1794,15 @@ class InvicationPageState extends State<InvicationPage> @@ -1793,6 +1794,15 @@ class InvicationPageState extends State<InvicationPage>
1793 } 1794 }
1794 } 1795 }
1795 1796
  1797 + _searchMethod(value) {
  1798 + Map<String, String> params = {
  1799 + "keywords": value.trim(),
  1800 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  1801 + };
  1802 + _baseIndoProvider.getUserHistorys(context, params);
  1803 + _getIsMemberByPhone(value);
  1804 + }
  1805 +
1796 _customerInfoWidget() { 1806 _customerInfoWidget() {
1797 return Container( 1807 return Container(
1798 child: Column( 1808 child: Column(
@@ -2123,14 +2133,8 @@ class InvicationPageState extends State<InvicationPage> @@ -2123,14 +2133,8 @@ class InvicationPageState extends State<InvicationPage>
2123 showErroInfo = false; 2133 showErroInfo = false;
2124 setState(() {}); 2134 setState(() {});
2125 } 2135 }
2126 - Map<String, String> params = {  
2127 - "keywords": value.trim(),  
2128 - "sid": Provider.of<UserModel>(context, listen: false)  
2129 - .user  
2130 - .sellerid,  
2131 - };  
2132 - _baseIndoProvider.getUserHistorys(context, params);  
2133 - _getIsMemberByPhone(value); 2136 +
  2137 + JhCommonUtils.debounce(() => _searchMethod(value));
2134 }, 2138 },
2135 onEditingComplete: () { 2139 onEditingComplete: () {
2136 _phoneNode.unfocus(); 2140 _phoneNode.unfocus();
@@ -2258,8 +2262,9 @@ class InvicationPageState extends State<InvicationPage> @@ -2258,8 +2262,9 @@ class InvicationPageState extends State<InvicationPage>
2258 .user 2262 .user
2259 .sellerid, 2263 .sellerid,
2260 }; 2264 };
2261 - _baseIndoProvider.getUserHistorys(  
2262 - context, params); 2265 +
  2266 + JhCommonUtils.debounce(() => _baseIndoProvider
  2267 + .getUserHistorys(context, params));
2263 }, 2268 },
2264 onTap: () { 2269 onTap: () {
2265 setState(() { 2270 setState(() {
@@ -27,6 +27,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; @@ -27,6 +27,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
27 import 'package:provider/provider.dart'; 27 import 'package:provider/provider.dart';
28 28
29 import '../../../../provider/collect_store_provider.dart'; 29 import '../../../../provider/collect_store_provider.dart';
  30 +import '../../../../utils/common_utils.dart';
30 import '../../../../utils/dialog_util.dart'; 31 import '../../../../utils/dialog_util.dart';
31 import '../../../../utils/screen_util.dart'; 32 import '../../../../utils/screen_util.dart';
32 33
@@ -502,7 +503,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -502,7 +503,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
502 // customerProvider.searchData(value); 503 // customerProvider.searchData(value);
503 page = 1; 504 page = 1;
504 customerProvider.pageDataMy = []; 505 customerProvider.pageDataMy = [];
505 - _getContantData(showLoading: false); 506 + JhCommonUtils.debounce(
  507 + () => _getContantData(showLoading: false));
506 }, 508 },
507 onEditingComplete: () { 509 onEditingComplete: () {
508 FocusScope.of(context) 510 FocusScope.of(context)
@@ -29,6 +29,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; @@ -29,6 +29,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
29 import 'package:provider/provider.dart'; 29 import 'package:provider/provider.dart';
30 30
31 import '../../../../provider/collect_store_provider.dart'; 31 import '../../../../provider/collect_store_provider.dart';
  32 +import '../../../../utils/common_utils.dart';
32 import '../../../../utils/dialog_util.dart'; 33 import '../../../../utils/dialog_util.dart';
33 import '../../../../utils/screen_util.dart'; 34 import '../../../../utils/screen_util.dart';
34 35
@@ -609,7 +610,9 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -609,7 +610,9 @@ class _CustomerListPageState extends State<CustomerListPage>
609 // customerProvider.searchData(value); 610 // customerProvider.searchData(value);
610 page = 1; 611 page = 1;
611 customerProvider.pageData = []; 612 customerProvider.pageData = [];
612 - _getContantData(showLoading: false); 613 +
  614 + JhCommonUtils.debounce(
  615 + () => _getContantData(showLoading: false));
613 }, 616 },
614 onEditingComplete: () { 617 onEditingComplete: () {
615 FocusScope.of(context) 618 FocusScope.of(context)
@@ -18,6 +18,7 @@ import '../../../provider/store_wine_provider.dart'; @@ -18,6 +18,7 @@ import '../../../provider/store_wine_provider.dart';
18 import '../../../provider/user_model.dart'; 18 import '../../../provider/user_model.dart';
19 import '../../../res/colors.dart'; 19 import '../../../res/colors.dart';
20 import '../../../route/navigator_util.dart'; 20 import '../../../route/navigator_util.dart';
  21 +import '../../../utils/common_utils.dart';
21 import '../../../utils/dialog_util.dart'; 22 import '../../../utils/dialog_util.dart';
22 import '../../../utils/event_bus.dart'; 23 import '../../../utils/event_bus.dart';
23 import '../../../utils/utils.dart'; 24 import '../../../utils/utils.dart';
@@ -271,10 +272,12 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -271,10 +272,12 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
271 // customerProvider.searchData(value); 272 // customerProvider.searchData(value);
272 273
273 if (tabController.index == 0) { 274 if (tabController.index == 0) {
274 - _getStoreWineBySeller(context, showLoading: false); 275 + JhCommonUtils.debounce(() =>
  276 + _getStoreWineBySeller(context, showLoading: false));
275 } 277 }
276 if (tabController.index == 1) { 278 if (tabController.index == 1) {
277 - _getStoreWineCheckList(context, showLoading: false); 279 + JhCommonUtils.debounce(() =>
  280 + _getStoreWineCheckList(context, showLoading: false));
278 } 281 }
279 }, 282 },
280 onEditingComplete: () { 283 onEditingComplete: () {
@@ -846,7 +846,7 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -846,7 +846,7 @@ class TableManagerPageState extends State<TableManagerPage> {
846 _baseIndoProvider.nameController.text.endsWith(suffix ?? '')) { 846 _baseIndoProvider.nameController.text.endsWith(suffix ?? '')) {
847 return; 847 return;
848 } 848 }
849 - if (name != '') { 849 + if (name != '' && name != null) {
850 _baseIndoProvider.nameController.text = name + suffix ?? ''; 850 _baseIndoProvider.nameController.text = name + suffix ?? '';
851 } 851 }
852 } 852 }
@@ -1065,7 +1065,9 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -1065,7 +1065,9 @@ class TableManagerPageState extends State<TableManagerPage> {
1065 .user 1065 .user
1066 .sellerid, 1066 .sellerid,
1067 }; 1067 };
1068 - _baseIndoProvider.getUserHistorys(context, params); 1068 + JhCommonUtils.debounce(() =>
  1069 + _baseIndoProvider.getUserHistorys(context, params));
  1070 + // _baseIndoProvider.getUserHistorys(context, params);
1069 }, 1071 },
1070 onEditingComplete: () { 1072 onEditingComplete: () {
1071 _phoneNode.unfocus(); 1073 _phoneNode.unfocus();
@@ -1186,8 +1188,10 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -1186,8 +1188,10 @@ class TableManagerPageState extends State<TableManagerPage> {
1186 .user 1188 .user
1187 .sellerid, 1189 .sellerid,
1188 }; 1190 };
1189 - _baseIndoProvider.getUserHistorys(  
1190 - context, params); 1191 + // _baseIndoProvider.getUserHistorys(
  1192 + // context, params);
  1193 + JhCommonUtils.debounce(() => _baseIndoProvider
  1194 + .getUserHistorys(context, params));
1191 }, 1195 },
1192 onEditingComplete: () { 1196 onEditingComplete: () {
1193 print('fff'); 1197 print('fff');