KO
|
EN
gitlite — search
Search
#python
#javascript
#react
#hacktoberfest
#bot
#nodejs
#mongodb
#cpp
#flutter
#express
#python3
#registry
diffutil_sliverlist
★ 24
Open GitHub ↗
No description available.
Download README (.md)
Explore Similar Repositories
flutter_sliver_tracker
:
flutter滑动曝光埋点框架,支持SliverList、SliverGrid
responsive_grid_list
:
A Flutter plugin to create responsive grid lists using ListView.builder() or SliverList with a SliverChildBuilderDelegate
transformable_list_view
:
Widget that extends the default ListView with ability to add item transform animations according to it's scroll position
indexed_scroll_observer
:
An elegant scroll observer for observing scrollable widgets in Flutter applications.
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
diffutil_sliverlist
?
Download (.md)
# diffutil_sliverlist [](https://pub.dartlang.org/packages/diffutil_sliverlist) [](https://github.com/knaeckeKami/diffutil_sliverlist/actions) [](https://codecov.io/gh/knaeckeKami/diffutil_sliverlist) A SliverList that implicitly animates changes. It supports two use cases: ## Animating changes from a list of widgets with unique keys When you have a list of Widgets and can give each Widget a unique key, you can use `DiffUtilSliverList.fromKeyedWidgetList`. See the example code: ```dart class _ExpandableListsState extends State<ExpandableLists> { bool expanded = false; @override Widget build(BuildContext context) { return DiffUtilSliverList.fromKeyedWidgetList( children: [ ListTile( key: Key("1"), title: Text("first"), trailing: Icon(Icons.chevron_right), ), ListTile( key: Key("2"), title: Text("second"), trailing: Icon(Icons.chevron_right), ), if (this.expanded) for (int i = 3; i < 6; i++) ListTile( key: Key(i.toString()), title: Text("index: $i"), trailing: Icon(Icons.chevron_right), ), ListTile( key: Key("expand_collapse"), onTap: () => setState(() { expaned = !expaned; }), title: Text(expanded ? "collapse" : "expand", style: TextStyle(fontWeight: FontWeight.bold),), trailing: Icon(expanded ? Icons.expand_less : Icons.expand_more), ) ], insertAnimationBuilder: (context, animation, child) => FadeTransition( opacity: animation, child: child, ), removeAnimationBuilder: (context, animation, child) => FadeTransition( opacity: animation, child: SizeTransition( sizeFactor: animation, axisAlignment: 0, child: child, ), ), ); } } ``` And the result:  ## Building Widgets from a list of data objects that implement == Example: ```dart Widget build(BuildContext context) { return CustomScrollView( slivers: [ DiffUtilSliverList<int>( items: list, builder: (context, item) => Container( color: colors[item % colors.length], height: 48, width: double.infinity, ), insertAnimationBuilder: (context, animation, child) => FadeTransition( opacity: animation, child: child, ), removeAnimationBuilder: (context, animation, child) => SizeTransition( sizeFactor: animation, child: child, ), removeAnimationDuration: const Duration(milliseconds: 3000), insertAnimationDuration: const Duration(milliseconds: 1200), ), ], ); } ``` If `list` changes, the list will automatically animate new/removed items:  If the items don't implement `==` correctly, you can pass your own `equalityChecker`.