From 16bce5b7f7f6944668b13d7547ce6e9adabb4e9b Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Wed, 9 Oct 2024 23:17:52 +0800 Subject: [PATCH] opt: pic btn --- lib/pages/dynamics/view.dart | 70 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/lib/pages/dynamics/view.dart b/lib/pages/dynamics/view.dart index 7b963e87..bf25c7a9 100644 --- a/lib/pages/dynamics/view.dart +++ b/lib/pages/dynamics/view.dart @@ -536,43 +536,45 @@ class _CreatePanelState extends State { itemBuilder: (context, index) { if (_pathList.length != 9 && index == _pathList.length) { return Material( - child: Ink( - width: 75, - height: 75, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).colorScheme.secondaryContainer, - ), - child: InkWell( - 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); - } + 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); } } - if (_pathList.isNotEmpty && !_isEnable) { - _isEnable = true; - _isEnableStream.add(true); - } } - }, - borderRadius: BorderRadius.circular(12), - child: const Center(child: Icon(Icons.add)), + if (_pathList.isNotEmpty && !_isEnable) { + _isEnable = true; + _isEnableStream.add(true); + } + } + }, + child: Ink( + width: 75, + height: 75, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: + Theme.of(context).colorScheme.secondaryContainer, + ), + child: Center(child: Icon(Icons.add)), ), ), );