Kaynağa Gözat

代码优化

gjh 3 gün önce
ebeveyn
işleme
131bf0d3e2
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6 1
      lib/pages/history/select_history_page.dart

+ 6 - 1
lib/pages/history/select_history_page.dart

@@ -270,13 +270,18 @@ class _SelectHistoryPageState extends ConsumerState<SelectHistoryPage> {
270
 
270
 
271
   ///点击
271
   ///点击
272
   void _onTap(BuildContext context, HistoryItemInfo info) {
272
   void _onTap(BuildContext context, HistoryItemInfo info) {
273
+    if(info.isSelected)
274
+    {
275
+      ref.read(historyListProvider.notifier).select(info, false);
276
+      return;
277
+    }
273
     if (widget.isMultiSelect) {
278
     if (widget.isMultiSelect) {
274
       if (widget.maxCount > 0 &&
279
       if (widget.maxCount > 0 &&
275
           ref.read(historySelectedCountProvider) >= widget.maxCount) {
280
           ref.read(historySelectedCountProvider) >= widget.maxCount) {
276
         showToast(text: getS().maxSelectCountXx(widget.maxCount));
281
         showToast(text: getS().maxSelectCountXx(widget.maxCount));
277
         return;
282
         return;
278
       }
283
       }
279
-      ref.read(historyListProvider.notifier).select(info, !info.isSelected);
284
+      ref.read(historyListProvider.notifier).select(info, true);
280
       return;
285
       return;
281
     }
286
     }
282
     _onSelected(context, [info]);
287
     _onSelected(context, [info]);