@@ -86,7 +86,6 @@ class _ContactsPageState extends State<ContactsPage> {
8686 // 监听事件
8787 void _handleSlideAnimationChanged (Animation <double > slideAnimation) {}
8888 void _handleSlideIsOpenChanged (bool isOpen) {
89- print ('handleSlideIsOpenChanged $isOpen ' );
9089 setState (() {
9190 _slideIsOpen = isOpen;
9291 });
@@ -121,16 +120,20 @@ class _ContactsPageState extends State<ContactsPage> {
121120 // 容错处理
122121 if (! _slideIsOpen) return ;
123122
124- final cxts = _slidableCxtMap.values.toList ();
125- final len = cxts.length;
126- for (var i = 0 ; i < len; i++ ) {
127- final value = cxts[i];
128- if (Slidable .of (value)? .renderingMode != SlidableRenderingMode .none) {
129- // 关掉上一个
130- Slidable .of (value)? .close ();
131- return ;
132- }
133- }
123+ // 方案三:
124+ _slidableController.activeState? .close ();
125+
126+ // 方案二:
127+ // final cxts = _slidableCxtMap.values.toList();
128+ // final len = cxts.length;
129+ // for (var i = 0; i < len; i++) {
130+ // final value = cxts[i];
131+ // if (Slidable.of(value)?.renderingMode != SlidableRenderingMode.none) {
132+ // // 关掉上一个
133+ // Slidable.of(value)?.close();
134+ // return;
135+ // }
136+ // }
134137 }
135138
136139 /// 构建头部
@@ -235,12 +238,16 @@ class _ContactsPageState extends State<ContactsPage> {
235238 // 细节:这里由于 SlideActionType.primary 对应 actions 为空,所以虽然看似展开空,目的就是关闭 上一个打开的 secondary action
236239 // Slidable.of(cxt)?.open(actionType: SlideActionType.primary);
237240 // 上面的虽然打开了一个空的 但是系统还是会认为是 打开的 也就是 _slideIsOpen = true
238- // 手动设置为true
241+ // 手动设置为false
239242 // _slideIsOpen = false;
240243
241244 // 方案二: 每次生成一个 cell ,就用 Map[key] = cxt 记录起来,特别注意,这里用Map 而不是 List or Set
242245 // 关闭上一个侧滑
243246 _closeSlidable ();
247+
248+ // 方案三: 直接拿这个activaState 注:已经封装到了 _closeSlidable
249+ // _slidableController.activeState?.close();
250+
244251 // 下钻
245252 NavigatorUtils .push (cxt,
246253 '${ContactsRouter .contactInfoPage }?idstr=${user .idstr }' );
@@ -355,8 +362,12 @@ class _ContactsPageState extends State<ContactsPage> {
355362 dragDismissible: true ,
356363 child: SlidableDrawerDismissal (),
357364 onWillDismiss: (actionType) {
365+ print ('🔥🔥🔥 $title ' );
358366 return false ;
359367 },
368+ onDismissed: (_) {
369+ print ('🔥🔥🔥 xx $title ' );
370+ },
360371 ),
361372 actionPane: SlidableScrollActionPane (),
362373 actionExtentRatio: 0.2 ,
@@ -499,7 +510,7 @@ class _ContactsPageState extends State<ContactsPage> {
499510 data: tagList,
500511 tag: _suspensionTag,
501512 hintOffsetX: - 80 ,
502- ignoreTags: [],
513+ ignoreTags: ['♀' ],
503514 // selectedTagColor: Colors.red,
504515 mapTag: {
505516 "♀" : new SvgPicture .asset (
0 commit comments