diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae624cc..286117a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+## [3.1.5] Fix #71 (Assertion error during selectCellAt on second list)
## [3.1.4] Add dispose to SwipeActionController #70
## [3.1.3] Fix action width when screen rotating. 适配横竖屏切换
## [3.1.2]
diff --git a/README-CN.md b/README-CN.md
index 0c386f6..b911070 100644
--- a/README-CN.md
+++ b/README-CN.md
@@ -26,7 +26,7 @@ Alipay | Wechat |
#### pub 仓库点这里: [pub](https://pub.dev/packages/flutter_swipe_action_cell)
#### 安装:
```yaml
-flutter_swipe_action_cell: ^3.1.4
+flutter_swipe_action_cell: ^3.1.5
```
diff --git a/README.md b/README.md
index d1ef1b1..edbf143 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ Alipay | Wechat |
##### install:
```yaml
-flutter_swipe_action_cell: ^3.1.4
+flutter_swipe_action_cell: ^3.1.5
```
## 1.Preview:
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist
index 8d4492f..7c56964 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 9.0
+ 12.0
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index bd0f603..3388b12 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 50;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -127,7 +127,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 1300;
+ LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@@ -171,10 +171,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@@ -185,6 +187,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -272,7 +275,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -350,7 +353,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -399,7 +402,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index 3db53b6..e67b280 100644
--- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,6 +1,6 @@
CADisableMinimumFrameDurationOnPhone
+ UIApplicationSupportsIndirectInputEvents
+
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 2bca376..000c0ec 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -6,7 +6,7 @@ packages:
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "2.11.0"
boolean_selector:
@@ -14,7 +14,7 @@ packages:
description:
name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "2.1.1"
characters:
@@ -22,7 +22,7 @@ packages:
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "1.3.0"
clock:
@@ -30,31 +30,31 @@ packages:
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
- sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
- url: "https://pub.flutter-io.cn"
+ sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
+ url: "https://pub.dev"
source: hosted
- version: "1.17.1"
+ version: "1.18.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
- sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
- url: "https://pub.flutter-io.cn"
+ sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
+ url: "https://pub.dev"
source: hosted
- version: "1.0.5"
+ version: "1.0.8"
fake_async:
dependency: transitive
description:
name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "1.3.1"
flutter:
@@ -67,7 +67,7 @@ packages:
description:
name: flutter_lints
sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "1.0.4"
flutter_swipe_action_cell:
@@ -76,60 +76,76 @@ packages:
path: ".."
relative: true
source: path
- version: "3.1.1"
+ version: "3.1.4"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
- js:
+ leak_tracker:
dependency: transitive
description:
- name: js
- sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
- url: "https://pub.flutter-io.cn"
+ name: leak_tracker
+ sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
+ url: "https://pub.dev"
source: hosted
- version: "0.6.7"
+ version: "10.0.5"
+ leak_tracker_flutter_testing:
+ dependency: transitive
+ description:
+ name: leak_tracker_flutter_testing
+ sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.5"
+ leak_tracker_testing:
+ dependency: transitive
+ description:
+ name: leak_tracker_testing
+ sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.1"
lints:
dependency: transitive
description:
name: lints
sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
name: matcher
- sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
- url: "https://pub.flutter-io.cn"
+ sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
+ url: "https://pub.dev"
source: hosted
- version: "0.12.15"
+ version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
- sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
- url: "https://pub.flutter-io.cn"
+ sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
+ url: "https://pub.dev"
source: hosted
- version: "0.2.0"
+ version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
- sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
- url: "https://pub.flutter-io.cn"
+ sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
+ url: "https://pub.dev"
source: hosted
- version: "1.9.1"
+ version: "1.15.0"
path:
dependency: transitive
description:
name: path
- sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
- url: "https://pub.flutter-io.cn"
+ sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
+ url: "https://pub.dev"
source: hosted
- version: "1.8.3"
+ version: "1.9.0"
sky_engine:
dependency: transitive
description: flutter
@@ -139,32 +155,32 @@ packages:
dependency: transitive
description:
name: source_span
- sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
- url: "https://pub.flutter-io.cn"
+ sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
+ url: "https://pub.dev"
source: hosted
- version: "1.9.1"
+ version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
- sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
- url: "https://pub.flutter-io.cn"
+ sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
+ url: "https://pub.dev"
source: hosted
- version: "1.11.0"
+ version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
- sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
- url: "https://pub.flutter-io.cn"
+ sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
+ url: "https://pub.dev"
source: hosted
- version: "2.1.1"
+ version: "2.1.2"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "1.2.0"
term_glyph:
@@ -172,24 +188,33 @@ packages:
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
- sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
- url: "https://pub.flutter-io.cn"
+ sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
+ url: "https://pub.dev"
source: hosted
- version: "0.5.1"
+ version: "0.7.2"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
- url: "https://pub.flutter-io.cn"
+ url: "https://pub.dev"
source: hosted
version: "2.1.4"
+ vm_service:
+ dependency: transitive
+ description:
+ name: vm_service
+ sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
+ url: "https://pub.dev"
+ source: hosted
+ version: "14.2.5"
sdks:
- dart: ">=3.0.0-0 <4.0.0"
+ dart: ">=3.3.0 <4.0.0"
+ flutter: ">=3.18.0-18.0.pre.54"
diff --git a/lib/core/cell.dart b/lib/core/cell.dart
index 3670e86..381649c 100644
--- a/lib/core/cell.dart
+++ b/lib/core/cell.dart
@@ -303,6 +303,9 @@ class SwipeActionCellState extends State
.bus
.on()
.listen((event) {
+ if (event.controller != widget.controller) {
+ return;
+ }
assert(widget.controller != null && widget.index != null);
if (event.selected &&
diff --git a/lib/core/controller.dart b/lib/core/controller.dart
index 71c0cf6..829999d 100644
--- a/lib/core/controller.dart
+++ b/lib/core/controller.dart
@@ -130,7 +130,7 @@ class SwipeActionController {
});
selectedIndexPathsChangeCallback?.call(
indexPaths, true, selectedSet.length);
- SwipeActionStore.getInstance().bus.fire(CellSelectedEvent(selected: true));
+ SwipeActionStore.getInstance().bus.fire(CellSelectedEvent(selected: true, controller: this));
}
/// Deselect cells (You must pass [SwipeActionCell.index] attr to your [SwipeActionCell]
@@ -147,7 +147,7 @@ class SwipeActionController {
});
selectedIndexPathsChangeCallback?.call(
indexPaths, false, selectedSet.length);
- SwipeActionStore.getInstance().bus.fire(CellSelectedEvent(selected: false));
+ SwipeActionStore.getInstance().bus.fire(CellSelectedEvent(selected: false, controller: this));
}
/// select all cell
@@ -162,7 +162,7 @@ class SwipeActionController {
List selectedList = List.generate(dataLength, (index) => index);
selectedSet.addAll(selectedList);
selectedIndexPathsChangeCallback?.call(selectedList, true, dataLength);
- SwipeActionStore.getInstance().bus.fire(CellSelectedEvent(selected: true));
+ SwipeActionStore.getInstance().bus.fire(CellSelectedEvent(selected: true, controller: this));
}
/// deselect all cell
@@ -178,7 +178,7 @@ class SwipeActionController {
selectedSet.clear();
selectedIndexPathsChangeCallback?.call(
deselectedList, false, selectedSet.length);
- SwipeActionStore.getInstance().bus.fire(CellSelectedEvent(selected: false));
+ SwipeActionStore.getInstance().bus.fire(CellSelectedEvent(selected: false, controller: this));
}
void _fireEditEvent(
diff --git a/lib/core/events.dart b/lib/core/events.dart
index 500a82e..98b2095 100644
--- a/lib/core/events.dart
+++ b/lib/core/events.dart
@@ -55,7 +55,8 @@ class EditingModeEvent {
}
class CellSelectedEvent {
- CellSelectedEvent({required this.selected});
+ const CellSelectedEvent({required this.selected, required this.controller});
+ final SwipeActionController controller;
final bool selected;
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 8f3175f..8572714 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_swipe_action_cell
description: An awesome UI package incluing iOS style cell swipe action effect.You can use this package to implement iOS style tableView cell swipe action
-version: 3.1.4
+version: 3.1.5
homepage: https://github.com/luckysmg/flutter_swipe_action_cell
environment:
diff --git a/test/tests.dart b/test/tests.dart
index b9bbb7c..35dbe1f 100644
--- a/test/tests.dart
+++ b/test/tests.dart
@@ -50,7 +50,6 @@ void main() {
);
expect(find.text('leadingActions 1'), findsNothing);
-
controller.closeAllOpenCell();
await tester.pumpAndSettle();
@@ -112,4 +111,69 @@ void main() {
controller.dispose();
});
+
+ testWidgets('Select event should not conflict with each other.', (tester) async {
+ final SwipeActionController controller = SwipeActionController();
+
+ final List words = [
+ 'Apple',
+ 'Banana',
+ 'Cherry',
+ 'Date',
+ ];
+
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: Column(
+ children: [
+ Expanded(
+ child: ListView.builder(
+ itemCount: 3,
+ itemBuilder: (context, index) {
+ return SwipeActionCell(
+ key: ObjectKey(words[index]),
+ trailingActions: [
+ SwipeAction(
+ onTap: (handler) async {
+ await handler(false);
+ },
+ color: Colors.grey,
+ icon: const Icon(Icons.edit, color: Colors.white),
+ )
+ ],
+ child: ListTile(
+ title: Text("Test"),
+ ),
+ );
+ },
+ ),
+ ),
+ Expanded(
+ child: ListView.builder(
+ itemCount: words.length,
+ itemBuilder: (context, index) {
+ final word = words[index];
+ return SwipeActionCell(
+ key: ObjectKey(word),
+ index: index,
+ controller: controller,
+ child: ListTile(
+ title: Text(word),
+ onLongPress: () {
+ controller.startEditingMode();
+ controller.selectCellAt(indexPaths: [index]);
+ },
+ ),
+ );
+ },
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ await tester.longPress(find.text(words[0]));
+ });
}