diff --git a/lib/http/api.dart b/lib/http/api.dart index e3c36457a..9b3086a0b 100644 --- a/lib/http/api.dart +++ b/lib/http/api.dart @@ -217,7 +217,7 @@ class Api { static const String delHistory = '/x/v2/history/delete'; // 搜索历史记录 - static const String searchHistory = '/x/web-goblin/history/search'; + static const String searchHistory = '/x/web-interface/history/search'; // 热搜 static const String hotSearchList = diff --git a/lib/pages/dynamics/view.dart b/lib/pages/dynamics/view.dart index 897a00db9..fe47c2f5a 100644 --- a/lib/pages/dynamics/view.dart +++ b/lib/pages/dynamics/view.dart @@ -244,6 +244,8 @@ class _CreatePanelState extends State { DateTime? _publishTime; ReplyOption _replyOption = ReplyOption.allow; + late final int _limit = 18; + @override void dispose() { _isEnableStream.close(); @@ -532,39 +534,44 @@ class _CreatePanelState extends State { parent: BouncingScrollPhysics(), ), padding: const EdgeInsets.symmetric(horizontal: 16), - itemCount: _pathList.length == 9 ? 9 : _pathList.length + 1, + itemCount: + _pathList.length == _limit ? _limit : _pathList.length + 1, itemBuilder: (context, index) { - if (_pathList.length != 9 && index == _pathList.length) { + if (_pathList.length != _limit && index == _pathList.length) { return Material( borderRadius: BorderRadius.circular(12), child: InkWell( borderRadius: BorderRadius.circular(12), - onTap: () async { - List pickedFiles = - await _imagePicker.pickMultiImage( - limit: 9, - imageQuality: 100, - ); - if (pickedFiles.isNotEmpty) { - for (int i = 0; i < pickedFiles.length; i++) { - if (_pathList.length == 9) { - SmartDialog.showToast('最多选择9张图片'); - if (i != 0) { - _pathStream.add(_pathList); - } - break; - } else { - _pathList.add(pickedFiles[i].path); - if (i == pickedFiles.length - 1) { - _pathStream.add(_pathList); + onTap: () { + EasyThrottle.throttle( + 'imagePicker', const Duration(milliseconds: 500), + () async { + List pickedFiles = + await _imagePicker.pickMultiImage( + limit: _limit, + imageQuality: 100, + ); + if (pickedFiles.isNotEmpty) { + for (int i = 0; i < pickedFiles.length; i++) { + if (_pathList.length == _limit) { + SmartDialog.showToast('最多选择$_limit张图片'); + if (i != 0) { + _pathStream.add(_pathList); + } + break; + } else { + _pathList.add(pickedFiles[i].path); + if (i == pickedFiles.length - 1) { + _pathStream.add(_pathList); + } } } + if (_pathList.isNotEmpty && !_isEnable) { + _isEnable = true; + _isEnableStream.add(true); + } } - if (_pathList.isNotEmpty && !_isEnable) { - _isEnable = true; - _isEnableStream.add(true); - } - } + }); }, child: Ink( width: 75, diff --git a/lib/pages/member/new/controller.dart b/lib/pages/member/new/controller.dart index 7b1e9be9b..a03e05290 100644 --- a/lib/pages/member/new/controller.dart +++ b/lib/pages/member/new/controller.dart @@ -56,7 +56,7 @@ class MemberControllerNew extends CommonController tabs = tab2!.map((item) => Tab(text: item.title ?? '')).toList(); tabController = TabController( vsync: this, - length: response.response.tab2.length, + length: tab2!.length, initialIndex: initialIndex == -1 ? 0 : initialIndex, ); } diff --git a/lib/pages/video/detail/introduction/widgets/action_item.dart b/lib/pages/video/detail/introduction/widgets/action_item.dart index be24af5fe..0407c9ebf 100644 --- a/lib/pages/video/detail/introduction/widgets/action_item.dart +++ b/lib/pages/video/detail/introduction/widgets/action_item.dart @@ -47,7 +47,7 @@ class ActionItemState extends State with TickerProviderStateMixin { _lastTime = DateTime.now().millisecondsSinceEpoch; if (!widget.hasOneThree) { controller?.forward(); - widget.callBack!(true); + widget.callBack?.call(true); } } @@ -55,11 +55,11 @@ class ActionItemState extends State with TickerProviderStateMixin { int duration = DateTime.now().millisecondsSinceEpoch - _lastTime; if (duration < 1500) { controller?.reverse(); - widget.callBack!(false); + widget.callBack?.call(false); } if (duration <= 50 && !isCancel) { feedBack(); - widget.onTap!(); + widget.onTap?.call(); } } @@ -80,7 +80,7 @@ class ActionItemState extends State with TickerProviderStateMixin { if (_hideCircle) { controller?.reset(); if (_isThumbUp) { - widget.onLongPress!(); + widget.onLongPress?.call(); } } }); @@ -108,14 +108,12 @@ class ActionItemState extends State with TickerProviderStateMixin { ? null : () { feedBack(); - widget.onTap!(); + widget.onTap?.call(); }, onLongPress: _isThumbUp ? null : () { - if (widget.onLongPress != null) { - widget.onLongPress!(); - } + widget.onLongPress?.call(); }, onTapDown: (details) => _isThumbUp ? _startLongPress() : null, onTapUp: (details) => _isThumbUp ? _cancelLongPress() : null, diff --git a/lib/pages/video/detail/reply_new/reply_page.dart b/lib/pages/video/detail/reply_new/reply_page.dart index c4b4b4120..e8841faee 100644 --- a/lib/pages/video/detail/reply_new/reply_page.dart +++ b/lib/pages/video/detail/reply_new/reply_page.dart @@ -6,6 +6,7 @@ import 'package:PiliPalaX/grpc/app/main/community/reply/v1/reply.pb.dart' as reply; import 'package:PiliPalaX/http/msg.dart'; import 'package:chat_bottom_container/chat_bottom_container.dart'; +import 'package:easy_debounce/easy_throttle.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; @@ -62,6 +63,7 @@ class _ReplyPageState extends State late final _imagePicker = ImagePicker(); late final _pathStream = StreamController>(); late final _pathList = []; + late final _limit = 9; @override void initState() { @@ -355,29 +357,33 @@ class _ReplyPageState extends State tooltip: '图片', selected: false, icon: const Icon(Icons.image, size: 22), - onPressed: () async { - List pickedFiles = - await _imagePicker.pickMultiImage( - limit: 9, - imageQuality: 100, - ); - if (pickedFiles.isNotEmpty) { - for (int i = 0; i < pickedFiles.length; i++) { - if (_pathList.length == 9) { - SmartDialog.showToast('最多选择9张图片'); - if (i != 0) { - _pathStream.add(_pathList); - } - break; - } else { - _pathList.add(pickedFiles[i].path); - if (i == pickedFiles.length - 1) { - SmartDialog.dismiss(); - _pathStream.add(_pathList); + onPressed: () { + EasyThrottle.throttle( + 'imagePicker', const Duration(milliseconds: 500), + () async { + List pickedFiles = + await _imagePicker.pickMultiImage( + limit: _limit, + imageQuality: 100, + ); + if (pickedFiles.isNotEmpty) { + for (int i = 0; i < pickedFiles.length; i++) { + if (_pathList.length == _limit) { + SmartDialog.showToast('最多选择$_limit张图片'); + if (i != 0) { + _pathStream.add(_pathList); + } + break; + } else { + _pathList.add(pickedFiles[i].path); + if (i == pickedFiles.length - 1) { + SmartDialog.dismiss(); + _pathStream.add(_pathList); + } } } } - } + }); }, ), ],