diff --git a/README.md b/README.md index 65f979e..4f0d185 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ drag-and-drop functionality in Flutter. ### Reorderable List -| ![Image 1](https://github.com/user-attachments/assets/c4628033-a40c-4e27-be21-204d0d33c54f?raw=true) | ![Image 2](https://github.com/user-attachments/assets/beca0910-5729-45c8-849b-d413b540c924?raw=true) | ![Image 3](https://github.com/user-attachments/assets/ba74961c-38bd-4dcb-8357-fb4584294c3c?raw=true) | +| ![Image 1](https://github.com/user-attachments/assets/f68812ad-5106-4154-9e9a-7a09e7d23015?raw=true) | ![Image 2](https://github.com/user-attachments/assets/e954b616-1820-4004-9c0e-23b002a6b36f?raw=true) | ![Image 3](https://github.com/user-attachments/assets/9b5c695b-7874-4ea3-86b0-1b00b2bf8d65?raw=true) | | :---: | :---: | :---: | | ReorderableGridView | ReorderableListView | Swap Animation | @@ -251,23 +251,24 @@ If a custom `insertItemBuilder` is provided, it will override the `enterTransiti The library provides a set of pre-built animations that can be used for item insertion and removal. You can use multiple animations at the same time by providing a list of animations. - The following animations are available: | Animation Type | ListView Example | GridView Example | |------------------|-------------------------------|-------------------------------| -| **FadeIn** | | | -| **FlipInY** | | | -| **FlipInX** | | | -| **Landing** | | | -| **ScaleIn** | | | -| **ScaleInTop** | | | -| **ScaleInBottom**| | | -| **ScaleInLeft** | | | -| **ScaleInRight** | | | -| **Size** | | | -| **SlideInDown** | | | -| **SlideInUp** | | | +| **FadeIn** | | | +| **FlipInY** | | | +| **FlipInX** | | | +| **Landing** | | | +| **ScaleIn** | | | +| **ScaleInTop** | | | +| **ScaleInBottom**| | | +| **ScaleInLeft** | | | +| **ScaleInRight** | | | +| **Size** | | | +| **SlideInLeft** | | | +| **SlideInRight** | | | +| **SlideInDown** | | | +| **SlideInUp** | | | diff --git a/example/lib/main.dart b/example/lib/main.dart index 6b495c3..7091a65 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -160,7 +160,7 @@ class _HomePageState extends State { dragEnabled: !nonDraggableItems.contains(user), ); }, - enterTransition: [SlideInDown()], + enterTransition: animations, exitTransition: animations, insertDuration: const Duration(milliseconds: 300), removeDuration: const Duration(milliseconds: 300), @@ -215,37 +215,39 @@ class _HomePageState extends State { color: containerLowColor, borderRadius: BorderRadius.circular(10), ), - child: DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: containerLowColor, - borderRadius: BorderRadius.circular(10), - alignment: Alignment.center, - iconEnabledColor: primaryColor, - value: appliedStyle, - items: AnimationType.values.map((AnimationType animationType) { - return DropdownMenuItem( - value: animationType, - child: Text( - animationType.name.capitalize(), - style: const TextStyle( - fontSize: 20, - color: primaryColor, - fontWeight: FontWeight.w500), - ), - ); - }).toList(), - onChanged: (AnimationType? animationType) { - if (animationType == null) { - return; - } - animations = []; - AnimationEffect animation = - AnimationProvider.buildAnimation(animationType); - animations.add(animation); - setState(() { - appliedStyle = animationType; - }); - }), + child: Center( + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: containerLowColor, + borderRadius: BorderRadius.circular(10), + alignment: Alignment.center, + iconEnabledColor: primaryColor, + value: appliedStyle, + items: AnimationType.values.map((AnimationType animationType) { + return DropdownMenuItem( + value: animationType, + child: Text( + animationType.name.capitalize(), + style: const TextStyle( + fontSize: 20, + color: primaryColor, + fontWeight: FontWeight.w500), + ), + ); + }).toList(), + onChanged: (AnimationType? animationType) { + if (animationType == null) { + return; + } + animations = []; + AnimationEffect animation = + AnimationProvider.buildAnimation(animationType); + animations.add(animation); + setState(() { + appliedStyle = animationType; + }); + }), + ), )); } diff --git a/example/lib/theme/colors.dart b/example/lib/theme/colors.dart index c3aae19..4b9e5df 100644 --- a/example/lib/theme/colors.dart +++ b/example/lib/theme/colors.dart @@ -3,7 +3,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; const primaryColor = Color(0xFFEBB369); -const surfaceColor = Color(0xFF202225); +const surfaceColor = Color(0xFF121212); const textSecondaryLightColor = Color(0x99000000); diff --git a/example/lib/utils/item_card.dart b/example/lib/utils/item_card.dart index 792ee58..9478930 100644 --- a/example/lib/utils/item_card.dart +++ b/example/lib/utils/item_card.dart @@ -13,7 +13,9 @@ class ItemCard extends StatelessWidget { height: 150.0, width: 150, child: Card( - color: !dragEnabled ? containerLowColor : primaryColor, + color: !dragEnabled + ? containerLowColor + : Colors.primaries[id % Colors.primaries.length], child: Center( child: dragEnabled ? Text((id).toString(), diff --git a/example/lib/utils/item_tile.dart b/example/lib/utils/item_tile.dart index c23b14a..e937124 100644 --- a/example/lib/utils/item_tile.dart +++ b/example/lib/utils/item_tile.dart @@ -19,7 +19,9 @@ class ItemTile extends StatelessWidget { margin: const EdgeInsets.symmetric(vertical: 4), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), - color: !dragEnabled ? containerLowColor : primaryColor, + color: !dragEnabled + ? containerLowColor + : Colors.primaries[id % Colors.primaries.length], ), child: Center( child: dragEnabled