Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1730662b
Unverified
Commit
1730662b
authored
Oct 10, 2022
by
Greg Spencer
Committed by
GitHub
Oct 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate `AnimatedListItemBuilder` and `AnimatedListRemovedItemBuilder` (#113131)
parent
721d4abb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
20 deletions
+39
-20
animated_list.0.dart
examples/api/lib/widgets/animated_list/animated_list.0.dart
+7
-5
sliver_animated_list.0.dart
...api/lib/widgets/animated_list/sliver_animated_list.0.dart
+7
-6
animated_grid.dart
packages/flutter/lib/src/widgets/animated_grid.dart
+4
-2
animated_list.dart
packages/flutter/lib/src/widgets/animated_list.dart
+21
-7
No files found.
examples/api/lib/widgets/animated_list/animated_list.0.dart
View file @
1730662b
...
...
@@ -50,11 +50,13 @@ class _AnimatedListSampleState extends State<AnimatedListSample> {
);
}
// Used to build an item after it has been removed from the list. This method
// is needed because a removed item remains visible until its animation has
// completed (even though it's gone as far as this ListModel is concerned).
// The widget will be used by the [AnimatedListState.removeItem] method's
// [AnimatedListRemovedItemBuilder] parameter.
/// The builder function used to build items that have been removed.
///
/// Used to build an item after it has been removed from the list. This method
/// is needed because a removed item remains visible until its animation has
/// completed (even though it's gone as far as this ListModel is concerned).
/// The widget will be used by the [AnimatedListState.removeItem] method's
/// [AnimatedRemovedItemBuilder] parameter.
Widget
_buildRemovedItem
(
int
item
,
BuildContext
context
,
Animation
<
double
>
animation
)
{
return
CardItem
(
...
...
examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart
View file @
1730662b
...
...
@@ -53,12 +53,13 @@ class _SliverAnimatedListSampleState extends State<SliverAnimatedListSample> {
);
}
// Used to build an item after it has been removed from the list. This
// method is needed because a removed item remains visible until its
// animation has completed (even though it's gone as far this ListModel is
// concerned). The widget will be used by the
// [AnimatedListState.removeItem] method's
// [AnimatedListRemovedItemBuilder] parameter.
/// The builder function used to build items that have been removed.
///
/// Used to build an item after it has been removed from the list. This method
/// is needed because a removed item remains visible until its animation has
/// completed (even though it's gone as far this ListModel is concerned). The
/// widget will be used by the [AnimatedListState.removeItem] method's
/// [AnimatedRemovedItemBuilder] parameter.
Widget
_buildRemovedItem
(
int
item
,
BuildContext
context
,
Animation
<
double
>
animation
)
{
return
CardItem
(
...
...
packages/flutter/lib/src/widgets/animated_grid.dart
View file @
1730662b
...
...
@@ -20,7 +20,9 @@ import 'ticker_provider.dart';
/// `animation` is an [Animation] that should be used to animate an entry
/// transition for the widget that is built.
///
/// - [AnimatedRemovedItemBuilder], a builder that is for removing items with
/// See also:
///
/// * [AnimatedRemovedItemBuilder], a builder that is for removing items with
/// animations instead of adding them.
typedef
AnimatedItemBuilder
=
Widget
Function
(
BuildContext
context
,
int
index
,
Animation
<
double
>
animation
);
...
...
@@ -34,7 +36,7 @@ typedef AnimatedItemBuilder = Widget Function(BuildContext context, int index, A
///
/// See also:
///
///
-
[AnimatedItemBuilder], a builder that is for adding items with animations
///
*
[AnimatedItemBuilder], a builder that is for adding items with animations
/// instead of removing them.
typedef
AnimatedRemovedItemBuilder
=
Widget
Function
(
BuildContext
context
,
Animation
<
double
>
animation
);
...
...
packages/flutter/lib/src/widgets/animated_list.dart
View file @
1730662b
...
...
@@ -4,6 +4,7 @@
import
'package:flutter/foundation.dart'
;
import
'animated_grid.dart'
;
import
'basic.dart'
;
import
'framework.dart'
;
import
'scroll_controller.dart'
;
...
...
@@ -13,9 +14,22 @@ import 'sliver.dart';
import
'ticker_provider.dart'
;
/// Signature for the builder callback used by [AnimatedList].
///
/// This is deprecated, use the identical [AnimatedItemBuilder] instead.
@Deprecated
(
'Use AnimatedItemBuilder instead. '
'This feature was deprecated after v3.5.0-4.0.pre.'
,
)
typedef
AnimatedListItemBuilder
=
Widget
Function
(
BuildContext
context
,
int
index
,
Animation
<
double
>
animation
);
/// Signature for the builder callback used by [AnimatedListState.removeItem].
///
/// This is deprecated, use the identical [AnimatedRemovedItemBuilder]
/// instead.
@Deprecated
(
'Use AnimatedRemovedItemBuilder instead. '
'This feature was deprecated after v3.5.0-4.0.pre.'
,
)
typedef
AnimatedListRemovedItemBuilder
=
Widget
Function
(
BuildContext
context
,
Animation
<
double
>
animation
);
// The default insert/remove animation duration.
...
...
@@ -30,7 +44,7 @@ class _ActiveItem implements Comparable<_ActiveItem> {
removedItemBuilder
=
null
;
final
AnimationController
?
controller
;
final
Animated
List
RemovedItemBuilder
?
removedItemBuilder
;
final
AnimatedRemovedItemBuilder
?
removedItemBuilder
;
int
itemIndex
;
@override
...
...
@@ -84,7 +98,7 @@ class AnimatedList extends StatefulWidget {
///
/// List items are only built when they're scrolled into view.
///
/// The [Animated
List
ItemBuilder] index parameter indicates the item's
/// The [AnimatedItemBuilder] index parameter indicates the item's
/// position in the list. The value of the index parameter will be between 0
/// and [initialItemCount] plus the total number of items that have been
/// inserted with [AnimatedListState.insertItem] and less the total number of
...
...
@@ -92,7 +106,7 @@ class AnimatedList extends StatefulWidget {
///
/// Implementations of this callback should assume that
/// [AnimatedListState.removeItem] removes an item immediately.
final
Animated
List
ItemBuilder
itemBuilder
;
final
AnimatedItemBuilder
itemBuilder
;
/// {@template flutter.widgets.animatedList.initialItemCount}
/// The number of items the list will start with.
...
...
@@ -305,7 +319,7 @@ class AnimatedListState extends State<AnimatedList> with TickerProviderStateMixi
/// This method's semantics are the same as Dart's [List.remove] method:
/// it decreases the length of the list by one and shifts all items at or
/// before [index] towards the beginning of the list.
void
removeItem
(
int
index
,
Animated
List
RemovedItemBuilder
builder
,
{
Duration
duration
=
_kDuration
})
{
void
removeItem
(
int
index
,
AnimatedRemovedItemBuilder
builder
,
{
Duration
duration
=
_kDuration
})
{
_sliverAnimatedListKey
.
currentState
!.
removeItem
(
index
,
builder
,
duration:
duration
);
}
...
...
@@ -371,7 +385,7 @@ class SliverAnimatedList extends StatefulWidget {
///
/// List items are only built when they're scrolled into view.
///
/// The [Animated
List
ItemBuilder] index parameter indicates the item's
/// The [AnimatedItemBuilder] index parameter indicates the item's
/// position in the list. The value of the index parameter will be between 0
/// and [initialItemCount] plus the total number of items that have been
/// inserted with [SliverAnimatedListState.insertItem] and less the total
...
...
@@ -380,7 +394,7 @@ class SliverAnimatedList extends StatefulWidget {
///
/// Implementations of this callback should assume that
/// [SliverAnimatedListState.removeItem] removes an item immediately.
final
Animated
List
ItemBuilder
itemBuilder
;
final
AnimatedItemBuilder
itemBuilder
;
/// {@macro flutter.widgets.SliverChildBuilderDelegate.findChildIndexCallback}
final
ChildIndexGetter
?
findChildIndexCallback
;
...
...
@@ -620,7 +634,7 @@ class SliverAnimatedListState extends State<SliverAnimatedList> with TickerProvi
/// This method's semantics are the same as Dart's [List.remove] method:
/// it decreases the length of the list by one and shifts all items at or
/// before [index] towards the beginning of the list.
void
removeItem
(
int
index
,
Animated
List
RemovedItemBuilder
builder
,
{
Duration
duration
=
_kDuration
})
{
void
removeItem
(
int
index
,
AnimatedRemovedItemBuilder
builder
,
{
Duration
duration
=
_kDuration
})
{
assert
(
index
!=
null
&&
index
>=
0
);
assert
(
builder
!=
null
);
assert
(
duration
!=
null
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment