diff --git a/CHANGELOG.md b/CHANGELOG.md index 6994fce..66797cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.0.1 +## 1.0.2 * Fixed blink issue diff --git a/example/lib/utils/item_tile.dart b/example/lib/utils/item_tile.dart index a7cea66..eae4e96 100644 --- a/example/lib/utils/item_tile.dart +++ b/example/lib/utils/item_tile.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -class ItemTile extends StatefulWidget { +class ItemTile extends StatelessWidget { final VoidCallback? onTap; final int index; final bool selected; @@ -12,39 +12,30 @@ class ItemTile extends StatefulWidget { this.selected = false, }); - @override - State createState() => _ItemTileState(); -} - -class _ItemTileState extends State { @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(2), - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: widget.onTap, - child: Column( - children: [ - Container( - height: 60, - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.primaries[widget.index % Colors.primaries.length], - ), - child: Center( - child: Text( - 'Item ${widget.index}', - style: const TextStyle(fontSize: 25), - ), + child: Column( + children: [ + Container( + height: 60, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.primaries[index % Colors.primaries.length], + ), + child: Center( + child: Text( + 'Item $index', + style: const TextStyle(fontSize: 25), ), ), - const SizedBox( - height: 5, - ) - ], - ), + ), + const SizedBox( + height: 5, + ) + ], ), ); } diff --git a/lib/src/builder/motion_animated_builder.dart b/lib/src/builder/motion_animated_builder.dart index c3b32c2..e6a4a8d 100644 --- a/lib/src/builder/motion_animated_builder.dart +++ b/lib/src/builder/motion_animated_builder.dart @@ -554,6 +554,8 @@ class MotionBuilderState extends State } void _onItemRemoved(int itemIndex, Duration removeDuration) { + childrenMap.update( + itemIndex + 1, (value) => value.copyWith(visible: false)); final updatedChildrenMap = {}; if (childrenMap.containsKey(itemIndex)) { for (final entry in childrenMap.entries) { diff --git a/pubspec.yaml b/pubspec.yaml index 1db1e04..2121815 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: animated_reorderable_list description: A Flutter Reorderable Animated List with simple implementation and smooth transition. -version: 1.0.1 +version: 1.0.2 repository: https://github.com/canopas/animated_reorderable_list environment: