Unverified Commit 4a3584af authored by Alberto's avatar Alberto Committed by GitHub

chore: Moved didUpdateWidget calls first (#96944)

parent c1e24765
......@@ -218,13 +218,13 @@ class _CupertinoPickerState extends State<CupertinoPicker> {
@override
void didUpdateWidget(CupertinoPicker oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.scrollController != null && oldWidget.scrollController == null) {
_controller = null;
} else if (widget.scrollController == null && oldWidget.scrollController != null) {
assert(_controller == null);
_controller = FixedExtentScrollController();
}
super.didUpdateWidget(oldWidget);
}
@override
......
......@@ -123,8 +123,8 @@ class _SegmentState<T> extends State<_Segment<T>> with TickerProviderStateMixin<
@override
void didUpdateWidget(_Segment<T> oldWidget) {
assert(oldWidget.key == widget.key);
super.didUpdateWidget(oldWidget);
assert(oldWidget.key == widget.key);
if (oldWidget.shouldScaleContent != widget.shouldScaleContent) {
highlightPressScaleAnimation = highlightPressScaleController.drive(
......@@ -213,8 +213,8 @@ class _SegmentSeparatorState extends State<_SegmentSeparator> with TickerProvide
@override
void didUpdateWidget(_SegmentSeparator oldWidget) {
assert(oldWidget.key == widget.key);
super.didUpdateWidget(oldWidget);
assert(oldWidget.key == widget.key);
if (oldWidget.highlighted != widget.highlighted) {
separatorOpacityController.animateTo(
......
......@@ -422,6 +422,7 @@ class _CupertinoTextSelectionToolbarContentState extends State<_CupertinoTextSel
@override
void didUpdateWidget(_CupertinoTextSelectionToolbarContent oldWidget) {
super.didUpdateWidget(oldWidget);
// If the children are changing, the current page should be reset.
if (widget.children != oldWidget.children) {
_page = 0;
......@@ -429,7 +430,6 @@ class _CupertinoTextSelectionToolbarContentState extends State<_CupertinoTextSel
_controller.forward();
_controller.removeStatusListener(_statusListener);
}
super.didUpdateWidget(oldWidget);
}
@override
......
......@@ -230,11 +230,11 @@ class _MaterialBannerState extends State<MaterialBanner> {
@override
void didUpdateWidget(MaterialBanner oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.animation != oldWidget.animation) {
oldWidget.animation?.removeStatusListener(_onAnimationStatusChanged);
widget.animation?.addStatusListener(_onAnimationStatusChanged);
}
super.didUpdateWidget(oldWidget);
}
@override
......
......@@ -2596,6 +2596,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
@override
void didUpdateWidget(Scaffold oldWidget) {
super.didUpdateWidget(oldWidget);
// Update the Floating Action Button Animator, and then schedule the Floating Action Button for repositioning.
if (widget.floatingActionButtonAnimator != oldWidget.floatingActionButtonAnimator) {
_floatingActionButtonAnimator = widget.floatingActionButtonAnimator ?? _kDefaultFloatingActionButtonAnimator;
......@@ -2628,7 +2629,6 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
_updatePersistentBottomSheet();
}
}
super.didUpdateWidget(oldWidget);
}
@override
......
......@@ -385,11 +385,11 @@ class _SnackBarState extends State<SnackBar> {
@override
void didUpdateWidget(SnackBar oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.animation != oldWidget.animation) {
oldWidget.animation!.removeStatusListener(_onAnimationStatusChanged);
widget.animation!.addStatusListener(_onAnimationStatusChanged);
}
super.didUpdateWidget(oldWidget);
}
@override
......
......@@ -1087,12 +1087,12 @@ class _BackButtonListenerState extends State<BackButtonListener> {
@override
void didUpdateWidget(covariant BackButtonListener oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.onBackButtonPressed != widget.onBackButtonPressed) {
dispatcher?.removeCallback(oldWidget.onBackButtonPressed);
dispatcher?.addCallback(widget.onBackButtonPressed);
dispatcher?.takePriority();
}
super.didUpdateWidget(oldWidget);
}
@override
......
......@@ -164,12 +164,12 @@ class _ValueListenableBuilderState<T> extends State<ValueListenableBuilder<T>> {
@override
void didUpdateWidget(ValueListenableBuilder<T> oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.valueListenable != widget.valueListenable) {
oldWidget.valueListenable.removeListener(_valueChanged);
value = widget.valueListenable.value;
widget.valueListenable.addListener(_valueChanged);
}
super.didUpdateWidget(oldWidget);
}
@override
......
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