Skip to content

Commit

Permalink
Update breaking changes for 3.24 release (#11004)
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough authored Aug 6, 2024
1 parent 90cec98 commit 8285a4b
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 66 deletions.
10 changes: 5 additions & 5 deletions src/content/release/breaking-changes/android-surface-plugins.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: New APIs for Android plugins that render to a Surface
description: >
Adds a new API, `SurfaceProducer`, to the Android embedding API, which
opaquely handles the creation and management of a `Surface` for plugins. For
[Impeller][], use of this API is recommended.
description: >-
Adds a new API, SurfaceProducer, to the Android embedding API, which
opaquely handles the creation and management of a `Surface` for plugins.
For Impeller, use of this API is recommended.
---

## Summary
Expand Down Expand Up @@ -77,7 +77,7 @@ A full example of using this new API can be found in [PR 6989][] for the

## Timeline

Landed in version: TBD
Landed in version: 3.22

:::note
This feature landed in the _previous_ version of the SDK but was non-functional;
Expand Down
14 changes: 7 additions & 7 deletions src/content/release/breaking-changes/can-request-focus.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: TextField.canRequestFocus Deprecated
description: >
`TextField`'s `canRequestFocus` parameter is deprecated and replaced by the
`canRequestFocus` parameter of its `FocusNode`.
title: Deprecated TextField.canRequestFocus
description: >-
The TextField canRequestFocus parameter is deprecated and replaced by the
canRequestFocus parameter of its FocusNode.
---

## Summary

`TextField.canRequestFocus` is deprecated. The same functionality can be
achieved by setting the `canRequestFocus` parameter of the `TextField`'s
`FocusNode`.
`TextField.canRequestFocus` is deprecated.
The same functionality can be achieved by setting the
`canRequestFocus` parameter of the `TextField`'s `FocusNode`.

## Background

Expand Down
10 changes: 5 additions & 5 deletions src/content/release/breaking-changes/deprecate-buttonbar.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Deprecate `ButtonBar` in favor of `OverflowBar`
description: >-
The `ButtonBar` widget has been replaced by a more efficient
widget, `OverflowBar`.
The ButtonBar widget has been replaced by
a more efficient widget, OverflowBar.
---

## Summary
Expand Down Expand Up @@ -130,7 +130,7 @@ OverflowBar(
## Timeline

Landed in version: 3.22.0-2.0.pre<br>
In stable release: Not yet
In stable release: 3.24.0

## References

Expand All @@ -145,9 +145,9 @@ Relevant issues:

Relevant PRs:

- [`Deprecate `ButtonBar`, `ButtonBarThemeData`, and `ThemeData.buttonBarTheme`][]
- [Deprecate `ButtonBar`, `ButtonBarThemeData`, and `ThemeData.buttonBarTheme`][]

[`OverflowBar`]: {{site.api}}/flutter/widgets/OverflowBar-class.html
[`ButtonBar`]: {{site.api}}/flutter/material/ButtonBar-class.html
[Issue #127955]: {{site.repo.flutter}}/issues/127955
[`Deprecate `ButtonBar`, `ButtonBarThemeData`, and `ThemeData.buttonBarTheme`]: {{site.repo.flutter}}/pull/145523
[Deprecate `ButtonBar`, `ButtonBarThemeData`, and `ThemeData.buttonBarTheme`]: {{site.repo.flutter}}/pull/145523
19 changes: 12 additions & 7 deletions src/content/release/breaking-changes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,25 @@ release, and listed in alphabetical order:
### Not yet released to stable

* [Remove invalid parameters for `InputDecoration.collapsed`][]
* [Navigator's page APIs breaking change][]
* [Generic types in `PopScope`][]
* [Stop generating `AssetManifest.json`][]
* [Deprecate `TextField.canRequestFocus`][]
* [Deprecate `ButtonBar` in favor of `OverflowBar`][]

[Remove invalid parameters for `InputDecoration.collapsed`]: /release/breaking-changes/input-decoration-collapsed
[Navigator's page APIs breaking change]: /release/breaking-changes/navigator-and-page-api
[Generic types in `PopScope`]: /release/breaking-changes/popscope-with-result
[Stop generating `AssetManifest.json`]: /release/breaking-changes/asset-manifest-dot-json
[Deprecate `TextField.canRequestFocus`]: /release/breaking-changes/can-request-focus

<a id="released-in-flutter-324" aria-hidden="true"></a>
### Released in Flutter 3.24

* [Navigator's page APIs breaking change][]
* [Generic types in `PopScope`][]
* [Deprecate `ButtonBar` in favor of `OverflowBar`][]
* [New APIs for Android plugins that render to a `Surface`][]

[Navigator's page APIs breaking change]: /release/breaking-changes/navigator-and-page-api
[Generic types in `PopScope`]: /release/breaking-changes/popscope-with-result
[Deprecate `ButtonBar` in favor of `OverflowBar`]: /release/breaking-changes/deprecate-buttonbar
[New APIs for Android plugins that render to a `Surface`]: /release/breaking-changes/android-surface-plugins

<a id="released-in-flutter-322" aria-hidden="true"></a>
### Released in Flutter 3.22
Expand All @@ -54,15 +61,13 @@ release, and listed in alphabetical order:
* [Rename `MaterialState` to `WidgetState`][]
* [Introduce new `ColorScheme` roles][]
* [Dropping support for Android KitKat][]
* [New APIs for Android plugins that render to a `Surface`][]
* [Nullable `PageView.controller`][]
* [Rename `MemoryAllocations` to `FlutterMemoryAllocations`][]

[Deprecated API removed after v3.19]: /release/breaking-changes/3-19-deprecations
[Rename `MaterialState` to `WidgetState`]: /release/breaking-changes/material-state
[Introduce new `ColorScheme` roles]: /release/breaking-changes/new-color-scheme-roles
[Dropping support for Android KitKat]: /release/breaking-changes/android-kitkat-deprecation
[New APIs for Android plugins that render to a `Surface`]: /release/breaking-changes/android-surface-plugins
[Nullable `PageView.controller`]: /release/breaking-changes/pageview-controller
[Rename `MemoryAllocations` to `FlutterMemoryAllocations`]: /release/breaking-changes/flutter-memory-allocations

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Remove invalid parameters for `InputDecoration.collapsed`
description: >
`InputDecoration.collapsed` constructor parameters `floatingLabelBehavior`
and`floatingLabelAlignment` are deprecated without replacement because they
have no effect.
'InputDecoration.collapsed' constructor parameters
'floatingLabelBehavior' and 'floatingLabelAlignment' are deprecated without
replacement because they have no effect.
---

## Summary
Expand Down
47 changes: 27 additions & 20 deletions src/content/release/breaking-changes/navigator-and-page-api.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
---
title: Navigator's page APIs breaking change
description: >
Replace Navigator's `onPopPage` property with `onDidRemovePage` property.
description: >-
Replace Navigator's 'onPopPage' property with the 'onDidRemovePage' property.
---

## Summary

The [`Navigator`]'s page APIs are refactored so that they can integrate
into Flutter's other pop mechanisms.
The [`Navigator`][] page APIs are refactored so that
they can integrate with Flutter's other pop mechanisms.

## Context

The `onPopPage` was added for cleaning up pages after a page is about to be popped.
To veto pop, return `false` in the callback. This does not work well with other popping
mechanisms in the framework, such as [`PopScope`] and iOS back gestures.
The `onPopPage` property was added for cleaning up pages after
a page is about to be popped.
To veto pop, you'd return `false` in the callback.
This did not work well with other popping mechanisms in the framework,
such as [`PopScope`][] and iOS back gestures.

To integrate the other pop mechanisms together, the page APIs need to be refactored.
To integrate the framework's pop mechanisms together,
the page APIs needed to be refactored.

## Description of change

The `onDidRemovePage` property replaces the `onPopPage` property. You can no longer veto a pop in
the `onDidRemovePage` property. Instead, you are only responsible for updating the [`pages`].
The `onDidRemovePage` property replaces the `onPopPage` property.
You can no longer veto a pop in the `onDidRemovePage` property.
Instead, you are only responsible for updating the [`pages`][].

The veto mechanism moves to the `Page.canPop` and `Page.onPopInvoked`.
These function similar to how one uses the `PopScope` widget.
The veto mechanism is now managed with the
`Page.canPop` and `Page.onPopInvoked` properties.
These function similar to how you use the `PopScope` widget.

[`pages`]: {{site.api}}/flutter/widgets/Navigator/pages.html

## Migration guide

Code before migration
Code before migration:

```dart
import 'package:flutter/material.dart';
const MaterialPage<void> page1 = MaterialPage<void>(child: PlaceHolder());
const MaterialPage<void> page2 = MaterialPage<void>(child: PlaceHolder());
const MaterialPage<void> page3 = MaterialPage<void>(child: PlaceHolder());
Expand All @@ -51,18 +59,18 @@ void main() {
return true;
}
return false;
}
},
),
),
);
}
```

Code after migration
Code after migration:

```dart
import 'package:flutter/material.dart';
const MaterialPage<void> page1 = MaterialPage<void>(child: PlaceHolder());
const MaterialPage<void> page2 = MaterialPage<void>(canPop: false, child: PlaceHolder());
const MaterialPage<void> page3 = MaterialPage<void>(child: PlaceHolder());
Expand All @@ -76,8 +84,7 @@ void main() {
onDidRemovePage: (Page<Object?> page) {
pages.remove(page);
pages = pages.toList();
}
},
),
),
);
Expand All @@ -86,8 +93,8 @@ void main() {

## Timeline

Landed in version: TBD<br>
In stable release: TBD
Landed in version: 3.22.0-32.0.pre<br>
In stable release: 3.24.0

## References

Expand Down
45 changes: 26 additions & 19 deletions src/content/release/breaking-changes/popscope-with-result.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
---
title: Generic types in PopScope
description: >
Added a generic type in PopScope class and updated the onPopInvoked
function signature.
description: >-
Added a generic type to the PopScope class and updated
the onPopInvoked function signature.
---

## Summary

Added a generic type in [`PopScope`][] class and replaced the [`onPopInvoked`][]
with a new method [`onPopInvokedWithResult`][]. The new method takes a boolean
`didPop` and a `result` as position parameters.
Added a generic type to the [`PopScope`][] class and replaced
the [`onPopInvoked`][] with a new method [`onPopInvokedWithResult`][].
The new method takes a boolean `didPop` and a `result` as position parameters.

Also replaced the [`Form.onPopInvoked`] with [`Form.onPopInvokedWithResult`][]
for the same reason.

## Context

Previously, `PopScope` didn't have a way to access the pop result when `onPopInvoked`
was called. The generic type is added to the `PopScope` class
so that the new method `onPopInvokedWithResult` can access the type-safe result.
Previously, `PopScope` didn't have a way to access
the pop result when `onPopInvoked` was called.
The generic type is added to the `PopScope` class so that
the new method `onPopInvokedWithResult` can access the type-safe result.

## Description of change

Added a generic type in `PopScope` class and a new method `onPopInvokedWithResult`.
The `onPopInvoked` was deprecated in the favor of `onPopInvokedWithResult`.
Added a generic type (`<T>`) to the `PopScope` class and
a new method `onPopInvokedWithResult`.
The `onPopInvoked` property was deprecated in favor of `onPopInvokedWithResult`.

Also added a new method `onPopInvokedWithResult` to `Form` to replace `onPopInvoked`.
Also added a new method `onPopInvokedWithResult`
to `Form` to replace `onPopInvoked`.

## Migration guide

Code before migration
Code before migration:

```dart
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -67,7 +70,8 @@ void main() {
}
```

Code after migration
Code after migration:

```dart
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -104,17 +108,18 @@ void main() {
}
```

The generic type should match the generic type of the [`Route`]
The generic type should match the generic type of the [`Route`][]
that the `PopScope` is in.
If the route uses `int` as its generic type, consider using `PopScope<int>`.
For example, if the route uses `int` as its generic type,
consider using `PopScope<int>`.

If the `PopScope` widgets are shared across multiple routes with
different types, you can use `PopScope<Object?>` to catch all possible types.

## Timeline

Landed in version: 3.22.0-12.0.pre-56<br>
In stable release: TBD
Landed in version: 3.22.0-26.0.pre<br>
In stable release: 3.24.0

## References

Expand All @@ -133,9 +138,11 @@ Relevant issue:

Relevant PR:

* [Add generic type for result in PopScope][]
* [Add generic type for result in PopScope][] _(reverted)_
* [Reapply new PopScope API][] _(final reland)_

[Add generic type for result in PopScope]: {{site.repo.flutter}}/pull/139164
[Reapply new PopScope API]: {{site.repo.flutter}}/pull/147607
[`PopScope`]: {{site.api}}/flutter/widgets/PopScope-class.html
[`Route`]: {{site.api}}/flutter/widgets/Route-class.html
[`onPopInvoked`]: {{site.api}}/flutter/widgets/PopScope/onPopInvoked.html
Expand Down

0 comments on commit 8285a4b

Please sign in to comment.