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
a9073f78
Unverified
Commit
a9073f78
authored
Mar 21, 2023
by
Michael Goderbauer
Committed by
GitHub
Mar 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate BindingBase.window (#120998)
Deprecate BindingBase.window
parent
2392be76
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
32 deletions
+46
-32
binding.dart
packages/flutter/lib/src/foundation/binding.dart
+42
-29
binding_test.dart
packages/flutter/test/painting/binding_test.dart
+1
-1
window.dart
packages/flutter_test/lib/src/window.dart
+0
-2
window_test.dart
packages/flutter_test/test/window_test.dart
+3
-0
No files found.
packages/flutter/lib/src/foundation/binding.dart
View file @
a9073f78
...
@@ -6,7 +6,7 @@ import 'dart:async';
...
@@ -6,7 +6,7 @@ import 'dart:async';
import
'dart:convert'
show
json
;
import
'dart:convert'
show
json
;
import
'dart:developer'
as
developer
;
import
'dart:developer'
as
developer
;
import
'dart:io'
show
exit
;
import
'dart:io'
show
exit
;
import
'dart:ui'
as
ui
show
Brightness
,
PlatformDispatcher
,
SingletonFlutterWindow
,
window
;
import
'dart:ui'
as
ui
show
Brightness
,
PlatformDispatcher
,
SingletonFlutterWindow
,
window
;
// ignore: deprecated_member_use
// Before adding any more dart:ui imports, please read the README.
// Before adding any more dart:ui imports, please read the README.
...
@@ -21,7 +21,7 @@ import 'platform.dart';
...
@@ -21,7 +21,7 @@ import 'platform.dart';
import
'print.dart'
;
import
'print.dart'
;
import
'service_extensions.dart'
;
import
'service_extensions.dart'
;
export
'dart:ui'
show
PlatformDispatcher
,
SingletonFlutterWindow
;
export
'dart:ui'
show
PlatformDispatcher
,
SingletonFlutterWindow
;
// ignore: deprecated_member_use
export
'basic_types.dart'
show
AsyncCallback
,
AsyncValueGetter
,
AsyncValueSetter
;
export
'basic_types.dart'
show
AsyncCallback
,
AsyncValueGetter
,
AsyncValueSetter
;
...
@@ -171,35 +171,48 @@ abstract class BindingBase {
...
@@ -171,35 +171,48 @@ abstract class BindingBase {
/// * [DebugReassembleConfig], which describes the configuration.
/// * [DebugReassembleConfig], which describes the configuration.
static
DebugReassembleConfig
?
debugReassembleConfig
;
static
DebugReassembleConfig
?
debugReassembleConfig
;
///
The main window to which this binding is bound
.
///
Deprecated. Will be removed in a future version of Flutter
.
///
///
/// A number of additional bindings are defined as extensions of
/// This property has been deprecated to prepare for Flutter's upcoming
/// [BindingBase], e.g., [ServicesBinding], [RendererBinding], and
/// support for multiple views and multiple windows.
/// [WidgetsBinding]. Each of these bindings define behaviors that interact
/// with a [ui.SingletonFlutterWindow].
///
///
/// Each of these other bindings could individually access a
/// It represents the main view for applications where there is only one
/// [ui.SingletonFlutterWindow] statically, but that would preclude the
/// view, such as applications designed for single-display mobile devices.
/// ability to test its behaviors with a fake window for verification
/// If the embedder supports multiple views, it points to the first view
/// purposes. Therefore, [BindingBase] exposes this
/// created which is assumed to be the main view. It throws if no view has
/// [ui.SingletonFlutterWindow] for use by other bindings. A subclass of
/// been created yet or if the first view has been removed again.
/// [BindingBase], such as [TestWidgetsFlutterBinding], can override this
///
/// accessor to return a different [ui.SingletonFlutterWindow] implementation,
/// The following options exists to migrate code that relies on accessing
/// such as a [TestWindow].
/// this deprecated property:
///
///
/// The [window] is a singleton meant for use by applications that only have a
/// If a [BuildContext] is available, consider looking up the current
/// single main window. In addition to the properties of [ui.FlutterView],
/// [FlutterView] associated with that context via [View.of]. It gives access
/// [window] provides access to platform-specific properties and callbacks
/// to the same functionality as this deprecated property. However, the
/// available on the [platformDispatcher].
/// platform-specific functionality has moved to the [PlatformDispatcher],
///
/// which may be accessed from the view returned by [View.of] via
/// For applications designed for more than one main window, prefer using the
/// [FlutterView.platformDispatcher]. Using [View.of] with a [BuildContext] is
/// [platformDispatcher] to access available views via
/// the preferred option to migrate away from this deprecated [window]
/// [ui.PlatformDispatcher.views].
/// property.
///
///
/// However, multiple window support is not yet implemented, so currently this
/// If no context is available to look up a [FlutterView], the
/// provides access to the one and only window.
/// [platformDispatcher] exposed by this binding can be used directly for
// TODO(gspencergoog): remove the preceding note once multi-window support is
/// platform-specific functionality. It also maintains a list of all available
// active.
/// [FlutterView]s in [PlatformDispatcher.views] to access view-specific
/// functionality without a context.
///
/// See also:
///
/// * [View.of] to access view-specific functionality on the [FlutterView]
/// associated with the provided [BuildContext].
/// * [FlutterView.platformDispatcher] to access platform-specific
/// functionality from a given [FlutterView].
/// * [platformDispatcher] on this binding to access the [PlatformDispatcher],
/// which provides platform-specific functionality.
@Deprecated
(
'Look up the current FlutterView from the context via View.of(context) or consult the PlatformDispatcher directly instead. '
'Deprecated to prepare for the upcoming multi-window support. '
'This feature was deprecated after v3.7.0-32.0.pre.'
)
ui
.
SingletonFlutterWindow
get
window
=>
ui
.
window
;
ui
.
SingletonFlutterWindow
get
window
=>
ui
.
window
;
/// The [ui.PlatformDispatcher] to which this binding is bound.
/// The [ui.PlatformDispatcher] to which this binding is bound.
...
...
packages/flutter/test/painting/binding_test.dart
View file @
a9073f78
...
@@ -91,7 +91,7 @@ class TestBindingBase implements BindingBase {
...
@@ -91,7 +91,7 @@ class TestBindingBase implements BindingBase {
void
unlocked
()
{}
void
unlocked
()
{}
@override
@override
ui
.
SingletonFlutterWindow
get
window
=>
throw
UnimplementedError
();
ui
.
SingletonFlutterWindow
get
window
=>
throw
UnimplementedError
();
// ignore: deprecated_member_use
@override
@override
ui
.
PlatformDispatcher
get
platformDispatcher
=>
throw
UnimplementedError
();
ui
.
PlatformDispatcher
get
platformDispatcher
=>
throw
UnimplementedError
();
...
...
packages/flutter_test/lib/src/window.dart
View file @
a9073f78
...
@@ -147,8 +147,6 @@ class FakeViewPadding implements ViewPadding {
...
@@ -147,8 +147,6 @@ class FakeViewPadding implements ViewPadding {
///
///
/// * [TestFlutterView], which wraps a [FlutterView] for testing and
/// * [TestFlutterView], which wraps a [FlutterView] for testing and
/// mocking purposes.
/// mocking purposes.
/// * [TestWindow], which wraps a [SingletonFlutterWindow] for
/// testing and mocking purposes.
class
TestPlatformDispatcher
implements
PlatformDispatcher
{
class
TestPlatformDispatcher
implements
PlatformDispatcher
{
/// Constructs a [TestPlatformDispatcher] that defers all behavior to the given
/// Constructs a [TestPlatformDispatcher] that defers all behavior to the given
/// [PlatformDispatcher] unless explicitly overridden for test purposes.
/// [PlatformDispatcher] unless explicitly overridden for test purposes.
...
...
packages/flutter_test/test/window_test.dart
View file @
a9073f78
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// TODO(goderbauer): Delete these tests when the deprecated window property is removed.
// ignore_for_file: deprecated_member_use
import
'dart:ui'
as
ui
show
window
;
import
'dart:ui'
as
ui
show
window
;
import
'dart:ui'
;
import
'dart:ui'
;
...
...
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