Unverified Commit 766e4d28 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove single-view assumption from material library (#117486)

* Remove single-view assumption from material library

* one widget
parent 02a9c151
......@@ -1358,9 +1358,9 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
Orientation _getOrientation(BuildContext context) {
Orientation? result = MediaQuery.maybeOrientationOf(context);
if (result == null) {
// If there's no MediaQuery, then use the window aspect to determine
// If there's no MediaQuery, then use the view aspect to determine
// orientation.
final Size size = WidgetsBinding.instance.window.physicalSize;
final Size size = View.of(context).physicalSize;
result = size.width > size.height ? Orientation.landscape : Orientation.portrait;
}
return result;
......
......@@ -2053,7 +2053,7 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> with Restora
// If screen reader is in use, make the hint text say hours/minutes.
// Otherwise, remove the hint text when focused because the centered cursor
// appears odd above the hint text.
final String? hintText = MediaQuery.accessibleNavigationOf(context) || WidgetsBinding.instance.window.semanticsEnabled
final String? hintText = MediaQuery.accessibleNavigationOf(context) || View.of(context).platformDispatcher.semanticsEnabled
? widget.semanticHintText
: (focusNode.hasFocus ? null : _formattedValue);
......
......@@ -117,7 +117,9 @@ abstract class WidgetsBindingObserver {
/// @override
/// void initState() {
/// super.initState();
/// _lastSize = WidgetsBinding.instance.window.physicalSize;
/// // [View.of] exposes the view from `WidgetsBinding.instance.platformDispatcher.views`
/// // into which this widget is drawn.
/// _lastSize = View.of(context).physicalSize;
/// WidgetsBinding.instance.addObserver(this);
/// }
///
......@@ -129,7 +131,7 @@ abstract class WidgetsBindingObserver {
///
/// @override
/// void didChangeMetrics() {
/// setState(() { _lastSize = WidgetsBinding.instance.window.physicalSize; });
/// setState(() { _lastSize = View.of(context).physicalSize; });
/// }
///
/// @override
......@@ -186,7 +188,7 @@ abstract class WidgetsBindingObserver {
///
/// @override
/// void didChangeTextScaleFactor() {
/// setState(() { _lastTextScaleFactor = WidgetsBinding.instance.window.textScaleFactor; });
/// setState(() { _lastTextScaleFactor = WidgetsBinding.instance.platformDispatcher.textScaleFactor; });
/// }
///
/// @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