Commit 9ec3cabf authored by Adam Barth's avatar Adam Barth Committed by GitHub

Rename TabSelection.registerAnimationListener to addAnimationListener (#5932)

This name is more consistent with our other names.

Fixes #4714
parent f64d52e6
...@@ -649,8 +649,8 @@ class TabBarSelectionState<T> extends State<TabBarSelection<T>> { ...@@ -649,8 +649,8 @@ class TabBarSelectionState<T> extends State<TabBarSelection<T>> {
/// Calls listener methods every time the value or status of the selection animation changes. /// Calls listener methods every time the value or status of the selection animation changes.
/// ///
/// Listeners can be removed with [unregisterAnimationListener]. /// Listeners can be removed with [removeAnimationListener].
void registerAnimationListener(TabBarSelectionAnimationListener listener) { void addAnimationListener(TabBarSelectionAnimationListener listener) {
_animationListeners.add(listener); _animationListeners.add(listener);
_controller _controller
..addStatusListener(listener.handleStatusChange) ..addStatusListener(listener.handleStatusChange)
...@@ -659,8 +659,8 @@ class TabBarSelectionState<T> extends State<TabBarSelection<T>> { ...@@ -659,8 +659,8 @@ class TabBarSelectionState<T> extends State<TabBarSelection<T>> {
/// Stop calling listener methods every time the value or status of the animation changes. /// Stop calling listener methods every time the value or status of the animation changes.
/// ///
/// Listeners can be added with [registerAnimationListener]. /// Listeners can be added with [addAnimationListener].
void unregisterAnimationListener(TabBarSelectionAnimationListener listener) { void removeAnimationListener(TabBarSelectionAnimationListener listener) {
_animationListeners.remove(listener); _animationListeners.remove(listener);
_controller _controller
..removeStatusListener(listener.handleStatusChange) ..removeStatusListener(listener.handleStatusChange)
...@@ -672,7 +672,7 @@ class TabBarSelectionState<T> extends State<TabBarSelection<T>> { ...@@ -672,7 +672,7 @@ class TabBarSelectionState<T> extends State<TabBarSelection<T>> {
_controller.stop(); _controller.stop();
for (TabBarSelectionAnimationListener listener in _animationListeners.toList()) { for (TabBarSelectionAnimationListener listener in _animationListeners.toList()) {
listener.handleSelectionDeactivate(); listener.handleSelectionDeactivate();
unregisterAnimationListener(listener); removeAnimationListener(listener);
} }
assert(_animationListeners.isEmpty); assert(_animationListeners.isEmpty);
_writeValue(); _writeValue();
...@@ -772,9 +772,9 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect ...@@ -772,9 +772,9 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect
void _initSelection(TabBarSelectionState<T> newSelection) { void _initSelection(TabBarSelectionState<T> newSelection) {
if (_selection == newSelection) if (_selection == newSelection)
return; return;
_selection?.unregisterAnimationListener(this); _selection?.removeAnimationListener(this);
_selection = newSelection; _selection = newSelection;
_selection?.registerAnimationListener(this); _selection?.addAnimationListener(this);
if (_selection != null) if (_selection != null)
_lastSelectedIndex = _selection.index; _lastSelectedIndex = _selection.index;
} }
...@@ -791,7 +791,7 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect ...@@ -791,7 +791,7 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect
@override @override
void dispose() { void dispose() {
_selection?.unregisterAnimationListener(this); _selection?.removeAnimationListener(this);
super.dispose(); super.dispose();
} }
...@@ -1110,9 +1110,9 @@ class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements Ta ...@@ -1110,9 +1110,9 @@ class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements Ta
void _initSelection(TabBarSelectionState<T> newSelection) { void _initSelection(TabBarSelectionState<T> newSelection) {
if (_selection == newSelection) if (_selection == newSelection)
return; return;
_selection?.unregisterAnimationListener(this); _selection?.removeAnimationListener(this);
_selection = newSelection; _selection = newSelection;
_selection?.registerAnimationListener(this); _selection?.addAnimationListener(this);
if (_selection != null) if (_selection != null)
_updateItemsAndScrollBehavior(); _updateItemsAndScrollBehavior();
} }
...@@ -1126,7 +1126,7 @@ class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements Ta ...@@ -1126,7 +1126,7 @@ class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements Ta
@override @override
void dispose() { void dispose() {
_selection?.unregisterAnimationListener(this); _selection?.removeAnimationListener(this);
super.dispose(); super.dispose();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment