apply null safety syntax to mobile dart:ui (flutter/engine#18933)
* apply null safety syntax to mobile dart:ui
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
# private fields, especially on the Window object):
|
||||
|
||||
analyzer:
|
||||
enable-experiment:
|
||||
- non-nullable
|
||||
exclude: [
|
||||
# this test pretends to be part of dart:ui and results in lots of false
|
||||
# positives.
|
||||
|
||||
@@ -7,6 +7,7 @@ dartanalyzer --version
|
||||
|
||||
RESULTS=`dartanalyzer \
|
||||
--options flutter/analysis_options.yaml \
|
||||
--enable-experiment=non-nullable \
|
||||
"$1out/host_debug_unopt/gen/sky/bindings/dart_ui/ui.dart" \
|
||||
2>&1 \
|
||||
| grep -Ev "No issues found!" \
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
// TODO(dnfield): Remove unused_import ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
// TODO(dnfield): Update this if/when we default this to on in the tool,
|
||||
@@ -39,7 +40,7 @@ part of dart.ui;
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
const _KeepToString/*!*/ keepToString = _KeepToString();
|
||||
const _KeepToString keepToString = _KeepToString();
|
||||
|
||||
class _KeepToString {
|
||||
const _KeepToString();
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
/// A saved platform message for a channel with its callback.
|
||||
@@ -14,12 +15,12 @@ class _StoredMessage {
|
||||
_StoredMessage(this._data, this._callback);
|
||||
|
||||
/// Representation of the message's payload.
|
||||
final ByteData/*?*/ _data;
|
||||
ByteData/*?*/ get data => _data;
|
||||
final ByteData? _data;
|
||||
ByteData? get data => _data;
|
||||
|
||||
/// Callback to be called when the message is received.
|
||||
final PlatformMessageResponseCallback/*!*/ _callback;
|
||||
PlatformMessageResponseCallback/*!*/ get callback => _callback;
|
||||
final PlatformMessageResponseCallback _callback;
|
||||
PlatformMessageResponseCallback get callback => _callback;
|
||||
}
|
||||
|
||||
/// A fixed-size circular queue.
|
||||
@@ -43,7 +44,7 @@ class _RingBuffer<T> {
|
||||
|
||||
/// A callback that get's called when items are ejected from the [_RingBuffer]
|
||||
/// by way of an overflow or a resizing.
|
||||
Function(T) _dropItemCallback;
|
||||
Function(T)? _dropItemCallback;
|
||||
set dropItemCallback(Function(T) callback) {
|
||||
_dropItemCallback = callback;
|
||||
}
|
||||
@@ -60,7 +61,7 @@ class _RingBuffer<T> {
|
||||
}
|
||||
|
||||
/// Returns null when empty.
|
||||
T pop() {
|
||||
T? pop() {
|
||||
return _queue.isEmpty ? null : _queue.removeFirst();
|
||||
}
|
||||
|
||||
@@ -70,9 +71,7 @@ class _RingBuffer<T> {
|
||||
int result = 0;
|
||||
while (_queue.length > lengthLimit) {
|
||||
final T item = _queue.removeFirst();
|
||||
if (_dropItemCallback != null) {
|
||||
_dropItemCallback(item);
|
||||
}
|
||||
_dropItemCallback?.call(item);
|
||||
result += 1;
|
||||
}
|
||||
return result;
|
||||
@@ -86,7 +85,7 @@ class _RingBuffer<T> {
|
||||
}
|
||||
|
||||
/// Signature for [ChannelBuffers.drain].
|
||||
typedef DrainChannelCallback = Future<void>/*!*/ Function(ByteData/*?*/, PlatformMessageResponseCallback/*!*/);
|
||||
typedef DrainChannelCallback = Future<void> Function(ByteData?, PlatformMessageResponseCallback);
|
||||
|
||||
/// Storage of channel messages until the channels are completely routed,
|
||||
/// i.e. when a message handler is attached to the channel on the framework side.
|
||||
@@ -116,8 +115,8 @@ class ChannelBuffers {
|
||||
static const String kControlChannelName = 'dev.flutter/channel-buffers';
|
||||
|
||||
/// A mapping between a channel name and its associated [_RingBuffer].
|
||||
final Map<String, _RingBuffer<_StoredMessage>> _messages =
|
||||
<String, _RingBuffer<_StoredMessage>>{};
|
||||
final Map<String, _RingBuffer<_StoredMessage>?> _messages =
|
||||
<String, _RingBuffer<_StoredMessage>?>{};
|
||||
|
||||
_RingBuffer<_StoredMessage> _makeRingBuffer(int size) {
|
||||
final _RingBuffer<_StoredMessage> result = _RingBuffer<_StoredMessage>(size);
|
||||
@@ -130,8 +129,8 @@ class ChannelBuffers {
|
||||
}
|
||||
|
||||
/// Returns true on overflow.
|
||||
bool/*!*/ push(String/*!*/ channel, ByteData/*?*/ data, PlatformMessageResponseCallback/*!*/ callback) {
|
||||
_RingBuffer<_StoredMessage> queue = _messages[channel];
|
||||
bool push(String channel, ByteData? data, PlatformMessageResponseCallback callback) {
|
||||
_RingBuffer<_StoredMessage>? queue = _messages[channel];
|
||||
if (queue == null) {
|
||||
queue = _makeRingBuffer(kDefaultBufferSize);
|
||||
_messages[channel] = queue;
|
||||
@@ -150,15 +149,15 @@ class ChannelBuffers {
|
||||
}
|
||||
|
||||
/// Returns null on underflow.
|
||||
_StoredMessage _pop(String channel) {
|
||||
final _RingBuffer<_StoredMessage> queue = _messages[channel];
|
||||
final _StoredMessage result = queue?.pop();
|
||||
_StoredMessage? _pop(String channel) {
|
||||
final _RingBuffer<_StoredMessage>? queue = _messages[channel];
|
||||
final _StoredMessage? result = queue?.pop();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool _isEmpty(String channel) {
|
||||
final _RingBuffer<_StoredMessage> queue = _messages[channel];
|
||||
return (queue == null) ? true : queue.isEmpty;
|
||||
final _RingBuffer<_StoredMessage>? queue = _messages[channel];
|
||||
return queue == null || queue.isEmpty;
|
||||
}
|
||||
|
||||
/// Changes the capacity of the queue associated with the given channel.
|
||||
@@ -166,7 +165,7 @@ class ChannelBuffers {
|
||||
/// This could result in the dropping of messages if newSize is less
|
||||
/// than the current length of the queue.
|
||||
void _resize(String channel, int newSize) {
|
||||
_RingBuffer<_StoredMessage> queue = _messages[channel];
|
||||
_RingBuffer<_StoredMessage>? queue = _messages[channel];
|
||||
if (queue == null) {
|
||||
queue = _makeRingBuffer(newSize);
|
||||
_messages[channel] = queue;
|
||||
@@ -182,9 +181,9 @@ class ChannelBuffers {
|
||||
///
|
||||
/// This should be called once a channel is prepared to handle messages
|
||||
/// (i.e. when a message handler is setup in the framework).
|
||||
Future<void>/*!*/ drain(String/*!*/ channel, DrainChannelCallback/*!*/ callback) async {
|
||||
Future<void> drain(String channel, DrainChannelCallback callback) async {
|
||||
while (!_isEmpty(channel)) {
|
||||
final _StoredMessage message = _pop(channel);
|
||||
final _StoredMessage message = _pop(channel)!;
|
||||
await callback(message.data, message.callback);
|
||||
}
|
||||
}
|
||||
@@ -204,7 +203,7 @@ class ChannelBuffers {
|
||||
/// Arity: 2
|
||||
/// Format: `resize\r<channel name>\r<new size>`
|
||||
/// Description: Allows you to set the size of a channel's buffer.
|
||||
void handleMessage(ByteData/*!*/ data) {
|
||||
void handleMessage(ByteData data) {
|
||||
final List<String> command = _getString(data).split('\r');
|
||||
if (command.length == /*arity=*/2 + 1 && command[0] == 'resize') {
|
||||
_resize(command[1], int.parse(command[2]));
|
||||
@@ -220,4 +219,4 @@ class ChannelBuffers {
|
||||
///
|
||||
/// See also:
|
||||
/// * [BinaryMessenger] - The place where ChannelBuffers are typically read.
|
||||
final ChannelBuffers/*!*/ channelBuffers = ChannelBuffers();
|
||||
final ChannelBuffers channelBuffers = ChannelBuffers();
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
/// An opaque object representing a composited scene.
|
||||
@@ -22,7 +23,7 @@ class Scene extends NativeFieldWrapperClass2 {
|
||||
|
||||
/// Creates a raster image representation of the current state of the scene.
|
||||
/// This is a slow operation that is performed on a background thread.
|
||||
Future<Image/*!*/>/*!*/ toImage(int/*!*/ width, int/*!*/ height) {
|
||||
Future<Image> toImage(int width, int height) {
|
||||
if (width <= 0 || height <= 0) {
|
||||
throw Exception('Invalid image dimensions.');
|
||||
}
|
||||
@@ -53,7 +54,7 @@ abstract class _EngineLayerWrapper implements EngineLayer {
|
||||
//
|
||||
// Null if this layer has no children. This field is populated only in debug
|
||||
// mode.
|
||||
List<_EngineLayerWrapper> _debugChildren;
|
||||
List<_EngineLayerWrapper>? _debugChildren;
|
||||
|
||||
// Whether this layer was used as `oldLayer` in a past frame.
|
||||
//
|
||||
@@ -200,10 +201,6 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
// In debug mode checks that the `layer` is only used once in a given scene.
|
||||
bool _debugCheckUsedOnce(EngineLayer layer, String usage) {
|
||||
assert(() {
|
||||
if (layer == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
assert(
|
||||
!_usedLayers.containsKey(layer),
|
||||
'Layer ${layer.runtimeType} already used.\n'
|
||||
@@ -217,7 +214,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _debugCheckCanBeUsedAsOldLayer(_EngineLayerWrapper layer, String methodName) {
|
||||
bool _debugCheckCanBeUsedAsOldLayer(_EngineLayerWrapper? layer, String methodName) {
|
||||
assert(() {
|
||||
if (layer == null) {
|
||||
return true;
|
||||
@@ -239,7 +236,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
if (_layerStack.isNotEmpty) {
|
||||
final _EngineLayerWrapper currentLayer = _layerStack.last;
|
||||
currentLayer._debugChildren ??= <_EngineLayerWrapper>[];
|
||||
currentLayer._debugChildren.add(newLayer);
|
||||
currentLayer._debugChildren!.add(newLayer);
|
||||
}
|
||||
_layerStack.add(newLayer);
|
||||
return true;
|
||||
@@ -275,9 +272,9 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// {@endtemplate}
|
||||
///
|
||||
/// See [pop] for details about the operation stack.
|
||||
TransformEngineLayer/*?*/ pushTransform(
|
||||
Float64List/*!*/ matrix4, {
|
||||
TransformEngineLayer/*?*/ oldLayer,
|
||||
TransformEngineLayer? pushTransform(
|
||||
Float64List matrix4, {
|
||||
TransformEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(_matrix4IsValid(matrix4));
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushTransform'));
|
||||
@@ -299,10 +296,10 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// {@macro dart.ui.sceneBuilder.oldLayerVsRetained}
|
||||
///
|
||||
/// See [pop] for details about the operation stack.
|
||||
OffsetEngineLayer/*?*/ pushOffset(
|
||||
double/*!*/ dx,
|
||||
double/*!*/ dy, {
|
||||
OffsetEngineLayer/*?*/ oldLayer,
|
||||
OffsetEngineLayer? pushOffset(
|
||||
double dx,
|
||||
double dy, {
|
||||
OffsetEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushOffset'));
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
@@ -324,12 +321,12 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
///
|
||||
/// See [pop] for details about the operation stack, and [Clip] for different clip modes.
|
||||
/// By default, the clip will be anti-aliased (clip = [Clip.antiAlias]).
|
||||
ClipRectEngineLayer/*?*/ pushClipRect(
|
||||
Rect/*!*/ rect, {
|
||||
Clip/*!*/ clipBehavior = Clip.antiAlias,
|
||||
ClipRectEngineLayer/*?*/ oldLayer,
|
||||
ClipRectEngineLayer? pushClipRect(
|
||||
Rect rect, {
|
||||
Clip clipBehavior = Clip.antiAlias,
|
||||
ClipRectEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(clipBehavior != null);
|
||||
assert(clipBehavior != null); // ignore: unnecessary_null_comparison
|
||||
assert(clipBehavior != Clip.none);
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushClipRect'));
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
@@ -352,12 +349,12 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
///
|
||||
/// See [pop] for details about the operation stack, and [Clip] for different clip modes.
|
||||
/// By default, the clip will be anti-aliased (clip = [Clip.antiAlias]).
|
||||
ClipRRectEngineLayer/*?*/ pushClipRRect(
|
||||
RRect/*!*/ rrect, {
|
||||
Clip/*!*/ clipBehavior = Clip.antiAlias,
|
||||
ClipRRectEngineLayer/*?*/ oldLayer,
|
||||
ClipRRectEngineLayer? pushClipRRect(
|
||||
RRect rrect, {
|
||||
Clip clipBehavior = Clip.antiAlias,
|
||||
ClipRRectEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(clipBehavior != null);
|
||||
assert(clipBehavior != null); // ignore: unnecessary_null_comparison
|
||||
assert(clipBehavior != Clip.none);
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushClipRRect'));
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
@@ -380,12 +377,12 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
///
|
||||
/// See [pop] for details about the operation stack. See [Clip] for different clip modes.
|
||||
/// By default, the clip will be anti-aliased (clip = [Clip.antiAlias]).
|
||||
ClipPathEngineLayer/*?*/ pushClipPath(
|
||||
Path/*!*/ path, {
|
||||
Clip/*!*/ clipBehavior = Clip.antiAlias,
|
||||
ClipPathEngineLayer/*?*/ oldLayer,
|
||||
ClipPathEngineLayer? pushClipPath(
|
||||
Path path, {
|
||||
Clip clipBehavior = Clip.antiAlias,
|
||||
ClipPathEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(clipBehavior != null);
|
||||
assert(clipBehavior != null); // ignore: unnecessary_null_comparison
|
||||
assert(clipBehavior != Clip.none);
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushClipPath'));
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
@@ -409,14 +406,14 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// {@macro dart.ui.sceneBuilder.oldLayerVsRetained}
|
||||
///
|
||||
/// See [pop] for details about the operation stack.
|
||||
OpacityEngineLayer/*?*/ pushOpacity(
|
||||
int/*!*/ alpha, {
|
||||
Offset/*?*/ offset = Offset.zero,
|
||||
OpacityEngineLayer/*?*/ oldLayer,
|
||||
OpacityEngineLayer? pushOpacity(
|
||||
int alpha, {
|
||||
Offset? offset = Offset.zero,
|
||||
OpacityEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushOpacity'));
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
_pushOpacity(engineLayer, alpha, offset.dx, offset.dy);
|
||||
_pushOpacity(engineLayer, alpha, offset!.dx, offset.dy);
|
||||
final OpacityEngineLayer layer = OpacityEngineLayer._(engineLayer);
|
||||
assert(_debugPushLayer(layer));
|
||||
return layer;
|
||||
@@ -434,14 +431,14 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// {@macro dart.ui.sceneBuilder.oldLayerVsRetained}
|
||||
///
|
||||
/// See [pop] for details about the operation stack.
|
||||
ColorFilterEngineLayer/*?*/ pushColorFilter(
|
||||
ColorFilter/*!*/ filter, {
|
||||
ColorFilterEngineLayer/*?*/ oldLayer,
|
||||
ColorFilterEngineLayer? pushColorFilter(
|
||||
ColorFilter filter, {
|
||||
ColorFilterEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(filter != null);
|
||||
assert(filter != null); // ignore: unnecessary_null_comparison
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushColorFilter'));
|
||||
final _ColorFilter nativeFilter = filter._toNativeColorFilter();
|
||||
assert(nativeFilter != null);
|
||||
final _ColorFilter nativeFilter = filter._toNativeColorFilter()!;
|
||||
assert(nativeFilter != null); // ignore: unnecessary_null_comparison
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
_pushColorFilter(engineLayer, nativeFilter);
|
||||
final ColorFilterEngineLayer layer = ColorFilterEngineLayer._(engineLayer);
|
||||
@@ -461,14 +458,14 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// {@macro dart.ui.sceneBuilder.oldLayerVsRetained}
|
||||
///
|
||||
/// See [pop] for details about the operation stack.
|
||||
ImageFilterEngineLayer/*?*/ pushImageFilter(
|
||||
ImageFilter/*!*/ filter, {
|
||||
ImageFilterEngineLayer/*?*/ oldLayer,
|
||||
ImageFilterEngineLayer? pushImageFilter(
|
||||
ImageFilter filter, {
|
||||
ImageFilterEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(filter != null);
|
||||
assert(filter != null); // ignore: unnecessary_null_comparison
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushImageFilter'));
|
||||
final _ImageFilter nativeFilter = filter._toNativeImageFilter();
|
||||
assert(nativeFilter != null);
|
||||
assert(nativeFilter != null); // ignore: unnecessary_null_comparison
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
_pushImageFilter(engineLayer, nativeFilter);
|
||||
final ImageFilterEngineLayer layer = ImageFilterEngineLayer._(engineLayer);
|
||||
@@ -488,9 +485,9 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// {@macro dart.ui.sceneBuilder.oldLayerVsRetained}
|
||||
///
|
||||
/// See [pop] for details about the operation stack.
|
||||
BackdropFilterEngineLayer/*?*/ pushBackdropFilter(
|
||||
ImageFilter/*!*/ filter, {
|
||||
BackdropFilterEngineLayer/*?*/ oldLayer,
|
||||
BackdropFilterEngineLayer? pushBackdropFilter(
|
||||
ImageFilter filter, {
|
||||
BackdropFilterEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushBackdropFilter'));
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
@@ -512,11 +509,11 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// {@macro dart.ui.sceneBuilder.oldLayerVsRetained}
|
||||
///
|
||||
/// See [pop] for details about the operation stack.
|
||||
ShaderMaskEngineLayer/*?*/ pushShaderMask(
|
||||
Shader/*!*/ shader,
|
||||
Rect/*!*/ maskRect,
|
||||
BlendMode/*!*/ blendMode, {
|
||||
ShaderMaskEngineLayer/*?*/ oldLayer,
|
||||
ShaderMaskEngineLayer? pushShaderMask(
|
||||
Shader shader,
|
||||
Rect maskRect,
|
||||
BlendMode blendMode, {
|
||||
ShaderMaskEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushShaderMask'));
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
@@ -560,13 +557,13 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
///
|
||||
/// See [pop] for details about the operation stack, and [Clip] for different clip modes.
|
||||
// ignore: deprecated_member_use
|
||||
PhysicalShapeEngineLayer/*?*/ pushPhysicalShape({
|
||||
Path/*!*/ path,
|
||||
double/*!*/ elevation,
|
||||
Color/*!*/ color,
|
||||
Color/*?*/ shadowColor,
|
||||
Clip/*!*/ clipBehavior = Clip.none,
|
||||
PhysicalShapeEngineLayer/*?*/ oldLayer,
|
||||
PhysicalShapeEngineLayer? pushPhysicalShape({
|
||||
required Path path,
|
||||
required double elevation,
|
||||
required Color color,
|
||||
Color? shadowColor,
|
||||
Clip clipBehavior = Clip.none,
|
||||
PhysicalShapeEngineLayer? oldLayer,
|
||||
}) {
|
||||
assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushPhysicalShape'));
|
||||
final EngineLayer engineLayer = EngineLayer._();
|
||||
@@ -611,7 +608,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// no need to call [addToScene] for its children layers.
|
||||
///
|
||||
/// {@macro dart.ui.sceneBuilder.oldLayerVsRetained}
|
||||
void addRetained(EngineLayer/*!*/ retainedLayer) {
|
||||
void addRetained(EngineLayer retainedLayer) {
|
||||
assert(retainedLayer is _EngineLayerWrapper);
|
||||
assert(() {
|
||||
final _EngineLayerWrapper layer = retainedLayer as _EngineLayerWrapper;
|
||||
@@ -620,11 +617,11 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
_debugCheckUsedOnce(parentLayer, 'retained layer');
|
||||
parentLayer._debugCheckNotUsedAsOldLayer();
|
||||
|
||||
if (parentLayer._debugChildren == null || parentLayer._debugChildren.isEmpty) {
|
||||
final List<_EngineLayerWrapper>? children = parentLayer._debugChildren;
|
||||
if (children == null || children.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
parentLayer._debugChildren.forEach(recursivelyCheckChildrenUsedOnce);
|
||||
children.forEach(recursivelyCheckChildrenUsedOnce);
|
||||
}
|
||||
|
||||
recursivelyCheckChildrenUsedOnce(layer);
|
||||
@@ -662,7 +659,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// See also the [PerformanceOverlayOption] enum in the rendering library.
|
||||
/// for more details.
|
||||
// Values above must match constants in //engine/src/sky/compositor/performance_overlay_layer.h
|
||||
void addPerformanceOverlay(int/*!*/ enabledOptions, Rect/*!*/ bounds) {
|
||||
void addPerformanceOverlay(int enabledOptions, Rect bounds) {
|
||||
_addPerformanceOverlay(enabledOptions, bounds.left, bounds.right, bounds.top, bounds.bottom);
|
||||
}
|
||||
|
||||
@@ -678,10 +675,10 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
///
|
||||
/// The picture is rasterized at the given offset.
|
||||
void addPicture(
|
||||
Offset/*!*/ offset,
|
||||
Picture/*!*/ picture, {
|
||||
bool/*!*/ isComplexHint = false,
|
||||
bool/*!*/ willChangeHint = false,
|
||||
Offset offset,
|
||||
Picture picture, {
|
||||
bool isComplexHint = false,
|
||||
bool willChangeHint = false,
|
||||
}) {
|
||||
final int hints = (isComplexHint ? 1 : 0) | (willChangeHint ? 2 : 0);
|
||||
_addPicture(offset.dx, offset.dy, picture, hints);
|
||||
@@ -702,13 +699,13 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// texture just before resizing the Android view and un-freezes it when it is
|
||||
/// certain that a frame with the new size is ready.
|
||||
void addTexture(
|
||||
int/*!*/ textureId, {
|
||||
Offset/*!*/ offset = Offset.zero,
|
||||
double/*!*/ width = 0.0,
|
||||
double/*!*/ height = 0.0,
|
||||
bool/*!*/ freeze = false,
|
||||
int textureId, {
|
||||
Offset offset = Offset.zero,
|
||||
double width = 0.0,
|
||||
double height = 0.0,
|
||||
bool freeze = false,
|
||||
}) {
|
||||
assert(offset != null, 'Offset argument was null');
|
||||
assert(offset != null, 'Offset argument was null'); // ignore: unnecessary_null_comparison
|
||||
_addTexture(offset.dx, offset.dy, width, height, textureId, freeze);
|
||||
}
|
||||
|
||||
@@ -732,12 +729,12 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// embedded UIView. In addition to that, on iOS versions greater than 9, the Flutter frames are
|
||||
/// synchronized with the UIView frames adding additional performance overhead.
|
||||
void addPlatformView(
|
||||
int/*!*/ viewId, {
|
||||
Offset/*!*/ offset = Offset.zero,
|
||||
double/*!*/ width = 0.0,
|
||||
double/*!*/ height = 0.0,
|
||||
int viewId, {
|
||||
Offset offset = Offset.zero,
|
||||
double width = 0.0,
|
||||
double height = 0.0,
|
||||
}) {
|
||||
assert(offset != null, 'Offset argument was null');
|
||||
assert(offset != null, 'Offset argument was null'); // ignore: unnecessary_null_comparison
|
||||
_addPlatformView(offset.dx, offset.dy, width, height, viewId);
|
||||
}
|
||||
|
||||
@@ -747,11 +744,11 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// (Fuchsia-only) Adds a scene rendered by another application to the scene
|
||||
/// for this application.
|
||||
void addChildScene({
|
||||
Offset/*!*/ offset = Offset.zero,
|
||||
double/*!*/ width = 0.0,
|
||||
double/*!*/ height = 0.0,
|
||||
SceneHost/*!*/ sceneHost,
|
||||
bool/*!*/ hitTestable = true,
|
||||
Offset offset = Offset.zero,
|
||||
double width = 0.0,
|
||||
double height = 0.0,
|
||||
required SceneHost sceneHost,
|
||||
bool hitTestable = true,
|
||||
}) {
|
||||
_addChildScene(offset.dx, offset.dy, width, height, sceneHost, hitTestable);
|
||||
}
|
||||
@@ -765,7 +762,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// interested in using this feature, please contact [flutter-dev](https://groups.google.com/forum/#!forum/flutter-dev).
|
||||
/// We'll hopefully be able to figure out how to make this feature more useful
|
||||
/// to you.
|
||||
void setRasterizerTracingThreshold(int/*!*/ frameInterval)
|
||||
void setRasterizerTracingThreshold(int frameInterval)
|
||||
native 'SceneBuilder_setRasterizerTracingThreshold';
|
||||
|
||||
/// Sets whether the raster cache should checkerboard cached entries. This is
|
||||
@@ -783,14 +780,14 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
///
|
||||
/// Currently this interface is difficult to use by end-developers. If you're
|
||||
/// interested in using this feature, please contact [flutter-dev](https://groups.google.com/forum/#!forum/flutter-dev).
|
||||
void setCheckerboardRasterCacheImages(bool/*!*/ checkerboard)
|
||||
void setCheckerboardRasterCacheImages(bool checkerboard)
|
||||
native 'SceneBuilder_setCheckerboardRasterCacheImages';
|
||||
|
||||
/// Sets whether the compositor should checkerboard layers that are rendered
|
||||
/// to offscreen bitmaps.
|
||||
///
|
||||
/// This is only useful for debugging purposes.
|
||||
void setCheckerboardOffscreenLayers(bool/*!*/ checkerboard)
|
||||
void setCheckerboardOffscreenLayers(bool checkerboard)
|
||||
native 'SceneBuilder_setCheckerboardOffscreenLayers';
|
||||
|
||||
/// Finishes building the scene.
|
||||
@@ -801,7 +798,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
///
|
||||
/// After calling this function, the scene builder object is invalid and
|
||||
/// cannot be used further.
|
||||
Scene/*!*/ build() {
|
||||
Scene build() {
|
||||
final Scene scene = Scene._();
|
||||
_build(scene);
|
||||
return scene;
|
||||
@@ -825,9 +822,9 @@ class SceneHost extends NativeFieldWrapperClass2 {
|
||||
/// The SceneHost takes ownership of the provided ViewHolder token.
|
||||
SceneHost(
|
||||
dynamic viewHolderToken,
|
||||
void Function()/*?*/ viewConnectedCallback,
|
||||
void Function()/*?*/ viewDisconnectedCallback,
|
||||
void Function(bool/*!*/)/*?*/ viewStateChangedCallback,
|
||||
void Function()? viewConnectedCallback,
|
||||
void Function()? viewDisconnectedCallback,
|
||||
void Function(bool)? viewStateChangedCallback,
|
||||
) {
|
||||
_constructor(
|
||||
viewHolderToken, viewConnectedCallback, viewDisconnectedCallback, viewStateChangedCallback);
|
||||
@@ -835,9 +832,9 @@ class SceneHost extends NativeFieldWrapperClass2 {
|
||||
|
||||
void _constructor(
|
||||
dynamic viewHolderToken,
|
||||
void Function() viewConnectedCallback,
|
||||
void Function() viewDisconnectedCallback,
|
||||
void Function(bool) viewStateChangedCallbac,
|
||||
void Function()? viewConnectedCallback,
|
||||
void Function()? viewDisconnectedCallback,
|
||||
void Function(bool)? viewStateChangedCallbac,
|
||||
) native 'SceneHost_constructor';
|
||||
|
||||
/// Releases the resources associated with the SceneHost.
|
||||
@@ -848,12 +845,12 @@ class SceneHost extends NativeFieldWrapperClass2 {
|
||||
/// Set properties on the linked scene. These properties include its bounds,
|
||||
/// as well as whether it can be the target of focus events or not.
|
||||
void setProperties(
|
||||
double/*!*/ width,
|
||||
double/*!*/ height,
|
||||
double/*!*/ insetTop,
|
||||
double/*!*/ insetRight,
|
||||
double/*!*/ insetBottom,
|
||||
double/*!*/ insetLeft,
|
||||
bool/*!*/ focusable,
|
||||
double width,
|
||||
double height,
|
||||
double insetTop,
|
||||
double insetRight,
|
||||
double insetBottom,
|
||||
double insetLeft,
|
||||
bool focusable,
|
||||
) native 'SceneHost_setProperties';
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
class _HashEnd { const _HashEnd(); }
|
||||
@@ -12,7 +13,7 @@ const _HashEnd _hashEnd = _HashEnd();
|
||||
//
|
||||
// Borrowed from the dart sdk: sdk/lib/math/jenkins_smi_hash.dart.
|
||||
class _Jenkins {
|
||||
static int combine(int hash, Object o) {
|
||||
static int combine(int hash, Object? o) {
|
||||
assert(o is! Iterable);
|
||||
hash = 0x1fffffff & (hash + o.hashCode);
|
||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
||||
@@ -40,14 +41,14 @@ class _Jenkins {
|
||||
/// ```dart
|
||||
/// int hashCode => hashValues(foo, bar, hashList(quux), baz);
|
||||
/// ```
|
||||
int/*!*/ hashValues(
|
||||
Object/*?*/ arg01, Object/*?*/ arg02, [ Object/*?*/ arg03 = _hashEnd,
|
||||
Object/*?*/ arg04 = _hashEnd, Object/*?*/ arg05 = _hashEnd, Object/*?*/ arg06 = _hashEnd,
|
||||
Object/*?*/ arg07 = _hashEnd, Object/*?*/ arg08 = _hashEnd, Object/*?*/ arg09 = _hashEnd,
|
||||
Object/*?*/ arg10 = _hashEnd, Object/*?*/ arg11 = _hashEnd, Object/*?*/ arg12 = _hashEnd,
|
||||
Object/*?*/ arg13 = _hashEnd, Object/*?*/ arg14 = _hashEnd, Object/*?*/ arg15 = _hashEnd,
|
||||
Object/*?*/ arg16 = _hashEnd, Object/*?*/ arg17 = _hashEnd, Object/*?*/ arg18 = _hashEnd,
|
||||
Object/*?*/ arg19 = _hashEnd, Object/*?*/ arg20 = _hashEnd ]) {
|
||||
int hashValues(
|
||||
Object? arg01, Object? arg02, [ Object? arg03 = _hashEnd,
|
||||
Object? arg04 = _hashEnd, Object? arg05 = _hashEnd, Object? arg06 = _hashEnd,
|
||||
Object? arg07 = _hashEnd, Object? arg08 = _hashEnd, Object? arg09 = _hashEnd,
|
||||
Object? arg10 = _hashEnd, Object? arg11 = _hashEnd, Object? arg12 = _hashEnd,
|
||||
Object? arg13 = _hashEnd, Object? arg14 = _hashEnd, Object? arg15 = _hashEnd,
|
||||
Object? arg16 = _hashEnd, Object? arg17 = _hashEnd, Object? arg18 = _hashEnd,
|
||||
Object? arg19 = _hashEnd, Object? arg20 = _hashEnd ]) {
|
||||
int result = 0;
|
||||
result = _Jenkins.combine(result, arg01);
|
||||
result = _Jenkins.combine(result, arg02);
|
||||
@@ -112,10 +113,10 @@ int/*!*/ hashValues(
|
||||
/// Combine the [Object.hashCode] values of an arbitrary number of objects from
|
||||
/// an [Iterable] into one value. This function will return the same value if
|
||||
/// given null as if given an empty list.
|
||||
int/*!*/ hashList(Iterable<Object/*?*/>/*?*/ arguments) {
|
||||
int hashList(Iterable<Object?>? arguments) {
|
||||
int result = 0;
|
||||
if (arguments != null) {
|
||||
for (Object argument in arguments)
|
||||
for (Object? argument in arguments)
|
||||
result = _Jenkins.combine(result, argument);
|
||||
}
|
||||
return _Jenkins.finish(result);
|
||||
|
||||
@@ -4,28 +4,29 @@
|
||||
|
||||
// TODO(dnfield): Remove unused_import ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _updateWindowMetrics(
|
||||
double/*!*/ devicePixelRatio,
|
||||
double/*!*/ width,
|
||||
double/*!*/ height,
|
||||
double/*!*/ depth,
|
||||
double/*!*/ viewPaddingTop,
|
||||
double/*!*/ viewPaddingRight,
|
||||
double/*!*/ viewPaddingBottom,
|
||||
double/*!*/ viewPaddingLeft,
|
||||
double/*!*/ viewInsetTop,
|
||||
double/*!*/ viewInsetRight,
|
||||
double/*!*/ viewInsetBottom,
|
||||
double/*!*/ viewInsetLeft,
|
||||
double/*!*/ systemGestureInsetTop,
|
||||
double/*!*/ systemGestureInsetRight,
|
||||
double/*!*/ systemGestureInsetBottom,
|
||||
double/*!*/ systemGestureInsetLeft,
|
||||
double devicePixelRatio,
|
||||
double width,
|
||||
double height,
|
||||
double depth,
|
||||
double viewPaddingTop,
|
||||
double viewPaddingRight,
|
||||
double viewPaddingBottom,
|
||||
double viewPaddingLeft,
|
||||
double viewInsetTop,
|
||||
double viewInsetRight,
|
||||
double viewInsetBottom,
|
||||
double viewInsetLeft,
|
||||
double systemGestureInsetTop,
|
||||
double systemGestureInsetRight,
|
||||
double systemGestureInsetBottom,
|
||||
double systemGestureInsetLeft,
|
||||
) {
|
||||
window
|
||||
.._devicePixelRatio = devicePixelRatio
|
||||
@@ -54,9 +55,9 @@ void _updateWindowMetrics(
|
||||
_invoke(window.onMetricsChanged, window._onMetricsChangedZone);
|
||||
}
|
||||
|
||||
typedef _LocaleClosure = String/*?*/ Function();
|
||||
typedef _LocaleClosure = String? Function();
|
||||
|
||||
String/*?*/ _localeClosure() {
|
||||
String? _localeClosure() {
|
||||
if (window.locale == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -65,30 +66,31 @@ String/*?*/ _localeClosure() {
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
_LocaleClosure/*?*/ _getLocaleClosure() => _localeClosure;
|
||||
_LocaleClosure? _getLocaleClosure() => _localeClosure;
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _updateLocales(List<String/*!*/>/*!*/ locales) {
|
||||
void _updateLocales(List<String> locales) {
|
||||
const int stringsPerLocale = 4;
|
||||
final int numLocales = locales.length ~/ stringsPerLocale;
|
||||
window._locales = List<Locale>(numLocales);
|
||||
final List<Locale> newLocales = <Locale>[];
|
||||
for (int localeIndex = 0; localeIndex < numLocales; localeIndex++) {
|
||||
final String countryCode = locales[localeIndex * stringsPerLocale + 1];
|
||||
final String scriptCode = locales[localeIndex * stringsPerLocale + 2];
|
||||
|
||||
window._locales[localeIndex] = Locale.fromSubtags(
|
||||
newLocales.add(Locale.fromSubtags(
|
||||
languageCode: locales[localeIndex * stringsPerLocale],
|
||||
countryCode: countryCode.isEmpty ? null : countryCode,
|
||||
scriptCode: scriptCode.isEmpty ? null : scriptCode,
|
||||
);
|
||||
));
|
||||
}
|
||||
window._locales = newLocales;
|
||||
_invoke(window.onLocaleChanged, window._onLocaleChangedZone);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _updatePlatformResolvedLocale(List<String/*!*/>/*!*/ localeData) {
|
||||
void _updatePlatformResolvedLocale(List<String> localeData) {
|
||||
if (localeData.length != 4) {
|
||||
return;
|
||||
}
|
||||
@@ -104,7 +106,7 @@ void _updatePlatformResolvedLocale(List<String/*!*/>/*!*/ localeData) {
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _updateUserSettingsData(String/*!*/ jsonData) {
|
||||
void _updateUserSettingsData(String jsonData) {
|
||||
final Map<String, dynamic> data = json.decode(jsonData) as Map<String, dynamic>;
|
||||
if (data.isEmpty) {
|
||||
return;
|
||||
@@ -116,7 +118,7 @@ void _updateUserSettingsData(String/*!*/ jsonData) {
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _updateLifecycleState(String/*!*/ state) {
|
||||
void _updateLifecycleState(String state) {
|
||||
// We do not update the state if the state has already been used to initialize
|
||||
// the lifecycleState.
|
||||
if (!window._initialLifecycleStateAccessed)
|
||||
@@ -124,30 +126,30 @@ void _updateLifecycleState(String/*!*/ state) {
|
||||
}
|
||||
|
||||
|
||||
void _updateTextScaleFactor(double/*!*/ textScaleFactor) {
|
||||
void _updateTextScaleFactor(double textScaleFactor) {
|
||||
window._textScaleFactor = textScaleFactor;
|
||||
_invoke(window.onTextScaleFactorChanged, window._onTextScaleFactorChangedZone);
|
||||
}
|
||||
|
||||
void _updateAlwaysUse24HourFormat(bool/*!*/ alwaysUse24HourFormat) {
|
||||
void _updateAlwaysUse24HourFormat(bool alwaysUse24HourFormat) {
|
||||
window._alwaysUse24HourFormat = alwaysUse24HourFormat;
|
||||
}
|
||||
|
||||
void _updatePlatformBrightness(String/*!*/ brightnessName) {
|
||||
void _updatePlatformBrightness(String brightnessName) {
|
||||
window._platformBrightness = brightnessName == 'dark' ? Brightness.dark : Brightness.light;
|
||||
_invoke(window.onPlatformBrightnessChanged, window._onPlatformBrightnessChangedZone);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _updateSemanticsEnabled(bool/*!*/ enabled) {
|
||||
void _updateSemanticsEnabled(bool enabled) {
|
||||
window._semanticsEnabled = enabled;
|
||||
_invoke(window.onSemanticsEnabledChanged, window._onSemanticsEnabledChangedZone);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _updateAccessibilityFeatures(int/*!*/ values) {
|
||||
void _updateAccessibilityFeatures(int values) {
|
||||
final AccessibilityFeatures newFeatures = AccessibilityFeatures._(values);
|
||||
if (newFeatures == window._accessibilityFeatures)
|
||||
return;
|
||||
@@ -157,27 +159,27 @@ void _updateAccessibilityFeatures(int/*!*/ values) {
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _dispatchPlatformMessage(String/*!*/ name, ByteData/*?*/ data, int/*!*/ responseId) {
|
||||
void _dispatchPlatformMessage(String name, ByteData? data, int responseId) {
|
||||
if (name == ChannelBuffers.kControlChannelName) {
|
||||
try {
|
||||
channelBuffers.handleMessage(data);
|
||||
channelBuffers.handleMessage(data!);
|
||||
} catch (ex) {
|
||||
_printDebug('Message to "$name" caused exception $ex');
|
||||
} finally {
|
||||
window._respondToPlatformMessage(responseId, null);
|
||||
}
|
||||
} else if (window.onPlatformMessage != null) {
|
||||
_invoke3<String, ByteData, PlatformMessageResponseCallback>(
|
||||
_invoke3<String, ByteData?, PlatformMessageResponseCallback>(
|
||||
window.onPlatformMessage,
|
||||
window._onPlatformMessageZone,
|
||||
name,
|
||||
data,
|
||||
(ByteData responseData) {
|
||||
(ByteData? responseData) {
|
||||
window._respondToPlatformMessage(responseId, responseData);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
channelBuffers.push(name, data, (ByteData responseData) {
|
||||
channelBuffers.push(name, data, (ByteData? responseData) {
|
||||
window._respondToPlatformMessage(responseId, responseData);
|
||||
});
|
||||
}
|
||||
@@ -185,32 +187,32 @@ void _dispatchPlatformMessage(String/*!*/ name, ByteData/*?*/ data, int/*!*/ res
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _dispatchPointerDataPacket(ByteData/*!*/ packet) {
|
||||
void _dispatchPointerDataPacket(ByteData packet) {
|
||||
if (window.onPointerDataPacket != null)
|
||||
_invoke1<PointerDataPacket>(window.onPointerDataPacket, window._onPointerDataPacketZone, _unpackPointerDataPacket(packet));
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _dispatchSemanticsAction(int/*!*/ id, int/*!*/ action, ByteData/*?*/ args) {
|
||||
_invoke3<int, SemanticsAction, ByteData>(
|
||||
void _dispatchSemanticsAction(int id, int action, ByteData? args) {
|
||||
_invoke3<int, SemanticsAction, ByteData?>(
|
||||
window.onSemanticsAction,
|
||||
window._onSemanticsActionZone,
|
||||
id,
|
||||
SemanticsAction.values[action],
|
||||
SemanticsAction.values[action]!,
|
||||
args,
|
||||
);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _beginFrame(int/*!*/ microseconds) {
|
||||
void _beginFrame(int microseconds) {
|
||||
_invoke1<Duration>(window.onBeginFrame, window._onBeginFrameZone, Duration(microseconds: microseconds));
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _reportTimings(List<int/*!*/>/*!*/ timings) {
|
||||
void _reportTimings(List<int> timings) {
|
||||
assert(timings.length % FramePhase.values.length == 0);
|
||||
final List<FrameTiming> frameTimings = <FrameTiming>[];
|
||||
for (int i = 0; i < timings.length; i += FramePhase.values.length) {
|
||||
@@ -226,15 +228,15 @@ void _drawFrame() {
|
||||
}
|
||||
|
||||
// ignore: always_declare_return_types, prefer_generic_function_type_aliases
|
||||
typedef _UnaryFunction(Null/*!*/ args);
|
||||
typedef _UnaryFunction(Null args);
|
||||
// ignore: always_declare_return_types, prefer_generic_function_type_aliases
|
||||
typedef _BinaryFunction(Null/*!*/ args, Null/*!*/ message);
|
||||
typedef _BinaryFunction(Null args, Null message);
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
// ignore: unused_element
|
||||
void _runMainZoned(Function/*!*/ startMainIsolateFunction,
|
||||
Function/*!*/ userMainFunction,
|
||||
List<String/*!*/>/*!*/ args) {
|
||||
void _runMainZoned(Function startMainIsolateFunction,
|
||||
Function userMainFunction,
|
||||
List<String> args) {
|
||||
startMainIsolateFunction((){
|
||||
runZonedGuarded<void>(() {
|
||||
if (userMainFunction is _BinaryFunction) {
|
||||
@@ -252,14 +254,14 @@ void _runMainZoned(Function/*!*/ startMainIsolateFunction,
|
||||
}, null);
|
||||
}
|
||||
|
||||
void _reportUnhandledException(String/*!*/ error, String/*!*/ stackTrace) native 'Window_reportUnhandledException';
|
||||
void _reportUnhandledException(String error, String stackTrace) native 'Window_reportUnhandledException';
|
||||
|
||||
/// Invokes [callback] inside the given [zone].
|
||||
void _invoke(void callback()/*?*/, Zone/*!*/ zone) {
|
||||
void _invoke(void callback()?, Zone zone) {
|
||||
if (callback == null)
|
||||
return;
|
||||
|
||||
assert(zone != null);
|
||||
assert(zone != null); // ignore: unnecessary_null_comparison
|
||||
|
||||
if (identical(zone, Zone.current)) {
|
||||
callback();
|
||||
@@ -269,11 +271,11 @@ void _invoke(void callback()/*?*/, Zone/*!*/ zone) {
|
||||
}
|
||||
|
||||
/// Invokes [callback] inside the given [zone] passing it [arg].
|
||||
void _invoke1<A>(void callback(A a)/*?*/, Zone/*!*/ zone, A arg) {
|
||||
void _invoke1<A>(void callback(A a)?, Zone zone, A arg) {
|
||||
if (callback == null)
|
||||
return;
|
||||
|
||||
assert(zone != null);
|
||||
assert(zone != null); // ignore: unnecessary_null_comparison
|
||||
|
||||
if (identical(zone, Zone.current)) {
|
||||
callback(arg);
|
||||
@@ -283,11 +285,11 @@ void _invoke1<A>(void callback(A a)/*?*/, Zone/*!*/ zone, A arg) {
|
||||
}
|
||||
|
||||
/// Invokes [callback] inside the given [zone] passing it [arg1], [arg2], and [arg3].
|
||||
void _invoke3<A1, A2, A3>(void callback(A1 a1, A2 a2, A3 a3)/*?*/, Zone/*!*/ zone, A1 arg1, A2 arg2, A3 arg3) {
|
||||
void _invoke3<A1, A2, A3>(void callback(A1 a1, A2 a2, A3 a3)?, Zone zone, A1 arg1, A2 arg2, A3 arg3) {
|
||||
if (callback == null)
|
||||
return;
|
||||
|
||||
assert(zone != null);
|
||||
assert(zone != null); // ignore: unnecessary_null_comparison
|
||||
|
||||
if (identical(zone, Zone.current)) {
|
||||
callback(arg1, arg2, arg3);
|
||||
@@ -305,15 +307,15 @@ void _invoke3<A1, A2, A3>(void callback(A1 a1, A2 a2, A3 a3)/*?*/, Zone/*!*/ zon
|
||||
// * AndroidTouchProcessor.java
|
||||
const int _kPointerDataFieldCount = 28;
|
||||
|
||||
PointerDataPacket/*!*/ _unpackPointerDataPacket(ByteData/*!*/ packet) {
|
||||
PointerDataPacket _unpackPointerDataPacket(ByteData packet) {
|
||||
const int kStride = Int64List.bytesPerElement;
|
||||
const int kBytesPerPointerData = _kPointerDataFieldCount * kStride;
|
||||
final int length = packet.lengthInBytes ~/ kBytesPerPointerData;
|
||||
assert(length * kBytesPerPointerData == packet.lengthInBytes);
|
||||
final List<PointerData> data = List<PointerData>(length);
|
||||
final List<PointerData> data = <PointerData>[];
|
||||
for (int i = 0; i < length; ++i) {
|
||||
int offset = i * _kPointerDataFieldCount;
|
||||
data[i] = PointerData(
|
||||
data.add(PointerData(
|
||||
timeStamp: Duration(microseconds: packet.getInt64(kStride * offset++, _kFakeHostEndian)),
|
||||
change: PointerChange.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)],
|
||||
kind: PointerDeviceKind.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)],
|
||||
@@ -342,7 +344,7 @@ PointerDataPacket/*!*/ _unpackPointerDataPacket(ByteData/*!*/ packet) {
|
||||
platformData: packet.getInt64(kStride * offset++, _kFakeHostEndian),
|
||||
scrollDeltaX: packet.getFloat64(kStride * offset++, _kFakeHostEndian),
|
||||
scrollDeltaY: packet.getFloat64(kStride * offset++, _kFakeHostEndian)
|
||||
);
|
||||
));
|
||||
assert(offset == (i + 1) * _kPointerDataFieldCount);
|
||||
}
|
||||
return PointerDataPacket(data: data);
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
/// Static methods to allow for simple sharing of [SendPort]s across [Isolate]s.
|
||||
@@ -31,8 +32,8 @@ class IsolateNameServer {
|
||||
/// place, consider [registerPortWithName].
|
||||
///
|
||||
/// The `name` argument must not be null.
|
||||
static SendPort/*?*/ lookupPortByName(String/*!*/ name) {
|
||||
assert(name != null, "'name' cannot be null.");
|
||||
static SendPort? lookupPortByName(String name) {
|
||||
assert(name != null, "'name' cannot be null."); // ignore: unnecessary_null_comparison
|
||||
return _lookupPortByName(name);
|
||||
}
|
||||
|
||||
@@ -49,9 +50,9 @@ class IsolateNameServer {
|
||||
/// name, as there is an inherent race condition in doing so.
|
||||
///
|
||||
/// The `port` and `name` arguments must not be null.
|
||||
static bool/*!*/ registerPortWithName(SendPort port, String name) {
|
||||
assert(port != null, "'port' cannot be null.");
|
||||
assert(name != null, "'name' cannot be null.");
|
||||
static bool registerPortWithName(SendPort port, String name) {
|
||||
assert(port != null, "'port' cannot be null."); // ignore: unnecessary_null_comparison
|
||||
assert(name != null, "'name' cannot be null."); // ignore: unnecessary_null_comparison
|
||||
return _registerPortWithName(port, name);
|
||||
}
|
||||
|
||||
@@ -66,15 +67,15 @@ class IsolateNameServer {
|
||||
/// after it has been removed).
|
||||
///
|
||||
/// The `name` argument must not be null.
|
||||
static bool/*!*/ removePortNameMapping(String name) {
|
||||
assert(name != null, "'name' cannot be null.");
|
||||
static bool removePortNameMapping(String name) {
|
||||
assert(name != null, "'name' cannot be null."); // ignore: unnecessary_null_comparison
|
||||
return _removePortNameMapping(name);
|
||||
}
|
||||
|
||||
static SendPort/*?*/ _lookupPortByName(String name)
|
||||
static SendPort? _lookupPortByName(String name)
|
||||
native 'IsolateNameServerNatives_LookupPortByName';
|
||||
static bool/*!*/ _registerPortWithName(SendPort port, String name)
|
||||
static bool _registerPortWithName(SendPort port, String name)
|
||||
native 'IsolateNameServerNatives_RegisterPortWithName';
|
||||
static bool/*!*/ _removePortNameMapping(String name)
|
||||
static bool _removePortNameMapping(String name)
|
||||
native 'IsolateNameServerNatives_RemovePortNameMapping';
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
/// Linearly interpolate between two numbers.
|
||||
double/*!*/ lerpDouble(num/*?*/ a, num/*?*/ b, double/*!*/ t) {
|
||||
double? lerpDouble(num? a, num? b, double t) {
|
||||
if (a == null && b == null)
|
||||
return null;
|
||||
a ??= 0.0;
|
||||
@@ -17,19 +18,19 @@ double/*!*/ lerpDouble(num/*?*/ a, num/*?*/ b, double/*!*/ t) {
|
||||
/// Linearly interpolate between two doubles.
|
||||
///
|
||||
/// Same as [lerpDouble] but specialized for non-null `double` type.
|
||||
double/*!*/ _lerpDouble(double/*!*/ a, double/*!*/ b, double/*!*/ t) {
|
||||
double _lerpDouble(double a, double b, double t) {
|
||||
return a + (b - a) * t;
|
||||
}
|
||||
|
||||
/// Linearly interpolate between two integers.
|
||||
///
|
||||
/// Same as [lerpDouble] but specialized for non-null `int` type.
|
||||
double/*!*/ _lerpInt(int/*!*/ a, int/*!*/ b, double/*!*/ t) {
|
||||
double _lerpInt(int a, int b, double t) {
|
||||
return a + (b - a) * t;
|
||||
}
|
||||
|
||||
/// Same as [num.clamp] but specialized for non-null [int].
|
||||
int/*!*/ _clampInt(int/*!*/ value, int/*!*/ min, int/*!*/ max) {
|
||||
int _clampInt(int value, int min, int max) {
|
||||
assert(min <= max);
|
||||
if (value < min) {
|
||||
return min;
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
// TODO(dnfield): remove unused_element ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
// Corelib 'print' implementation.
|
||||
@@ -17,8 +18,8 @@ void _printDebug(dynamic arg) {
|
||||
}
|
||||
|
||||
class _Logger {
|
||||
static void _printString(String/*?*/ s) native 'Logger_PrintString';
|
||||
static void _printDebugString(String/*?*/ s) native 'Logger_PrintDebugString';
|
||||
static void _printString(String? s) native 'Logger_PrintString';
|
||||
static void _printDebugString(String? s) native 'Logger_PrintDebugString';
|
||||
}
|
||||
|
||||
// If we actually run on big endian machines, we'll need to do something smarter
|
||||
@@ -68,7 +69,7 @@ void _setupHooks() { // ignore: unused_element
|
||||
/// ```
|
||||
///
|
||||
/// This function is only effective in debug and dynamic modes, and will throw in AOT mode.
|
||||
List<int/*!*/>/*!*/ saveCompilationTrace() {
|
||||
List<int> saveCompilationTrace() {
|
||||
final dynamic result = _saveCompilationTrace();
|
||||
if (result is Error)
|
||||
throw result;
|
||||
@@ -79,11 +80,11 @@ dynamic _saveCompilationTrace() native 'SaveCompilationTrace';
|
||||
|
||||
void _scheduleMicrotask(void callback()) native 'ScheduleMicrotask';
|
||||
|
||||
int/*?*/ _getCallbackHandle(Function closure) native 'GetCallbackHandle';
|
||||
Function/*?*/ _getCallbackFromHandle(int handle) native 'GetCallbackFromHandle';
|
||||
int? _getCallbackHandle(Function closure) native 'GetCallbackHandle';
|
||||
Function? _getCallbackFromHandle(int handle) native 'GetCallbackFromHandle';
|
||||
|
||||
// Required for gen_snapshot to work correctly.
|
||||
int/*?*/ _isolateId; // ignore: unused_element
|
||||
int? _isolateId; // ignore: unused_element
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
Function _getPrintClosure() => _print; // ignore: unused_element
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
/// A wrapper for a raw callback handle.
|
||||
@@ -14,13 +15,13 @@ class CallbackHandle {
|
||||
/// Only values produced by a call to [CallbackHandle.toRawHandle] should be
|
||||
/// used, otherwise this object will be an invalid handle.
|
||||
CallbackHandle.fromRawHandle(this._handle)
|
||||
: assert(_handle != null, "'_handle' must not be null.");
|
||||
: assert(_handle != null, "'_handle' must not be null."); // ignore: unnecessary_null_comparison
|
||||
|
||||
final int/*!*/ _handle;
|
||||
final int _handle;
|
||||
|
||||
/// Get the raw callback handle to pass over a [MethodChannel] or [SendPort]
|
||||
/// (to pass to another [Isolate]).
|
||||
int/*!*/ toRawHandle() => _handle;
|
||||
int toRawHandle() => _handle;
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
@@ -45,10 +46,10 @@ class PluginUtilities {
|
||||
// extended directly.
|
||||
factory PluginUtilities._() => throw UnsupportedError('Namespace');
|
||||
|
||||
static Map<Function/*!*/, CallbackHandle/*?*/>/*!*/ _forwardCache =
|
||||
<Function/*!*/, CallbackHandle/*?*/>{};
|
||||
static Map<CallbackHandle/*!*/, Function/*?*/>/*!*/ _backwardCache =
|
||||
<CallbackHandle/*!*/, Function/*?*/>{};
|
||||
static Map<Function, CallbackHandle?> _forwardCache =
|
||||
<Function, CallbackHandle?>{};
|
||||
static Map<CallbackHandle, Function?> _backwardCache =
|
||||
<CallbackHandle, Function?>{};
|
||||
|
||||
/// Get a handle to a named top-level or static callback function which can
|
||||
/// be easily passed between isolates.
|
||||
@@ -59,10 +60,10 @@ class PluginUtilities {
|
||||
/// [PluginUtilities.getCallbackFromHandle] to retrieve a tear-off of the
|
||||
/// original callback. If `callback` is not a top-level or static function,
|
||||
/// null is returned.
|
||||
static CallbackHandle/*?*/ getCallbackHandle(Function/*!*/ callback) {
|
||||
assert(callback != null, "'callback' must not be null.");
|
||||
static CallbackHandle? getCallbackHandle(Function callback) {
|
||||
assert(callback != null, "'callback' must not be null."); // ignore: unnecessary_null_comparison
|
||||
return _forwardCache.putIfAbsent(callback, () {
|
||||
final int/*?*/ handle = _getCallbackHandle(callback);
|
||||
final int? handle = _getCallbackHandle(callback);
|
||||
return handle != null ? CallbackHandle.fromRawHandle(handle) : null;
|
||||
});
|
||||
}
|
||||
@@ -75,8 +76,8 @@ class PluginUtilities {
|
||||
/// If `handle` is not a valid handle returned by
|
||||
/// [PluginUtilities.getCallbackHandle], null is returned. Otherwise, a
|
||||
/// tear-off of the callback associated with `handle` is returned.
|
||||
static Function/*?*/ getCallbackFromHandle(CallbackHandle/*!*/ handle) {
|
||||
assert(handle != null, "'handle' must not be null.");
|
||||
static Function? getCallbackFromHandle(CallbackHandle handle) {
|
||||
assert(handle != null, "'handle' must not be null."); // ignore: unnecessary_null_comparison
|
||||
return _backwardCache.putIfAbsent(
|
||||
handle, () => _getCallbackFromHandle(handle.toRawHandle()));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
/// How the pointer has changed since the last report.
|
||||
@@ -102,50 +103,50 @@ class PointerData {
|
||||
});
|
||||
|
||||
/// Time of event dispatch, relative to an arbitrary timeline.
|
||||
final Duration/*!*/ timeStamp;
|
||||
final Duration timeStamp;
|
||||
|
||||
/// How the pointer has changed since the last report.
|
||||
final PointerChange/*!*/ change;
|
||||
final PointerChange change;
|
||||
|
||||
/// The kind of input device for which the event was generated.
|
||||
final PointerDeviceKind/*!*/ kind;
|
||||
final PointerDeviceKind kind;
|
||||
|
||||
/// The kind of signal for a pointer signal event.
|
||||
final PointerSignalKind/*?*/ signalKind;
|
||||
final PointerSignalKind? signalKind;
|
||||
|
||||
/// Unique identifier for the pointing device, reused across interactions.
|
||||
final int/*!*/ device;
|
||||
final int device;
|
||||
|
||||
/// Unique identifier for the pointer.
|
||||
///
|
||||
/// This field changes for each new pointer down event. Framework uses this
|
||||
/// identifier to determine hit test result.
|
||||
final int/*!*/ pointerIdentifier;
|
||||
final int pointerIdentifier;
|
||||
|
||||
/// X coordinate of the position of the pointer, in physical pixels in the
|
||||
/// global coordinate space.
|
||||
final double/*!*/ physicalX;
|
||||
final double physicalX;
|
||||
|
||||
/// Y coordinate of the position of the pointer, in physical pixels in the
|
||||
/// global coordinate space.
|
||||
final double/*!*/ physicalY;
|
||||
final double physicalY;
|
||||
|
||||
/// The distance of pointer movement on X coordinate in physical pixels.
|
||||
final double/*!*/ physicalDeltaX;
|
||||
final double physicalDeltaX;
|
||||
|
||||
/// The distance of pointer movement on Y coordinate in physical pixels.
|
||||
final double/*!*/ physicalDeltaY;
|
||||
final double physicalDeltaY;
|
||||
|
||||
/// Bit field using the *Button constants (primaryMouseButton,
|
||||
/// secondaryStylusButton, etc). For example, if this has the value 6 and the
|
||||
/// [kind] is [PointerDeviceKind.invertedStylus], then this indicates an
|
||||
/// upside-down stylus with both its primary and secondary buttons pressed.
|
||||
final int/*!*/ buttons;
|
||||
final int buttons;
|
||||
|
||||
/// Set if an application from a different security domain is in any way
|
||||
/// obscuring this application's window. (Aspirational; not currently
|
||||
/// implemented.)
|
||||
final bool/*!*/ obscured;
|
||||
final bool obscured;
|
||||
|
||||
/// Set if this pointer data was synthesized by pointer data packet converter.
|
||||
/// pointer data packet converter will synthesize additional pointer datas if
|
||||
@@ -153,34 +154,34 @@ class PointerData {
|
||||
///
|
||||
/// For example, a down pointer data will be synthesized if the converter receives
|
||||
/// a move pointer data while the pointer is not previously down.
|
||||
final bool/*!*/ synthesized;
|
||||
final bool synthesized;
|
||||
|
||||
/// The pressure of the touch as a number ranging from 0.0, indicating a touch
|
||||
/// with no discernible pressure, to 1.0, indicating a touch with "normal"
|
||||
/// pressure, and possibly beyond, indicating a stronger touch. For devices
|
||||
/// that do not detect pressure (e.g. mice), returns 1.0.
|
||||
final double/*!*/ pressure;
|
||||
final double pressure;
|
||||
|
||||
/// The minimum value that [pressure] can return for this pointer. For devices
|
||||
/// that do not detect pressure (e.g. mice), returns 1.0. This will always be
|
||||
/// a number less than or equal to 1.0.
|
||||
final double/*!*/ pressureMin;
|
||||
final double pressureMin;
|
||||
|
||||
/// The maximum value that [pressure] can return for this pointer. For devices
|
||||
/// that do not detect pressure (e.g. mice), returns 1.0. This will always be
|
||||
/// a greater than or equal to 1.0.
|
||||
final double/*!*/ pressureMax;
|
||||
final double pressureMax;
|
||||
|
||||
/// The distance of the detected object from the input surface (e.g. the
|
||||
/// distance of a stylus or finger from a touch screen), in arbitrary units on
|
||||
/// an arbitrary (not necessarily linear) scale. If the pointer is down, this
|
||||
/// is 0.0 by definition.
|
||||
final double/*!*/ distance;
|
||||
final double distance;
|
||||
|
||||
/// The maximum value that a distance can return for this pointer. If this
|
||||
/// input device cannot detect "hover touch" input events, then this will be
|
||||
/// 0.0.
|
||||
final double/*!*/ distanceMax;
|
||||
final double distanceMax;
|
||||
|
||||
/// The area of the screen being pressed, scaled to a value between 0 and 1.
|
||||
/// The value of size can be used to determine fat touch events. This value
|
||||
@@ -188,21 +189,21 @@ class PointerData {
|
||||
/// the range of detectable values. So, for example, the value of 0.1 could
|
||||
/// mean a touch with the tip of the finger, 0.2 a touch with full finger,
|
||||
/// and 0.3 the full palm.
|
||||
final double/*!*/ size;
|
||||
final double size;
|
||||
|
||||
/// The radius of the contact ellipse along the major axis, in logical pixels.
|
||||
final double/*!*/ radiusMajor;
|
||||
final double radiusMajor;
|
||||
|
||||
/// The radius of the contact ellipse along the minor axis, in logical pixels.
|
||||
final double/*!*/ radiusMinor;
|
||||
final double radiusMinor;
|
||||
|
||||
/// The minimum value that could be reported for radiusMajor and radiusMinor
|
||||
/// for this pointer, in logical pixels.
|
||||
final double/*!*/ radiusMin;
|
||||
final double radiusMin;
|
||||
|
||||
/// The minimum value that could be reported for radiusMajor and radiusMinor
|
||||
/// for this pointer, in logical pixels.
|
||||
final double/*!*/ radiusMax;
|
||||
final double radiusMax;
|
||||
|
||||
/// For PointerDeviceKind.touch events:
|
||||
///
|
||||
@@ -229,7 +230,7 @@ class PointerData {
|
||||
/// indicate that the stylus would go down in the negative y-axis direction;
|
||||
/// pi/4 would indicate that the stylus goes up and to the right, -pi/2 would
|
||||
/// indicate that the stylus goes to the left, etc).
|
||||
final double/*!*/ orientation;
|
||||
final double orientation;
|
||||
|
||||
/// For PointerDeviceKind.stylus and PointerDeviceKind.invertedStylus events:
|
||||
///
|
||||
@@ -241,20 +242,20 @@ class PointerData {
|
||||
/// perpendicular to the input surface (thus 0.0 indicates the stylus is
|
||||
/// orthogonal to the plane of the input surface, while pi/2 indicates that
|
||||
/// the stylus is flat on that surface).
|
||||
final double/*!*/ tilt;
|
||||
final double tilt;
|
||||
|
||||
/// Opaque platform-specific data associated with the event.
|
||||
final int/*!*/ platformData;
|
||||
final int platformData;
|
||||
|
||||
/// For events with signalKind of PointerSignalKind.scroll:
|
||||
///
|
||||
/// The amount to scroll in the x direction, in physical pixels.
|
||||
final double/*!*/ scrollDeltaX;
|
||||
final double scrollDeltaX;
|
||||
|
||||
/// For events with signalKind of PointerSignalKind.scroll:
|
||||
///
|
||||
/// The amount to scroll in the y direction, in physical pixels.
|
||||
final double/*!*/ scrollDeltaY;
|
||||
final double scrollDeltaY;
|
||||
|
||||
@override
|
||||
String toString() => 'PointerData(x: $physicalX, y: $physicalY)';
|
||||
@@ -296,10 +297,10 @@ class PointerData {
|
||||
/// A sequence of reports about the state of pointers.
|
||||
class PointerDataPacket {
|
||||
/// Creates a packet of pointer data reports.
|
||||
const PointerDataPacket({ this.data = const <PointerData>[] }) : assert(data != null);
|
||||
const PointerDataPacket({ this.data = const <PointerData>[] }) : assert(data != null); // ignore: unnecessary_null_comparison
|
||||
|
||||
/// Data about the individual pointers in this packet.
|
||||
///
|
||||
/// This list might contain multiple pieces of data about the same pointer.
|
||||
final List<PointerData/*!*/>/*!*/ data;
|
||||
final List<PointerData> data;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
|
||||
part of dart.ui;
|
||||
|
||||
/// The possible actions that can be conveyed from the operating system
|
||||
@@ -12,7 +13,7 @@ part of dart.ui;
|
||||
// `lib/ui/semantics/semantics_node.h` and in each of the embedders *must* be
|
||||
// updated.
|
||||
class SemanticsAction {
|
||||
const SemanticsAction._(this.index) : assert(index != null);
|
||||
const SemanticsAction._(this.index) : assert(index != null); // ignore: unnecessary_null_comparison
|
||||
|
||||
static const int _kTapIndex = 1 << 0;
|
||||
static const int _kLongPressIndex = 1 << 1;
|
||||
@@ -42,7 +43,7 @@ class SemanticsAction {
|
||||
/// The numerical value for this action.
|
||||
///
|
||||
/// Each action has one bit set in this bit field.
|
||||
final int/*!*/ index;
|
||||
final int index;
|
||||
|
||||
/// The equivalent of a user briefly tapping the screen with the finger
|
||||
/// without moving it.
|
||||
@@ -300,12 +301,12 @@ class SemanticsFlag {
|
||||
// READ THIS: if you add a flag here, you MUST update the numSemanticsFlags
|
||||
// value in testing/dart/semantics_test.dart, or tests will fail.
|
||||
|
||||
const SemanticsFlag._(this.index) : assert(index != null);
|
||||
const SemanticsFlag._(this.index) : assert(index != null); // ignore: unnecessary_null_comparison
|
||||
|
||||
/// The numerical value for this flag.
|
||||
///
|
||||
/// Each flag has one bit set in this bit field.
|
||||
final int/*!*/ index;
|
||||
final int index;
|
||||
|
||||
/// The semantics node has the quality of either being "checked" or "unchecked".
|
||||
///
|
||||
@@ -689,35 +690,36 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
|
||||
/// node starts at `elevation` above the parent and ends at `elevation` +
|
||||
/// `thickness` above the parent.
|
||||
void updateNode({
|
||||
/*required*/ int/*!*/ id,
|
||||
/*required*/ int/*!*/ flags,
|
||||
/*required*/ int/*!*/ actions,
|
||||
/*required*/ int/*!*/ maxValueLength,
|
||||
/*required*/ int/*!*/ currentValueLength,
|
||||
/*required*/ int/*!*/ textSelectionBase,
|
||||
/*required*/ int/*!*/ textSelectionExtent,
|
||||
/*required*/ int/*!*/ platformViewId,
|
||||
/*required*/ int/*!*/ scrollChildren,
|
||||
/*required*/ int/*!*/ scrollIndex,
|
||||
/*required*/ double/*!*/ scrollPosition,
|
||||
/*required*/ double/*!*/ scrollExtentMax,
|
||||
/*required*/ double/*!*/ scrollExtentMin,
|
||||
/*required*/ double/*!*/ elevation,
|
||||
/*required*/ double/*!*/ thickness,
|
||||
/*required*/ Rect/*!*/ rect,
|
||||
/*required*/ String/*!*/ label,
|
||||
/*required*/ String/*!*/ hint,
|
||||
/*required*/ String/*!*/ value,
|
||||
/*required*/ String/*!*/ increasedValue,
|
||||
/*required*/ String/*!*/ decreasedValue,
|
||||
TextDirection/*?*/ textDirection,
|
||||
/*required*/ Float64List/*!*/ transform,
|
||||
/*required*/ Int32List/*!*/ childrenInTraversalOrder,
|
||||
/*required*/ Int32List/*!*/ childrenInHitTestOrder,
|
||||
/*required*/ Int32List/*!*/ additionalActions,
|
||||
required int id,
|
||||
required int flags,
|
||||
required int actions,
|
||||
required int maxValueLength,
|
||||
required int currentValueLength,
|
||||
required int textSelectionBase,
|
||||
required int textSelectionExtent,
|
||||
required int platformViewId,
|
||||
required int scrollChildren,
|
||||
required int scrollIndex,
|
||||
required double scrollPosition,
|
||||
required double scrollExtentMax,
|
||||
required double scrollExtentMin,
|
||||
required double elevation,
|
||||
required double thickness,
|
||||
required Rect rect,
|
||||
required String label,
|
||||
required String hint,
|
||||
required String value,
|
||||
required String increasedValue,
|
||||
required String decreasedValue,
|
||||
TextDirection? textDirection,
|
||||
required Float64List transform,
|
||||
required Int32List childrenInTraversalOrder,
|
||||
required Int32List childrenInHitTestOrder,
|
||||
required Int32List additionalActions,
|
||||
}) {
|
||||
assert(_matrix4IsValid(transform));
|
||||
assert(
|
||||
// ignore: unnecessary_null_comparison
|
||||
scrollChildren == 0 || scrollChildren == null || (scrollChildren > 0 && childrenInHitTestOrder != null),
|
||||
'If a node has scrollChildren, it must have childrenInHitTestOrder',
|
||||
);
|
||||
@@ -754,35 +756,35 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
|
||||
);
|
||||
}
|
||||
void _updateNode(
|
||||
int/*!*/ id,
|
||||
int/*!*/ flags,
|
||||
int/*!*/ actions,
|
||||
int/*!*/ maxValueLength,
|
||||
int/*!*/ currentValueLength,
|
||||
int/*!*/ textSelectionBase,
|
||||
int/*!*/ textSelectionExtent,
|
||||
int/*!*/ platformViewId,
|
||||
int/*!*/ scrollChildren,
|
||||
int/*!*/ scrollIndex,
|
||||
double/*!*/ scrollPosition,
|
||||
double/*!*/ scrollExtentMax,
|
||||
double/*!*/ scrollExtentMin,
|
||||
double/*!*/ left,
|
||||
double/*!*/ top,
|
||||
double/*!*/ right,
|
||||
double/*!*/ bottom,
|
||||
double/*!*/ elevation,
|
||||
double/*!*/ thickness,
|
||||
String/*!*/ label,
|
||||
String/*!*/ hint,
|
||||
String/*!*/ value,
|
||||
String/*!*/ increasedValue,
|
||||
String/*!*/ decreasedValue,
|
||||
int/*!*/ textDirection,
|
||||
Float64List/*!*/ transform,
|
||||
Int32List/*!*/ childrenInTraversalOrder,
|
||||
Int32List/*!*/ childrenInHitTestOrder,
|
||||
Int32List/*!*/ additionalActions,
|
||||
int id,
|
||||
int flags,
|
||||
int actions,
|
||||
int maxValueLength,
|
||||
int currentValueLength,
|
||||
int textSelectionBase,
|
||||
int textSelectionExtent,
|
||||
int platformViewId,
|
||||
int scrollChildren,
|
||||
int scrollIndex,
|
||||
double scrollPosition,
|
||||
double scrollExtentMax,
|
||||
double scrollExtentMin,
|
||||
double left,
|
||||
double top,
|
||||
double right,
|
||||
double bottom,
|
||||
double elevation,
|
||||
double thickness,
|
||||
String label,
|
||||
String hint,
|
||||
String value,
|
||||
String increasedValue,
|
||||
String decreasedValue,
|
||||
int textDirection,
|
||||
Float64List transform,
|
||||
Int32List childrenInTraversalOrder,
|
||||
Int32List childrenInHitTestOrder,
|
||||
Int32List additionalActions,
|
||||
) native 'SemanticsUpdateBuilder_updateNode';
|
||||
|
||||
/// Update the custom semantics action associated with the given `id`.
|
||||
@@ -800,28 +802,28 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
|
||||
/// For overridden standard actions, `overrideId` corresponds with a
|
||||
/// [SemanticsAction.index] value. For custom actions this argument should not be
|
||||
/// provided.
|
||||
void updateCustomAction({/*required*/ int/*!*/ id, String/*?*/ label, String/*?*/ hint, int/*!*/ overrideId = -1}) {
|
||||
assert(id != null);
|
||||
assert(overrideId != null);
|
||||
void updateCustomAction({required int id, String? label, String? hint, int overrideId = -1}) {
|
||||
assert(id != null); // ignore: unnecessary_null_comparison
|
||||
assert(overrideId != null); // ignore: unnecessary_null_comparison
|
||||
_updateCustomAction(id, label, hint, overrideId);
|
||||
}
|
||||
void _updateCustomAction(
|
||||
int/*!*/ id,
|
||||
String/*?*/ label,
|
||||
String/*?*/ hint,
|
||||
int/*!*/ overrideId) native 'SemanticsUpdateBuilder_updateCustomAction';
|
||||
int id,
|
||||
String? label,
|
||||
String? hint,
|
||||
int overrideId) native 'SemanticsUpdateBuilder_updateCustomAction';
|
||||
|
||||
/// Creates a [SemanticsUpdate] object that encapsulates the updates recorded
|
||||
/// by this object.
|
||||
///
|
||||
/// The returned object can be passed to [Window.updateSemantics] to actually
|
||||
/// update the semantics retained by the system.
|
||||
SemanticsUpdate/*!*/ build() {
|
||||
SemanticsUpdate build() {
|
||||
final SemanticsUpdate semanticsUpdate = SemanticsUpdate._();
|
||||
_build(semanticsUpdate);
|
||||
return semanticsUpdate;
|
||||
}
|
||||
void _build(SemanticsUpdate/*!*/ outSemanticsUpdate) native 'SemanticsUpdateBuilder_build';
|
||||
void _build(SemanticsUpdate outSemanticsUpdate) native 'SemanticsUpdateBuilder_build';
|
||||
}
|
||||
|
||||
/// An opaque object representing a batch of semantics updates.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@
|
||||
/// This library exposes the lowest-level services that Flutter frameworks use
|
||||
/// to bootstrap applications, such as classes for driving the input, graphics
|
||||
/// text, layout, and rendering subsystems.
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
library dart.ui;
|
||||
|
||||
import 'dart:_internal' hide Symbol; // ignore: unused_import
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.6
|
||||
// @dart = 2.9
|
||||
part of dart.ui;
|
||||
|
||||
/// Signature of callbacks that have no arguments and return no data.
|
||||
typedef VoidCallback = void Function();
|
||||
|
||||
/// Signature for [Window.onBeginFrame].
|
||||
typedef FrameCallback = void Function(Duration/*!*/ duration);
|
||||
typedef FrameCallback = void Function(Duration duration);
|
||||
|
||||
/// Signature for [Window.onReportTimings].
|
||||
///
|
||||
@@ -23,25 +23,25 @@ typedef FrameCallback = void Function(Duration/*!*/ duration);
|
||||
/// even if there are no later frames to batch. The timing of the first frame
|
||||
/// will be sent immediately without batching.
|
||||
/// {@endtemplate}
|
||||
typedef TimingsCallback = void Function(List<FrameTiming/*!*/>/*!*/ timings);
|
||||
typedef TimingsCallback = void Function(List<FrameTiming> timings);
|
||||
|
||||
/// Signature for [Window.onPointerDataPacket].
|
||||
typedef PointerDataPacketCallback = void Function(PointerDataPacket/*!*/ packet);
|
||||
typedef PointerDataPacketCallback = void Function(PointerDataPacket packet);
|
||||
|
||||
/// Signature for [Window.onSemanticsAction].
|
||||
typedef SemanticsActionCallback = void Function(int/*!*/ id, SemanticsAction/*!*/ action, ByteData/*?*/ args);
|
||||
typedef SemanticsActionCallback = void Function(int id, SemanticsAction action, ByteData? args);
|
||||
|
||||
/// Signature for responses to platform messages.
|
||||
///
|
||||
/// Used as a parameter to [Window.sendPlatformMessage] and
|
||||
/// [Window.onPlatformMessage].
|
||||
typedef PlatformMessageResponseCallback = void Function(ByteData/*?*/ data);
|
||||
typedef PlatformMessageResponseCallback = void Function(ByteData? data);
|
||||
|
||||
/// Signature for [Window.onPlatformMessage].
|
||||
typedef PlatformMessageCallback = void Function(String/*!*/ name, ByteData/*?*/ data, PlatformMessageResponseCallback/*?*/ callback);
|
||||
typedef PlatformMessageCallback = void Function(String name, ByteData? data, PlatformMessageResponseCallback? callback);
|
||||
|
||||
// Signature for _setNeedsReportTimings.
|
||||
typedef _SetNeedsReportTimingsFunc = void Function(bool/*!*/ value);
|
||||
typedef _SetNeedsReportTimingsFunc = void Function(bool value);
|
||||
|
||||
/// Various important time points in the lifetime of a frame.
|
||||
///
|
||||
@@ -89,14 +89,14 @@ class FrameTiming {
|
||||
///
|
||||
/// This constructor is usually only called by the Flutter engine, or a test.
|
||||
/// To get the [FrameTiming] of your app, see [Window.onReportTimings].
|
||||
FrameTiming(List<int/*!*/>/*!*/ timestamps)
|
||||
FrameTiming(List<int> timestamps)
|
||||
: assert(timestamps.length == FramePhase.values.length), _timestamps = timestamps;
|
||||
|
||||
/// This is a raw timestamp in microseconds from some epoch. The epoch in all
|
||||
/// [FrameTiming] is the same, but it may not match [DateTime]'s epoch.
|
||||
int/*!*/ timestampInMicroseconds(FramePhase/*!*/ phase) => _timestamps[phase.index];
|
||||
int timestampInMicroseconds(FramePhase phase) => _timestamps[phase.index];
|
||||
|
||||
Duration/*!*/ _rawDuration(FramePhase/*!*/ phase) => Duration(microseconds: _timestamps[phase.index]);
|
||||
Duration _rawDuration(FramePhase phase) => Duration(microseconds: _timestamps[phase.index]);
|
||||
|
||||
/// The duration to build the frame on the UI thread.
|
||||
///
|
||||
@@ -113,13 +113,13 @@ class FrameTiming {
|
||||
/// {@template dart.ui.FrameTiming.fps_milliseconds}
|
||||
/// That's about 16ms for 60fps, and 8ms for 120fps.
|
||||
/// {@endtemplate}
|
||||
Duration/*!*/ get buildDuration => _rawDuration(FramePhase.buildFinish) - _rawDuration(FramePhase.buildStart);
|
||||
Duration get buildDuration => _rawDuration(FramePhase.buildFinish) - _rawDuration(FramePhase.buildStart);
|
||||
|
||||
/// The duration to rasterize the frame on the raster thread.
|
||||
///
|
||||
/// {@macro dart.ui.FrameTiming.fps_smoothness_milliseconds}
|
||||
/// {@macro dart.ui.FrameTiming.fps_milliseconds}
|
||||
Duration/*!*/ get rasterDuration => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.rasterStart);
|
||||
Duration get rasterDuration => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.rasterStart);
|
||||
|
||||
/// The timespan between build start and raster finish.
|
||||
///
|
||||
@@ -128,9 +128,9 @@ class FrameTiming {
|
||||
/// {@macro dart.ui.FrameTiming.fps_milliseconds}
|
||||
///
|
||||
/// See also [buildDuration] and [rasterDuration].
|
||||
Duration/*!*/ get totalSpan => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.buildStart);
|
||||
Duration get totalSpan => _rawDuration(FramePhase.rasterFinish) - _rawDuration(FramePhase.buildStart);
|
||||
|
||||
final List<int/*!*/>/*!*/ _timestamps; // in microseconds
|
||||
final List<int> _timestamps; // in microseconds
|
||||
|
||||
String _formatMS(Duration duration) => '${duration.inMicroseconds * 0.001}ms';
|
||||
|
||||
@@ -206,19 +206,19 @@ enum AppLifecycleState {
|
||||
/// * [Scaffold], which automatically applies the padding in material design
|
||||
/// applications.
|
||||
class WindowPadding {
|
||||
const WindowPadding._({ this.left, this.top, this.right, this.bottom });
|
||||
const WindowPadding._({ required this.left, required this.top, required this.right, required this.bottom });
|
||||
|
||||
/// The distance from the left edge to the first unpadded pixel, in physical pixels.
|
||||
final double/*!*/ left;
|
||||
final double left;
|
||||
|
||||
/// The distance from the top edge to the first unpadded pixel, in physical pixels.
|
||||
final double/*!*/ top;
|
||||
final double top;
|
||||
|
||||
/// The distance from the right edge to the first unpadded pixel, in physical pixels.
|
||||
final double/*!*/ right;
|
||||
final double right;
|
||||
|
||||
/// The distance from the bottom edge to the first unpadded pixel, in physical pixels.
|
||||
final double/*!*/ bottom;
|
||||
final double bottom;
|
||||
|
||||
/// A window padding that has zeros for each edge.
|
||||
static const WindowPadding zero = WindowPadding._(left: 0.0, top: 0.0, right: 0.0, bottom: 0.0);
|
||||
@@ -282,7 +282,7 @@ class Locale {
|
||||
const Locale(
|
||||
this._languageCode, [
|
||||
this._countryCode,
|
||||
]) : assert(_languageCode != null),
|
||||
]) : assert(_languageCode != null), // ignore: unnecessary_null_comparison
|
||||
assert(_languageCode != ''),
|
||||
scriptCode = null;
|
||||
|
||||
@@ -303,10 +303,10 @@ class Locale {
|
||||
/// Validity is not checked by default, but some methods may throw away
|
||||
/// invalid data.
|
||||
const Locale.fromSubtags({
|
||||
String/*!*/ languageCode = 'und',
|
||||
String languageCode = 'und',
|
||||
this.scriptCode,
|
||||
String/*?*/ countryCode,
|
||||
}) : assert(languageCode != null),
|
||||
String? countryCode,
|
||||
}) : assert(languageCode != null), // ignore: unnecessary_null_comparison
|
||||
assert(languageCode != ''),
|
||||
_languageCode = languageCode,
|
||||
assert(scriptCode != ''),
|
||||
@@ -336,8 +336,8 @@ class Locale {
|
||||
///
|
||||
/// * [Locale.fromSubtags], which describes the conventions for creating
|
||||
/// [Locale] objects.
|
||||
String/*!*/ get languageCode => _deprecatedLanguageSubtagMap[_languageCode] ?? _languageCode;
|
||||
final String/*!*/ _languageCode;
|
||||
String get languageCode => _deprecatedLanguageSubtagMap[_languageCode] ?? _languageCode;
|
||||
final String _languageCode;
|
||||
|
||||
// This map is generated by //flutter/tools/gen_locale.dart
|
||||
// Mappings generated for language subtag registry as of 2019-02-27.
|
||||
@@ -434,7 +434,7 @@ class Locale {
|
||||
///
|
||||
/// * [Locale.fromSubtags], which describes the conventions for creating
|
||||
/// [Locale] objects.
|
||||
final String/*?*/ scriptCode;
|
||||
final String? scriptCode;
|
||||
|
||||
/// The region subtag for the locale.
|
||||
///
|
||||
@@ -455,8 +455,8 @@ class Locale {
|
||||
///
|
||||
/// * [Locale.fromSubtags], which describes the conventions for creating
|
||||
/// [Locale] objects.
|
||||
String/*?*/ get countryCode => _deprecatedRegionSubtagMap[_countryCode] ?? _countryCode;
|
||||
final String/*?*/ _countryCode;
|
||||
String? get countryCode => _deprecatedRegionSubtagMap[_countryCode] ?? _countryCode;
|
||||
final String? _countryCode;
|
||||
|
||||
// This map is generated by //flutter/tools/gen_locale.dart
|
||||
// Mappings generated for language subtag registry as of 2019-02-27.
|
||||
@@ -470,22 +470,26 @@ class Locale {
|
||||
};
|
||||
|
||||
@override
|
||||
bool/*!*/ operator ==(dynamic other) {
|
||||
bool operator ==(dynamic other) {
|
||||
if (identical(this, other))
|
||||
return true;
|
||||
return other is Locale
|
||||
&& other.languageCode == languageCode
|
||||
if (other is! Locale) {
|
||||
return false;
|
||||
}
|
||||
final String? countryCode = _countryCode;
|
||||
final String? otherCountryCode = other.countryCode;
|
||||
return other.languageCode == languageCode
|
||||
&& other.scriptCode == scriptCode // scriptCode cannot be ''
|
||||
&& (other.countryCode == countryCode // Treat '' as equal to null.
|
||||
|| other.countryCode != null && other.countryCode.isEmpty && countryCode == null
|
||||
|| otherCountryCode != null && otherCountryCode.isEmpty && countryCode == null
|
||||
|| countryCode != null && countryCode.isEmpty && other.countryCode == null);
|
||||
}
|
||||
|
||||
@override
|
||||
int/*!*/ get hashCode => hashValues(languageCode, scriptCode, countryCode == '' ? null : countryCode);
|
||||
int get hashCode => hashValues(languageCode, scriptCode, countryCode == '' ? null : countryCode);
|
||||
|
||||
static Locale/*?*/ _cachedLocale;
|
||||
static String/*?*/ _cachedLocaleString;
|
||||
static Locale? _cachedLocale;
|
||||
static String? _cachedLocaleString;
|
||||
|
||||
/// Returns a string representing the locale.
|
||||
///
|
||||
@@ -499,7 +503,7 @@ class Locale {
|
||||
_cachedLocale = this;
|
||||
_cachedLocaleString = _rawToString('_');
|
||||
}
|
||||
return _cachedLocaleString;
|
||||
return _cachedLocaleString!;
|
||||
}
|
||||
|
||||
/// Returns a syntactically valid Unicode BCP47 Locale Identifier.
|
||||
@@ -507,13 +511,13 @@ class Locale {
|
||||
/// Some examples of such identifiers: "en", "es-419", "hi-Deva-IN" and
|
||||
/// "zh-Hans-CN". See http://www.unicode.org/reports/tr35/ for technical
|
||||
/// details.
|
||||
String/*!*/ toLanguageTag() => _rawToString('-');
|
||||
String toLanguageTag() => _rawToString('-');
|
||||
|
||||
String/*!*/ _rawToString(String separator) {
|
||||
String _rawToString(String separator) {
|
||||
final StringBuffer out = StringBuffer(languageCode);
|
||||
if (scriptCode != null && scriptCode.isNotEmpty)
|
||||
if (scriptCode != null && scriptCode!.isNotEmpty)
|
||||
out.write('$separator$scriptCode');
|
||||
if (_countryCode != null && _countryCode.isNotEmpty)
|
||||
if (_countryCode != null && _countryCode!.isNotEmpty)
|
||||
out.write('$separator$countryCode');
|
||||
return out.toString();
|
||||
}
|
||||
@@ -600,8 +604,8 @@ class Window {
|
||||
///
|
||||
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
|
||||
/// observe when this value changes.
|
||||
double/*!*/ get devicePixelRatio => _devicePixelRatio;
|
||||
double/*!*/ _devicePixelRatio = 1.0;
|
||||
double get devicePixelRatio => _devicePixelRatio;
|
||||
double _devicePixelRatio = 1.0;
|
||||
|
||||
/// The dimensions of the rectangle into which the application will be drawn,
|
||||
/// in physical pixels.
|
||||
@@ -620,8 +624,8 @@ class Window {
|
||||
///
|
||||
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
|
||||
/// observe when this value changes.
|
||||
Size/*!*/ get physicalSize => _physicalSize;
|
||||
Size/*!*/ _physicalSize = Size.zero;
|
||||
Size get physicalSize => _physicalSize;
|
||||
Size _physicalSize = Size.zero;
|
||||
|
||||
/// The physical depth is the maximum elevation that the Window allows.
|
||||
///
|
||||
@@ -634,8 +638,8 @@ class Window {
|
||||
/// The default value is [double.maxFinite], which is used for platforms that
|
||||
/// do not specify a maximum elevation. This property is currently on expected
|
||||
/// to be set to a non-default value on Fuchsia.
|
||||
double/*!*/ get physicalDepth => _physicalDepth;
|
||||
double/*!*/ _physicalDepth = double.maxFinite;
|
||||
double get physicalDepth => _physicalDepth;
|
||||
double _physicalDepth = double.maxFinite;
|
||||
|
||||
/// The number of physical pixels on each side of the display rectangle into
|
||||
/// which the application can render, but over which the operating system
|
||||
@@ -655,8 +659,8 @@ class Window {
|
||||
/// * [MediaQuery.of], a simpler mechanism for the same.
|
||||
/// * [Scaffold], which automatically applies the view insets in material
|
||||
/// design applications.
|
||||
WindowPadding/*!*/ get viewInsets => _viewInsets;
|
||||
WindowPadding/*!*/ _viewInsets = WindowPadding.zero;
|
||||
WindowPadding get viewInsets => _viewInsets;
|
||||
WindowPadding _viewInsets = WindowPadding.zero;
|
||||
|
||||
/// The number of physical pixels on each side of the display rectangle into
|
||||
/// which the application can render, but which may be partially obscured by
|
||||
@@ -682,8 +686,8 @@ class Window {
|
||||
/// * [MediaQuery.of], a simpler mechanism for the same.
|
||||
/// * [Scaffold], which automatically applies the padding in material design
|
||||
/// applications.
|
||||
WindowPadding/*!*/ get viewPadding => _viewPadding;
|
||||
WindowPadding/*!*/ _viewPadding = WindowPadding.zero;
|
||||
WindowPadding get viewPadding => _viewPadding;
|
||||
WindowPadding _viewPadding = WindowPadding.zero;
|
||||
|
||||
/// The number of physical pixels on each side of the display rectangle into
|
||||
/// which the application can render, but where the operating system will
|
||||
@@ -700,8 +704,8 @@ class Window {
|
||||
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
|
||||
/// observe when this value changes.
|
||||
/// * [MediaQuery.of], a simpler mechanism for the same.
|
||||
WindowPadding/*!*/ get systemGestureInsets => _systemGestureInsets;
|
||||
WindowPadding/*!*/ _systemGestureInsets = WindowPadding.zero;
|
||||
WindowPadding get systemGestureInsets => _systemGestureInsets;
|
||||
WindowPadding _systemGestureInsets = WindowPadding.zero;
|
||||
|
||||
/// The number of physical pixels on each side of the display rectangle into
|
||||
/// which the application can render, but which may be partially obscured by
|
||||
@@ -730,8 +734,8 @@ class Window {
|
||||
/// * [MediaQuery.of], a simpler mechanism for the same.
|
||||
/// * [Scaffold], which automatically applies the padding in material design
|
||||
/// applications.
|
||||
WindowPadding/*!*/ get padding => _padding;
|
||||
WindowPadding/*!*/ _padding = WindowPadding.zero;
|
||||
WindowPadding get padding => _padding;
|
||||
WindowPadding _padding = WindowPadding.zero;
|
||||
|
||||
/// A callback that is invoked whenever the [devicePixelRatio],
|
||||
/// [physicalSize], [padding], [viewInsets], or [systemGestureInsets]
|
||||
@@ -750,10 +754,10 @@ class Window {
|
||||
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
|
||||
/// register for notifications when this is called.
|
||||
/// * [MediaQuery.of], a simpler mechanism for the same.
|
||||
VoidCallback/*?*/ get onMetricsChanged => _onMetricsChanged;
|
||||
VoidCallback/*?*/ _onMetricsChanged;
|
||||
Zone/*!*/ _onMetricsChangedZone = Zone.root;
|
||||
set onMetricsChanged(VoidCallback/*?*/ callback) {
|
||||
VoidCallback? get onMetricsChanged => _onMetricsChanged;
|
||||
VoidCallback? _onMetricsChanged;
|
||||
Zone _onMetricsChangedZone = Zone.root;
|
||||
set onMetricsChanged(VoidCallback? callback) {
|
||||
_onMetricsChanged = callback;
|
||||
_onMetricsChangedZone = Zone.current;
|
||||
}
|
||||
@@ -768,9 +772,9 @@ class Window {
|
||||
///
|
||||
/// This is equivalent to `locales.first` and will provide an empty non-null locale
|
||||
/// if the [locales] list has not been set or is empty.
|
||||
Locale/*?*/ get locale {
|
||||
if (_locales != null && _locales.isNotEmpty) {
|
||||
return _locales.first;
|
||||
Locale? get locale {
|
||||
if (_locales != null && _locales!.isNotEmpty) {
|
||||
return _locales!.first;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -789,8 +793,8 @@ class Window {
|
||||
///
|
||||
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
|
||||
/// observe when this value changes.
|
||||
List<Locale/*!*/>/*?*/ get locales => _locales;
|
||||
List<Locale/*!*/>/*?*/ _locales;
|
||||
List<Locale>? get locales => _locales;
|
||||
List<Locale>? _locales;
|
||||
|
||||
/// The locale that the platform's native locale resolution system resolves to.
|
||||
///
|
||||
@@ -802,8 +806,8 @@ class Window {
|
||||
/// in order to arrive at the most appropriate locale for the app.
|
||||
///
|
||||
/// See [locales], which is the list of locales the user/device prefers.
|
||||
Locale/*?*/ get platformResolvedLocale => _platformResolvedLocale;
|
||||
Locale/*?*/ _platformResolvedLocale;
|
||||
Locale? get platformResolvedLocale => _platformResolvedLocale;
|
||||
Locale? _platformResolvedLocale;
|
||||
|
||||
/// A callback that is invoked whenever [locale] changes value.
|
||||
///
|
||||
@@ -814,10 +818,10 @@ class Window {
|
||||
///
|
||||
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
|
||||
/// observe when this callback is invoked.
|
||||
VoidCallback/*?*/ get onLocaleChanged => _onLocaleChanged;
|
||||
VoidCallback/*?*/ _onLocaleChanged;
|
||||
Zone/*!*/ _onLocaleChangedZone = Zone.root;
|
||||
set onLocaleChanged(VoidCallback callback) {
|
||||
VoidCallback? get onLocaleChanged => _onLocaleChanged;
|
||||
VoidCallback? _onLocaleChanged;
|
||||
Zone _onLocaleChangedZone = Zone.root;
|
||||
set onLocaleChanged(VoidCallback? callback) {
|
||||
_onLocaleChanged = callback;
|
||||
_onLocaleChangedZone = Zone.current;
|
||||
}
|
||||
@@ -828,15 +832,15 @@ class Window {
|
||||
///
|
||||
/// It is used to initialize [SchedulerBinding.lifecycleState] at startup
|
||||
/// with any buffered lifecycle state events.
|
||||
String/*!*/ get initialLifecycleState {
|
||||
String get initialLifecycleState {
|
||||
_initialLifecycleStateAccessed = true;
|
||||
return _initialLifecycleState;
|
||||
}
|
||||
/*late*/ String/*!*/ _initialLifecycleState;
|
||||
late String _initialLifecycleState;
|
||||
/// Tracks if the initial state has been accessed. Once accessed, we
|
||||
/// will stop updating the [initialLifecycleState], as it is not the
|
||||
/// preferred way to access the state.
|
||||
bool/*!*/ _initialLifecycleStateAccessed = false;
|
||||
bool _initialLifecycleStateAccessed = false;
|
||||
|
||||
/// The system-reported text scale.
|
||||
///
|
||||
@@ -850,15 +854,15 @@ class Window {
|
||||
///
|
||||
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
|
||||
/// observe when this value changes.
|
||||
double/*!*/ get textScaleFactor => _textScaleFactor;
|
||||
double/*!*/ _textScaleFactor = 1.0;
|
||||
double get textScaleFactor => _textScaleFactor;
|
||||
double _textScaleFactor = 1.0;
|
||||
|
||||
/// The setting indicating whether time should always be shown in the 24-hour
|
||||
/// format.
|
||||
///
|
||||
/// This option is used by [showTimePicker].
|
||||
bool/*!*/ get alwaysUse24HourFormat => _alwaysUse24HourFormat;
|
||||
bool/*!*/ _alwaysUse24HourFormat = false;
|
||||
bool get alwaysUse24HourFormat => _alwaysUse24HourFormat;
|
||||
bool _alwaysUse24HourFormat = false;
|
||||
|
||||
/// A callback that is invoked whenever [textScaleFactor] changes value.
|
||||
///
|
||||
@@ -869,18 +873,18 @@ class Window {
|
||||
///
|
||||
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
|
||||
/// observe when this callback is invoked.
|
||||
VoidCallback/*?*/ get onTextScaleFactorChanged => _onTextScaleFactorChanged;
|
||||
VoidCallback/*?*/ _onTextScaleFactorChanged;
|
||||
Zone/*!*/ _onTextScaleFactorChangedZone = Zone.root;
|
||||
set onTextScaleFactorChanged(VoidCallback/*?*/ callback) {
|
||||
VoidCallback? get onTextScaleFactorChanged => _onTextScaleFactorChanged;
|
||||
VoidCallback? _onTextScaleFactorChanged;
|
||||
Zone _onTextScaleFactorChangedZone = Zone.root;
|
||||
set onTextScaleFactorChanged(VoidCallback? callback) {
|
||||
_onTextScaleFactorChanged = callback;
|
||||
_onTextScaleFactorChangedZone = Zone.current;
|
||||
}
|
||||
|
||||
/// The setting indicating the current brightness mode of the host platform.
|
||||
/// If the platform has no preference, [platformBrightness] defaults to [Brightness.light].
|
||||
Brightness/*!*/ get platformBrightness => _platformBrightness;
|
||||
Brightness/*!*/ _platformBrightness = Brightness.light;
|
||||
Brightness get platformBrightness => _platformBrightness;
|
||||
Brightness _platformBrightness = Brightness.light;
|
||||
|
||||
/// A callback that is invoked whenever [platformBrightness] changes value.
|
||||
///
|
||||
@@ -891,10 +895,10 @@ class Window {
|
||||
///
|
||||
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
|
||||
/// observe when this callback is invoked.
|
||||
VoidCallback/*?*/ get onPlatformBrightnessChanged => _onPlatformBrightnessChanged;
|
||||
VoidCallback/*?*/ _onPlatformBrightnessChanged;
|
||||
Zone/*!*/ _onPlatformBrightnessChangedZone = Zone.root;
|
||||
set onPlatformBrightnessChanged(VoidCallback/*?*/ callback) {
|
||||
VoidCallback? get onPlatformBrightnessChanged => _onPlatformBrightnessChanged;
|
||||
VoidCallback? _onPlatformBrightnessChanged;
|
||||
Zone _onPlatformBrightnessChangedZone = Zone.root;
|
||||
set onPlatformBrightnessChanged(VoidCallback? callback) {
|
||||
_onPlatformBrightnessChanged = callback;
|
||||
_onPlatformBrightnessChangedZone = Zone.current;
|
||||
}
|
||||
@@ -918,10 +922,10 @@ class Window {
|
||||
/// scheduling of frames.
|
||||
/// * [RendererBinding], the Flutter framework class which manages layout and
|
||||
/// painting.
|
||||
FrameCallback/*?*/ get onBeginFrame => _onBeginFrame;
|
||||
FrameCallback/*?*/ _onBeginFrame;
|
||||
Zone/*!*/ _onBeginFrameZone = Zone.root;
|
||||
set onBeginFrame(FrameCallback/*?*/ callback) {
|
||||
FrameCallback? get onBeginFrame => _onBeginFrame;
|
||||
FrameCallback? _onBeginFrame;
|
||||
Zone _onBeginFrameZone = Zone.root;
|
||||
set onBeginFrame(FrameCallback? callback) {
|
||||
_onBeginFrame = callback;
|
||||
_onBeginFrameZone = Zone.current;
|
||||
}
|
||||
@@ -940,10 +944,10 @@ class Window {
|
||||
/// scheduling of frames.
|
||||
/// * [RendererBinding], the Flutter framework class which manages layout and
|
||||
/// painting.
|
||||
VoidCallback/*?*/ get onDrawFrame => _onDrawFrame;
|
||||
VoidCallback/*?*/ _onDrawFrame;
|
||||
Zone/*!*/ _onDrawFrameZone = Zone.root;
|
||||
set onDrawFrame(VoidCallback/*?*/ callback) {
|
||||
VoidCallback? get onDrawFrame => _onDrawFrame;
|
||||
VoidCallback? _onDrawFrame;
|
||||
Zone _onDrawFrameZone = Zone.root;
|
||||
set onDrawFrame(VoidCallback? callback) {
|
||||
_onDrawFrame = callback;
|
||||
_onDrawFrameZone = Zone.current;
|
||||
}
|
||||
@@ -969,10 +973,10 @@ class Window {
|
||||
/// Flutter spends less than 0.1ms every 1 second to report the timings
|
||||
/// (measured on iPhone6S). The 0.1ms is about 0.6% of 16ms (frame budget for
|
||||
/// 60fps), or 0.01% CPU usage per second.
|
||||
TimingsCallback/*?*/ get onReportTimings => _onReportTimings;
|
||||
TimingsCallback/*?*/ _onReportTimings;
|
||||
Zone/*!*/ _onReportTimingsZone = Zone.root;
|
||||
set onReportTimings(TimingsCallback/*?*/ callback) {
|
||||
TimingsCallback? get onReportTimings => _onReportTimings;
|
||||
TimingsCallback? _onReportTimings;
|
||||
Zone _onReportTimingsZone = Zone.root;
|
||||
set onReportTimings(TimingsCallback? callback) {
|
||||
if ((callback == null) != (_onReportTimings == null)) {
|
||||
_setNeedsReportTimings(callback != null);
|
||||
}
|
||||
@@ -980,8 +984,8 @@ class Window {
|
||||
_onReportTimingsZone = Zone.current;
|
||||
}
|
||||
|
||||
/*late*/ _SetNeedsReportTimingsFunc/*!*/ _setNeedsReportTimings;
|
||||
void _nativeSetNeedsReportTimings(bool/*!*/ value) native 'Window_setNeedsReportTimings';
|
||||
late _SetNeedsReportTimingsFunc _setNeedsReportTimings;
|
||||
void _nativeSetNeedsReportTimings(bool value) native 'Window_setNeedsReportTimings';
|
||||
|
||||
/// A callback that is invoked when pointer data is available.
|
||||
///
|
||||
@@ -992,10 +996,10 @@ class Window {
|
||||
///
|
||||
/// * [GestureBinding], the Flutter framework class which manages pointer
|
||||
/// events.
|
||||
PointerDataPacketCallback/*?*/ get onPointerDataPacket => _onPointerDataPacket;
|
||||
PointerDataPacketCallback/*?*/ _onPointerDataPacket;
|
||||
Zone/*!*/ _onPointerDataPacketZone = Zone.root;
|
||||
set onPointerDataPacket(PointerDataPacketCallback/*?*/ callback) {
|
||||
PointerDataPacketCallback? get onPointerDataPacket => _onPointerDataPacket;
|
||||
PointerDataPacketCallback? _onPointerDataPacket;
|
||||
Zone _onPointerDataPacketZone = Zone.root;
|
||||
set onPointerDataPacket(PointerDataPacketCallback? callback) {
|
||||
_onPointerDataPacket = callback;
|
||||
_onPointerDataPacketZone = Zone.current;
|
||||
}
|
||||
@@ -1030,8 +1034,8 @@ class Window {
|
||||
/// * [Navigator], a widget that handles routing.
|
||||
/// * [SystemChannels.navigation], which handles subsequent navigation
|
||||
/// requests from the embedder.
|
||||
String/*!*/ get defaultRouteName => _defaultRouteName();
|
||||
String/*!*/ _defaultRouteName() native 'Window_defaultRouteName';
|
||||
String get defaultRouteName => _defaultRouteName();
|
||||
String _defaultRouteName() native 'Window_defaultRouteName';
|
||||
|
||||
/// Requests that, at the next appropriate opportunity, the [onBeginFrame]
|
||||
/// and [onDrawFrame] callbacks be invoked.
|
||||
@@ -1066,24 +1070,24 @@ class Window {
|
||||
/// scheduling of frames.
|
||||
/// * [RendererBinding], the Flutter framework class which manages layout and
|
||||
/// painting.
|
||||
void render(Scene/*!*/ scene) native 'Window_render';
|
||||
void render(Scene scene) native 'Window_render';
|
||||
|
||||
/// Whether the user has requested that [updateSemantics] be called when
|
||||
/// the semantic contents of window changes.
|
||||
///
|
||||
/// The [onSemanticsEnabledChanged] callback is called whenever this value
|
||||
/// changes.
|
||||
bool/*!*/ get semanticsEnabled => _semanticsEnabled;
|
||||
bool/*!*/ _semanticsEnabled = false;
|
||||
bool get semanticsEnabled => _semanticsEnabled;
|
||||
bool _semanticsEnabled = false;
|
||||
|
||||
/// A callback that is invoked when the value of [semanticsEnabled] changes.
|
||||
///
|
||||
/// The framework invokes this callback in the same zone in which the
|
||||
/// callback was set.
|
||||
VoidCallback/*?*/ get onSemanticsEnabledChanged => _onSemanticsEnabledChanged;
|
||||
VoidCallback/*?*/ _onSemanticsEnabledChanged;
|
||||
Zone/*!*/ _onSemanticsEnabledChangedZone = Zone.root;
|
||||
set onSemanticsEnabledChanged(VoidCallback/*?*/ callback) {
|
||||
VoidCallback? get onSemanticsEnabledChanged => _onSemanticsEnabledChanged;
|
||||
VoidCallback? _onSemanticsEnabledChanged;
|
||||
Zone _onSemanticsEnabledChangedZone = Zone.root;
|
||||
set onSemanticsEnabledChanged(VoidCallback? callback) {
|
||||
_onSemanticsEnabledChanged = callback;
|
||||
_onSemanticsEnabledChangedZone = Zone.current;
|
||||
}
|
||||
@@ -1096,27 +1100,27 @@ class Window {
|
||||
///
|
||||
/// The framework invokes this callback in the same zone in which the
|
||||
/// callback was set.
|
||||
SemanticsActionCallback/*?*/ get onSemanticsAction => _onSemanticsAction;
|
||||
SemanticsActionCallback/*?*/ _onSemanticsAction;
|
||||
Zone/*!*/ _onSemanticsActionZone = Zone.root;
|
||||
set onSemanticsAction(SemanticsActionCallback/*?*/ callback) {
|
||||
SemanticsActionCallback? get onSemanticsAction => _onSemanticsAction;
|
||||
SemanticsActionCallback? _onSemanticsAction;
|
||||
Zone _onSemanticsActionZone = Zone.root;
|
||||
set onSemanticsAction(SemanticsActionCallback? callback) {
|
||||
_onSemanticsAction = callback;
|
||||
_onSemanticsActionZone = Zone.current;
|
||||
}
|
||||
|
||||
/// Additional accessibility features that may be enabled by the platform.
|
||||
AccessibilityFeatures/*!*/ get accessibilityFeatures => _accessibilityFeatures;
|
||||
AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures;
|
||||
// The zero value matches the default value in `window_data.h`.
|
||||
AccessibilityFeatures/*!*/ _accessibilityFeatures = const AccessibilityFeatures._(0);
|
||||
AccessibilityFeatures _accessibilityFeatures = const AccessibilityFeatures._(0);
|
||||
|
||||
/// A callback that is invoked when the value of [accessibilityFeatures] changes.
|
||||
///
|
||||
/// The framework invokes this callback in the same zone in which the
|
||||
/// callback was set.
|
||||
VoidCallback/*?*/ get onAccessibilityFeaturesChanged => _onAccessibilityFeaturesChanged;
|
||||
VoidCallback/*?*/ _onAccessibilityFeaturesChanged;
|
||||
Zone/*!*/ _onAccessibilityFeaturesChangedZone = Zone.root;
|
||||
set onAccessibilityFeaturesChanged(VoidCallback/*?*/ callback) {
|
||||
VoidCallback? get onAccessibilityFeaturesChanged => _onAccessibilityFeaturesChanged;
|
||||
VoidCallback? _onAccessibilityFeaturesChanged;
|
||||
Zone _onAccessibilityFeaturesChangedZone = Zone.root;
|
||||
set onAccessibilityFeaturesChanged(VoidCallback? callback) {
|
||||
_onAccessibilityFeaturesChanged = callback;
|
||||
_onAccessibilityFeaturesChangedZone = Zone.current;
|
||||
}
|
||||
@@ -1128,7 +1132,7 @@ class Window {
|
||||
///
|
||||
/// In either case, this function disposes the given update, which means the
|
||||
/// semantics update cannot be used further.
|
||||
void updateSemantics(SemanticsUpdate/*!*/ update) native 'Window_updateSemantics';
|
||||
void updateSemantics(SemanticsUpdate update) native 'Window_updateSemantics';
|
||||
|
||||
/// Set the debug name associated with this window's root isolate.
|
||||
///
|
||||
@@ -1138,7 +1142,7 @@ class Window {
|
||||
/// This can be combined with flutter tools `--isolate-filter` flag to debug
|
||||
/// specific root isolates. For example: `flutter attach --isolate-filter=[name]`.
|
||||
/// Note that this does not rename any child isolates of the root.
|
||||
void setIsolateDebugName(String/*!*/ name) native 'Window_setIsolateDebugName';
|
||||
void setIsolateDebugName(String name) native 'Window_setIsolateDebugName';
|
||||
|
||||
/// Sends a message to a platform-specific plugin.
|
||||
///
|
||||
@@ -1149,17 +1153,17 @@ class Window {
|
||||
///
|
||||
/// The framework invokes [callback] in the same zone in which this method
|
||||
/// was called.
|
||||
void sendPlatformMessage(String/*!*/ name,
|
||||
ByteData/*?*/ data,
|
||||
PlatformMessageResponseCallback/*?*/ callback) {
|
||||
final String error =
|
||||
void sendPlatformMessage(String name,
|
||||
ByteData? data,
|
||||
PlatformMessageResponseCallback? callback) {
|
||||
final String? error =
|
||||
_sendPlatformMessage(name, _zonedPlatformMessageResponseCallback(callback), data);
|
||||
if (error != null)
|
||||
throw Exception(error);
|
||||
}
|
||||
String _sendPlatformMessage(String/*!*/ name,
|
||||
PlatformMessageResponseCallback/*?*/ callback,
|
||||
ByteData/*?*/ data) native 'Window_sendPlatformMessage';
|
||||
String? _sendPlatformMessage(String name,
|
||||
PlatformMessageResponseCallback? callback,
|
||||
ByteData? data) native 'Window_sendPlatformMessage';
|
||||
|
||||
/// Called whenever this window receives a message from a platform-specific
|
||||
/// plugin.
|
||||
@@ -1174,28 +1178,28 @@ class Window {
|
||||
///
|
||||
/// The framework invokes this callback in the same zone in which the
|
||||
/// callback was set.
|
||||
PlatformMessageCallback/*?*/ get onPlatformMessage => _onPlatformMessage;
|
||||
PlatformMessageCallback/*?*/ _onPlatformMessage;
|
||||
Zone/*!*/ _onPlatformMessageZone = Zone.root;
|
||||
set onPlatformMessage(PlatformMessageCallback/*?*/ callback) {
|
||||
PlatformMessageCallback? get onPlatformMessage => _onPlatformMessage;
|
||||
PlatformMessageCallback? _onPlatformMessage;
|
||||
Zone _onPlatformMessageZone = Zone.root;
|
||||
set onPlatformMessage(PlatformMessageCallback? callback) {
|
||||
_onPlatformMessage = callback;
|
||||
_onPlatformMessageZone = Zone.current;
|
||||
}
|
||||
|
||||
/// Called by [_dispatchPlatformMessage].
|
||||
void _respondToPlatformMessage(int/*!*/ responseId, ByteData/*?*/ data)
|
||||
void _respondToPlatformMessage(int responseId, ByteData? data)
|
||||
native 'Window_respondToPlatformMessage';
|
||||
|
||||
/// Wraps the given [callback] in another callback that ensures that the
|
||||
/// original callback is called in the zone it was registered in.
|
||||
static PlatformMessageResponseCallback/*?*/ _zonedPlatformMessageResponseCallback(PlatformMessageResponseCallback/*?*/ callback) {
|
||||
static PlatformMessageResponseCallback? _zonedPlatformMessageResponseCallback(PlatformMessageResponseCallback? callback) {
|
||||
if (callback == null)
|
||||
return null;
|
||||
|
||||
// Store the zone in which the callback is being registered.
|
||||
final Zone registrationZone = Zone.current;
|
||||
|
||||
return (ByteData data) {
|
||||
return (ByteData? data) {
|
||||
registrationZone.runUnaryGuarded(callback, data);
|
||||
};
|
||||
}
|
||||
@@ -1210,7 +1214,7 @@ class Window {
|
||||
///
|
||||
/// For asynchronous communication between the embedder and isolate, a
|
||||
/// platform channel may be used.
|
||||
ByteData/*?*/ getPersistentIsolateData() native 'Window_getPersistentIsolateData';
|
||||
ByteData? getPersistentIsolateData() native 'Window_getPersistentIsolateData';
|
||||
}
|
||||
|
||||
/// Additional accessibility features that may be enabled by the platform.
|
||||
@@ -1232,38 +1236,38 @@ class AccessibilityFeatures {
|
||||
static const int _kHighContrastIndex = 1 << 5;
|
||||
|
||||
// A bitfield which represents each enabled feature.
|
||||
final int/*!*/ _index;
|
||||
final int _index;
|
||||
|
||||
/// Whether there is a running accessibility service which is changing the
|
||||
/// interaction model of the device.
|
||||
///
|
||||
/// For example, TalkBack on Android and VoiceOver on iOS enable this flag.
|
||||
bool/*!*/ get accessibleNavigation => _kAccessibleNavigation & _index != 0;
|
||||
bool get accessibleNavigation => _kAccessibleNavigation & _index != 0;
|
||||
|
||||
/// The platform is inverting the colors of the application.
|
||||
bool/*!*/ get invertColors => _kInvertColorsIndex & _index != 0;
|
||||
bool get invertColors => _kInvertColorsIndex & _index != 0;
|
||||
|
||||
/// The platform is requesting that animations be disabled or simplified.
|
||||
bool/*!*/ get disableAnimations => _kDisableAnimationsIndex & _index != 0;
|
||||
bool get disableAnimations => _kDisableAnimationsIndex & _index != 0;
|
||||
|
||||
/// The platform is requesting that text be rendered at a bold font weight.
|
||||
///
|
||||
/// Only supported on iOS.
|
||||
bool/*!*/ get boldText => _kBoldTextIndex & _index != 0;
|
||||
bool get boldText => _kBoldTextIndex & _index != 0;
|
||||
|
||||
/// The platform is requesting that certain animations be simplified and
|
||||
/// parallax effects removed.
|
||||
///
|
||||
/// Only supported on iOS.
|
||||
bool/*!*/ get reduceMotion => _kReduceMotionIndex & _index != 0;
|
||||
bool get reduceMotion => _kReduceMotionIndex & _index != 0;
|
||||
|
||||
/// The platform is requesting that UI be rendered with darker colors.
|
||||
///
|
||||
/// Only supported on iOS.
|
||||
bool/*!*/ get highContrast => _kHighContrastIndex & _index != 0;
|
||||
bool get highContrast => _kHighContrastIndex & _index != 0;
|
||||
|
||||
@override
|
||||
String/*!*/ toString() {
|
||||
String toString() {
|
||||
final List<String> features = <String>[];
|
||||
if (accessibleNavigation)
|
||||
features.add('accessibleNavigation');
|
||||
@@ -1281,7 +1285,7 @@ class AccessibilityFeatures {
|
||||
}
|
||||
|
||||
@override
|
||||
bool/*!*/ operator ==(dynamic other) {
|
||||
bool operator ==(dynamic other) {
|
||||
if (other.runtimeType != runtimeType)
|
||||
return false;
|
||||
return other is AccessibilityFeatures
|
||||
@@ -1289,7 +1293,7 @@ class AccessibilityFeatures {
|
||||
}
|
||||
|
||||
@override
|
||||
int/*!*/ get hashCode => _index.hashCode;
|
||||
int get hashCode => _index.hashCode;
|
||||
}
|
||||
|
||||
/// Describes the contrast of a theme or color palette.
|
||||
@@ -1322,4 +1326,4 @@ enum Brightness {
|
||||
/// The only place that `WidgetsBinding.instance.window` is inappropriate is if
|
||||
/// a `Window` is required before invoking `runApp()`. In that case, it is
|
||||
/// acceptable (though unfortunate) to use this object statically.
|
||||
final Window/*!*/ window = Window._();
|
||||
final Window window = Window._();
|
||||
|
||||
@@ -667,32 +667,32 @@ class SemanticsUpdateBuilder {
|
||||
/// The `transform` is a matrix that maps this node's coordinate system into
|
||||
/// its parent's coordinate system.
|
||||
void updateNode({
|
||||
/*required*/ int/*!*/ id,
|
||||
/*required*/ int/*!*/ flags,
|
||||
/*required*/ int/*!*/ actions,
|
||||
/*required*/ int/*!*/ maxValueLength,
|
||||
/*required*/ int/*!*/ currentValueLength,
|
||||
/*required*/ int/*!*/ textSelectionBase,
|
||||
/*required*/ int/*!*/ textSelectionExtent,
|
||||
/*required*/ int/*!*/ platformViewId,
|
||||
/*required*/ int/*!*/ scrollChildren,
|
||||
/*required*/ int/*!*/ scrollIndex,
|
||||
/*required*/ double/*!*/ scrollPosition,
|
||||
/*required*/ double/*!*/ scrollExtentMax,
|
||||
/*required*/ double/*!*/ scrollExtentMin,
|
||||
/*required*/ double/*!*/ elevation,
|
||||
/*required*/ double/*!*/ thickness,
|
||||
/*required*/ Rect/*!*/ rect,
|
||||
/*required*/ String/*!*/ label,
|
||||
/*required*/ String/*!*/ hint,
|
||||
/*required*/ String/*!*/ value,
|
||||
/*required*/ String/*!*/ increasedValue,
|
||||
/*required*/ String/*!*/ decreasedValue,
|
||||
int/*!*/ id,
|
||||
int/*!*/ flags,
|
||||
int/*!*/ actions,
|
||||
int/*!*/ maxValueLength,
|
||||
int/*!*/ currentValueLength,
|
||||
int/*!*/ textSelectionBase,
|
||||
int/*!*/ textSelectionExtent,
|
||||
int/*!*/ platformViewId,
|
||||
int/*!*/ scrollChildren,
|
||||
int/*!*/ scrollIndex,
|
||||
double/*!*/ scrollPosition,
|
||||
double/*!*/ scrollExtentMax,
|
||||
double/*!*/ scrollExtentMin,
|
||||
double/*!*/ elevation,
|
||||
double/*!*/ thickness,
|
||||
Rect/*!*/ rect,
|
||||
String/*!*/ label,
|
||||
String/*!*/ hint,
|
||||
String/*!*/ value,
|
||||
String/*!*/ increasedValue,
|
||||
String/*!*/ decreasedValue,
|
||||
TextDirection/*?*/ textDirection,
|
||||
/*required*/ Float64List/*!*/ transform,
|
||||
/*required*/ Int32List/*!*/ childrenInTraversalOrder,
|
||||
/*required*/ Int32List/*!*/ childrenInHitTestOrder,
|
||||
/*required*/ Int32List/*!*/ additionalActions,
|
||||
Float64List/*!*/ transform,
|
||||
Int32List/*!*/ childrenInTraversalOrder,
|
||||
Int32List/*!*/ childrenInHitTestOrder,
|
||||
Int32List/*!*/ additionalActions,
|
||||
}) {
|
||||
if (transform.length != 16)
|
||||
throw ArgumentError('transform argument must have 16 entries.');
|
||||
@@ -727,7 +727,7 @@ class SemanticsUpdateBuilder {
|
||||
}
|
||||
|
||||
void updateCustomAction(
|
||||
{/*required*/ int/*!*/ id, String/*?*/ label, String/*?*/ hint, int/*!*/ overrideId = -1}) {
|
||||
{int/*!*/ id, String/*?*/ label, String/*?*/ hint, int/*!*/ overrideId = -1}) {
|
||||
// TODO(yjbanov): implement.
|
||||
}
|
||||
|
||||
|
||||
@@ -86,13 +86,6 @@ void main() {
|
||||
checkEquality(B, B);
|
||||
});
|
||||
|
||||
test('ImageFilter - nulls', () async {
|
||||
final Paint paint = Paint()..imageFilter = ImageFilter.blur(sigmaX: null, sigmaY: null);
|
||||
expect(paint.imageFilter, equals(ImageFilter.blur()));
|
||||
|
||||
expect(() => ImageFilter.matrix(null), throwsNoSuchMethodError);
|
||||
});
|
||||
|
||||
void checkBytes(Uint32List bytes, int center, int side, int corner) {
|
||||
expect(bytes[0], equals(corner));
|
||||
expect(bytes[1], equals(side));
|
||||
|
||||
@@ -115,7 +115,7 @@ void main() {
|
||||
|
||||
// basic tests on horizontal line
|
||||
final PathMetrics simpleHorizontalMetrics = simpleHorizontalLine.computeMetrics();
|
||||
expect(simpleHorizontalMetrics.iterator.current, isNull);
|
||||
expect(() => simpleHorizontalMetrics.iterator.current, throwsRangeError);
|
||||
expect(simpleHorizontalMetrics.iterator.moveNext(), isTrue);
|
||||
expect(simpleHorizontalMetrics.iterator.current, isNotNull);
|
||||
expect(simpleHorizontalMetrics.iterator.current.length, equals(10.0));
|
||||
@@ -128,11 +128,11 @@ void main() {
|
||||
expect(posTan.angle, equals(0.0));
|
||||
|
||||
expect(simpleHorizontalMetrics.iterator.moveNext(), isFalse);
|
||||
expect(simpleHorizontalMetrics.iterator.current, isNull);
|
||||
expect(() => simpleHorizontalMetrics.iterator.current, throwsRangeError);
|
||||
|
||||
// test with forceClosed
|
||||
final PathMetrics simpleMetricsClosed = simpleHorizontalLine.computeMetrics(forceClosed: true);
|
||||
expect(simpleMetricsClosed.iterator.current, isNull);
|
||||
expect(() => simpleHorizontalMetrics.iterator.current, throwsRangeError);
|
||||
expect(simpleMetricsClosed.iterator.moveNext(), isTrue);
|
||||
expect(simpleMetricsClosed.iterator.current, isNotNull);
|
||||
expect(simpleMetricsClosed.iterator.current.length, equals(20.0)); // because we forced close
|
||||
@@ -163,7 +163,7 @@ void main() {
|
||||
..lineTo(10.0, 15.0);
|
||||
|
||||
final PathMetrics multiContourMetric = multiContour.computeMetrics();
|
||||
expect(multiContourMetric.iterator.current, isNull);
|
||||
expect(() => multiContourMetric.iterator.current, throwsRangeError);
|
||||
expect(multiContourMetric.iterator.moveNext(), isTrue);
|
||||
expect(multiContourMetric.iterator.current, isNotNull);
|
||||
expect(multiContourMetric.iterator.current.length, equals(10.0));
|
||||
@@ -171,7 +171,7 @@ void main() {
|
||||
expect(multiContourMetric.iterator.current, isNotNull);
|
||||
expect(multiContourMetric.iterator.current.length, equals(5.0));
|
||||
expect(multiContourMetric.iterator.moveNext(), isFalse);
|
||||
expect(multiContourMetric.iterator.current, isNull);
|
||||
expect(() => multiContourMetric.iterator.current, throwsRangeError);
|
||||
});
|
||||
|
||||
test('PathMetrics can remember lengths and isClosed', () {
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.9
|
||||
|
||||
// HACK: pretend to be dart.ui in order to access its internals
|
||||
// @dart = 2.6
|
||||
library dart.ui;
|
||||
|
||||
import 'dart:async';
|
||||
@@ -16,8 +17,6 @@ import 'dart:nativewrappers'; // ignore: unused_import
|
||||
import 'dart:typed_data';
|
||||
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// HACK: these parts are to get access to private functions tested here.
|
||||
part '../../lib/ui/annotations.dart';
|
||||
part '../../lib/ui/channel_buffers.dart';
|
||||
@@ -34,362 +33,395 @@ part '../../lib/ui/text.dart';
|
||||
part '../../lib/ui/window.dart';
|
||||
|
||||
void main() {
|
||||
group('window callback zones', () {
|
||||
VoidCallback originalOnMetricsChanged;
|
||||
VoidCallback originalOnLocaleChanged;
|
||||
FrameCallback originalOnBeginFrame;
|
||||
VoidCallback originalOnDrawFrame;
|
||||
TimingsCallback originalOnReportTimings;
|
||||
PointerDataPacketCallback originalOnPointerDataPacket;
|
||||
VoidCallback originalOnSemanticsEnabledChanged;
|
||||
SemanticsActionCallback originalOnSemanticsAction;
|
||||
PlatformMessageCallback originalOnPlatformMessage;
|
||||
VoidCallback originalOnTextScaleFactorChanged;
|
||||
VoidCallback? originalOnMetricsChanged;
|
||||
VoidCallback? originalOnLocaleChanged;
|
||||
FrameCallback? originalOnBeginFrame;
|
||||
VoidCallback? originalOnDrawFrame;
|
||||
TimingsCallback? originalOnReportTimings;
|
||||
PointerDataPacketCallback? originalOnPointerDataPacket;
|
||||
VoidCallback? originalOnSemanticsEnabledChanged;
|
||||
SemanticsActionCallback? originalOnSemanticsAction;
|
||||
PlatformMessageCallback? originalOnPlatformMessage;
|
||||
VoidCallback? originalOnTextScaleFactorChanged;
|
||||
|
||||
double oldDPR;
|
||||
Size oldSize;
|
||||
double oldDepth;
|
||||
WindowPadding oldPadding;
|
||||
WindowPadding oldInsets;
|
||||
WindowPadding oldSystemGestureInsets;
|
||||
double? oldDPR;
|
||||
Size? oldSize;
|
||||
double? oldDepth;
|
||||
WindowPadding? oldPadding;
|
||||
WindowPadding? oldInsets;
|
||||
WindowPadding? oldSystemGestureInsets;
|
||||
|
||||
setUp(() {
|
||||
oldDPR = window.devicePixelRatio;
|
||||
oldSize = window.physicalSize;
|
||||
oldDepth = window.physicalDepth;
|
||||
oldPadding = window.viewPadding;
|
||||
oldInsets = window.viewInsets;
|
||||
oldSystemGestureInsets = window.systemGestureInsets;
|
||||
void setUp() {
|
||||
oldDPR = window.devicePixelRatio;
|
||||
oldSize = window.physicalSize;
|
||||
oldDepth = window.physicalDepth;
|
||||
oldPadding = window.viewPadding;
|
||||
oldInsets = window.viewInsets;
|
||||
oldSystemGestureInsets = window.systemGestureInsets;
|
||||
|
||||
originalOnMetricsChanged = window.onMetricsChanged;
|
||||
originalOnLocaleChanged = window.onLocaleChanged;
|
||||
originalOnBeginFrame = window.onBeginFrame;
|
||||
originalOnDrawFrame = window.onDrawFrame;
|
||||
originalOnReportTimings = window.onReportTimings;
|
||||
originalOnPointerDataPacket = window.onPointerDataPacket;
|
||||
originalOnSemanticsEnabledChanged = window.onSemanticsEnabledChanged;
|
||||
originalOnSemanticsAction = window.onSemanticsAction;
|
||||
originalOnPlatformMessage = window.onPlatformMessage;
|
||||
originalOnTextScaleFactorChanged = window.onTextScaleFactorChanged;
|
||||
originalOnMetricsChanged = window.onMetricsChanged;
|
||||
originalOnLocaleChanged = window.onLocaleChanged;
|
||||
originalOnBeginFrame = window.onBeginFrame;
|
||||
originalOnDrawFrame = window.onDrawFrame;
|
||||
originalOnReportTimings = window.onReportTimings;
|
||||
originalOnPointerDataPacket = window.onPointerDataPacket;
|
||||
originalOnSemanticsEnabledChanged = window.onSemanticsEnabledChanged;
|
||||
originalOnSemanticsAction = window.onSemanticsAction;
|
||||
originalOnPlatformMessage = window.onPlatformMessage;
|
||||
originalOnTextScaleFactorChanged = window.onTextScaleFactorChanged;
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
_updateWindowMetrics(
|
||||
oldDPR!, // DPR
|
||||
oldSize!.width, // width
|
||||
oldSize!.height, // height
|
||||
oldDepth!, // depth
|
||||
oldPadding!.top, // padding top
|
||||
oldPadding!.right, // padding right
|
||||
oldPadding!.bottom, // padding bottom
|
||||
oldPadding!.left, // padding left
|
||||
oldInsets!.top, // inset top
|
||||
oldInsets!.right, // inset right
|
||||
oldInsets!.bottom, // inset bottom
|
||||
oldInsets!.left, // inset left
|
||||
oldSystemGestureInsets!.top, // system gesture inset top
|
||||
oldSystemGestureInsets!.right, // system gesture inset right
|
||||
oldSystemGestureInsets!.bottom, // system gesture inset bottom
|
||||
oldSystemGestureInsets!.left, // system gesture inset left
|
||||
);
|
||||
window.onMetricsChanged = originalOnMetricsChanged;
|
||||
window.onLocaleChanged = originalOnLocaleChanged;
|
||||
window.onBeginFrame = originalOnBeginFrame;
|
||||
window.onDrawFrame = originalOnDrawFrame;
|
||||
window.onReportTimings = originalOnReportTimings;
|
||||
window.onPointerDataPacket = originalOnPointerDataPacket;
|
||||
window.onSemanticsEnabledChanged = originalOnSemanticsEnabledChanged;
|
||||
window.onSemanticsAction = originalOnSemanticsAction;
|
||||
window.onPlatformMessage = originalOnPlatformMessage;
|
||||
window.onTextScaleFactorChanged = originalOnTextScaleFactorChanged;
|
||||
}
|
||||
|
||||
void test(String description, void Function() testFunction) {
|
||||
print(description);
|
||||
setUp();
|
||||
testFunction();
|
||||
tearDown();
|
||||
}
|
||||
|
||||
void expectEquals(dynamic actual, dynamic expected) {
|
||||
if (actual != expected) {
|
||||
throw Exception('Equality check failed:\n Expected: $expected\n Actual: $actual');
|
||||
}
|
||||
}
|
||||
|
||||
void expectIterablesEqual(Iterable<dynamic> actual, Iterable<dynamic> expected) {
|
||||
expectEquals(actual.length, expected.length);
|
||||
final Iterator<dynamic> actualIter = actual.iterator;
|
||||
final Iterator<dynamic> expectedIter = expected.iterator;
|
||||
while (expectedIter.moveNext()) {
|
||||
expectEquals(actualIter.moveNext(), true);
|
||||
expectEquals(actualIter.current, expectedIter.current);
|
||||
}
|
||||
expectEquals(actualIter.moveNext(), false);
|
||||
}
|
||||
|
||||
void expectNotEquals(dynamic actual, dynamic expected) {
|
||||
if (actual == expected) {
|
||||
throw Exception('Inequality check failed:\n Expected: $expected\n Actual: $actual');
|
||||
}
|
||||
}
|
||||
|
||||
void expectIdentical(dynamic actual, dynamic expected) {
|
||||
if (!identical(actual, expected)) {
|
||||
throw Exception('Identity check failed:\n Expected: $expected\n Actual: $actual');
|
||||
}
|
||||
}
|
||||
|
||||
test('updateUserSettings can handle an empty object', () {
|
||||
// this should not throw.
|
||||
_updateUserSettingsData('{}');
|
||||
});
|
||||
|
||||
test('onMetricsChanged preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
late double devicePixelRatio;
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onMetricsChanged = () {
|
||||
runZone = Zone.current;
|
||||
devicePixelRatio = window.devicePixelRatio;
|
||||
};
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
_updateWindowMetrics(
|
||||
oldDPR, // DPR
|
||||
oldSize.width, // width
|
||||
oldSize.height, // height
|
||||
oldDepth, // depth
|
||||
oldPadding.top, // padding top
|
||||
oldPadding.right, // padding right
|
||||
oldPadding.bottom, // padding bottom
|
||||
oldPadding.left, // padding left
|
||||
oldInsets.top, // inset top
|
||||
oldInsets.right, // inset right
|
||||
oldInsets.bottom, // inset bottom
|
||||
oldInsets.left, // inset left
|
||||
oldSystemGestureInsets.top, // system gesture inset top
|
||||
oldSystemGestureInsets.right, // system gesture inset right
|
||||
oldSystemGestureInsets.bottom, // system gesture inset bottom
|
||||
oldSystemGestureInsets.left, // system gesture inset left
|
||||
);
|
||||
window.onMetricsChanged = originalOnMetricsChanged;
|
||||
window.onLocaleChanged = originalOnLocaleChanged;
|
||||
window.onBeginFrame = originalOnBeginFrame;
|
||||
window.onDrawFrame = originalOnDrawFrame;
|
||||
window.onReportTimings = originalOnReportTimings;
|
||||
window.onPointerDataPacket = originalOnPointerDataPacket;
|
||||
window.onSemanticsEnabledChanged = originalOnSemanticsEnabledChanged;
|
||||
window.onSemanticsAction = originalOnSemanticsAction;
|
||||
window.onPlatformMessage = originalOnPlatformMessage;
|
||||
window.onTextScaleFactorChanged = originalOnTextScaleFactorChanged;
|
||||
window.onMetricsChanged!();
|
||||
_updateWindowMetrics(
|
||||
0.1234, // DPR
|
||||
0.0, // width
|
||||
0.0, // height
|
||||
0.0, // depth
|
||||
0.0, // padding top
|
||||
0.0, // padding right
|
||||
0.0, // padding bottom
|
||||
0.0, // padding left
|
||||
0.0, // inset top
|
||||
0.0, // inset right
|
||||
0.0, // inset bottom
|
||||
0.0, // inset left
|
||||
0.0, // system gesture inset top
|
||||
0.0, // system gesture inset right
|
||||
0.0, // system gesture inset bottom
|
||||
0.0, // system gesture inset left
|
||||
);
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
expectEquals(devicePixelRatio, 0.1234);
|
||||
});
|
||||
|
||||
test('onLocaleChanged preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
Locale? locale;
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onLocaleChanged = () {
|
||||
runZone = Zone.current;
|
||||
locale = window.locale;
|
||||
};
|
||||
});
|
||||
|
||||
test('updateUserSettings can handle an empty object', () {
|
||||
// this should now throw.
|
||||
_updateUserSettingsData('{}');
|
||||
expect(true, equals(true));
|
||||
_updateLocales(<String>['en', 'US', '', '']);
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
expectEquals(locale, const Locale('en', 'US'));
|
||||
});
|
||||
|
||||
test('onBeginFrame preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
late Duration start;
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onBeginFrame = (Duration value) {
|
||||
runZone = Zone.current;
|
||||
start = value;
|
||||
};
|
||||
});
|
||||
|
||||
test('onMetricsChanged preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
double devicePixelRatio;
|
||||
_beginFrame(1234);
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
expectEquals(start, const Duration(microseconds: 1234));
|
||||
});
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onMetricsChanged = () {
|
||||
runZone = Zone.current;
|
||||
devicePixelRatio = window.devicePixelRatio;
|
||||
};
|
||||
});
|
||||
test('onDrawFrame preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
|
||||
window.onMetricsChanged();
|
||||
_updateWindowMetrics(
|
||||
0.1234, // DPR
|
||||
0.0, // width
|
||||
0.0, // height
|
||||
0.0, // depth
|
||||
0.0, // padding top
|
||||
0.0, // padding right
|
||||
0.0, // padding bottom
|
||||
0.0, // padding left
|
||||
0.0, // inset top
|
||||
0.0, // inset right
|
||||
0.0, // inset bottom
|
||||
0.0, // inset left
|
||||
0.0, // system gesture inset top
|
||||
0.0, // system gesture inset right
|
||||
0.0, // system gesture inset bottom
|
||||
0.0, // system gesture inset left
|
||||
);
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
expect(devicePixelRatio, equals(0.1234));
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onDrawFrame = () {
|
||||
runZone = Zone.current;
|
||||
};
|
||||
});
|
||||
|
||||
test('onLocaleChanged preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
Locale locale;
|
||||
_drawFrame();
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
});
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onLocaleChanged = () {
|
||||
runZone = Zone.current;
|
||||
locale = window.locale;
|
||||
};
|
||||
});
|
||||
test('onReportTimings preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
|
||||
_updateLocales(<String>['en', 'US', '', '']);
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
expect(locale, equals(const Locale('en', 'US')));
|
||||
window._setNeedsReportTimings = (bool _) {};
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onReportTimings = (List<FrameTiming> timings) {
|
||||
runZone = Zone.current;
|
||||
};
|
||||
});
|
||||
|
||||
test('onBeginFrame preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
Duration start;
|
||||
_reportTimings(<int>[]);
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
});
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onBeginFrame = (Duration value) {
|
||||
runZone = Zone.current;
|
||||
start = value;
|
||||
};
|
||||
});
|
||||
test('onPointerDataPacket preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
late PointerDataPacket data;
|
||||
|
||||
_beginFrame(1234);
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
expect(start, equals(const Duration(microseconds: 1234)));
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onPointerDataPacket = (PointerDataPacket value) {
|
||||
runZone = Zone.current;
|
||||
data = value;
|
||||
};
|
||||
});
|
||||
|
||||
test('onDrawFrame preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
final ByteData testData = ByteData.view(Uint8List(0).buffer);
|
||||
_dispatchPointerDataPacket(testData);
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
expectIterablesEqual(data.data, _unpackPointerDataPacket(testData).data);
|
||||
});
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onDrawFrame = () {
|
||||
runZone = Zone.current;
|
||||
};
|
||||
});
|
||||
test('onSemanticsEnabledChanged preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
late bool enabled;
|
||||
|
||||
_drawFrame();
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onSemanticsEnabledChanged = () {
|
||||
runZone = Zone.current;
|
||||
enabled = window.semanticsEnabled;
|
||||
};
|
||||
});
|
||||
|
||||
test('onReportTimings preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
_updateSemanticsEnabled(window._semanticsEnabled);
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
expectNotEquals(enabled, null);
|
||||
expectEquals(enabled, window._semanticsEnabled);
|
||||
});
|
||||
|
||||
window._setNeedsReportTimings = (bool _) {};
|
||||
test('onSemanticsAction preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
late int id;
|
||||
late int action;
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onReportTimings = (List<FrameTiming> timings) {
|
||||
runZone = Zone.current;
|
||||
};
|
||||
});
|
||||
|
||||
_reportTimings(<int>[]);
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onSemanticsAction = (int i, SemanticsAction a, ByteData? _) {
|
||||
runZone = Zone.current;
|
||||
action = a.index;
|
||||
id = i;
|
||||
};
|
||||
});
|
||||
|
||||
test('onPointerDataPacket preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
PointerDataPacket data;
|
||||
_dispatchSemanticsAction(1234, 4, null);
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
expectEquals(id, 1234);
|
||||
expectEquals(action, 4);
|
||||
});
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onPointerDataPacket = (PointerDataPacket value) {
|
||||
runZone = Zone.current;
|
||||
data = value;
|
||||
};
|
||||
});
|
||||
test('onPlatformMessage preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
late String name;
|
||||
|
||||
final ByteData testData = ByteData.view(Uint8List(0).buffer);
|
||||
_dispatchPointerDataPacket(testData);
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
expect(data.data, equals(_unpackPointerDataPacket(testData).data));
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onPlatformMessage = (String value, _, __) {
|
||||
runZone = Zone.current;
|
||||
name = value;
|
||||
};
|
||||
});
|
||||
|
||||
test('onSemanticsEnabledChanged preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
bool enabled;
|
||||
_dispatchPlatformMessage('testName', null, 123456789);
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
expectEquals(name, 'testName');
|
||||
});
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onSemanticsEnabledChanged = () {
|
||||
runZone = Zone.current;
|
||||
enabled = window.semanticsEnabled;
|
||||
};
|
||||
});
|
||||
test('onTextScaleFactorChanged preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
late double textScaleFactor;
|
||||
|
||||
_updateSemanticsEnabled(window._semanticsEnabled);
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
expect(enabled, isNotNull);
|
||||
expect(enabled, equals(window._semanticsEnabled));
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onTextScaleFactorChanged = () {
|
||||
runZone = Zone.current;
|
||||
textScaleFactor = window.textScaleFactor;
|
||||
};
|
||||
});
|
||||
|
||||
test('onSemanticsAction preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
int id;
|
||||
int action;
|
||||
window.onTextScaleFactorChanged!();
|
||||
_updateTextScaleFactor(0.5);
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
expectEquals(textScaleFactor, 0.5);
|
||||
});
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onSemanticsAction = (int i, SemanticsAction a, ByteData _) {
|
||||
runZone = Zone.current;
|
||||
action = a.index;
|
||||
id = i;
|
||||
};
|
||||
});
|
||||
test('onThemeBrightnessMode preserves callback zone', () {
|
||||
late Zone innerZone;
|
||||
late Zone runZone;
|
||||
late Brightness platformBrightness;
|
||||
|
||||
_dispatchSemanticsAction(1234, 4, null);
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
expect(id, equals(1234));
|
||||
expect(action, equals(4));
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onPlatformBrightnessChanged = () {
|
||||
runZone = Zone.current;
|
||||
platformBrightness = window.platformBrightness;
|
||||
};
|
||||
});
|
||||
|
||||
test('onPlatformMessage preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
String name;
|
||||
window.onPlatformBrightnessChanged!();
|
||||
_updatePlatformBrightness('dark');
|
||||
expectNotEquals(runZone, null);
|
||||
expectIdentical(runZone, innerZone);
|
||||
expectEquals(platformBrightness, Brightness.dark);
|
||||
});
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onPlatformMessage = (String value, _, __) {
|
||||
runZone = Zone.current;
|
||||
name = value;
|
||||
};
|
||||
});
|
||||
test('Window padding/insets/viewPadding/systemGestureInsets', () {
|
||||
_updateWindowMetrics(
|
||||
1.0, // DPR
|
||||
800.0, // width
|
||||
600.0, // height
|
||||
100.0, // depth
|
||||
50.0, // padding top
|
||||
0.0, // padding right
|
||||
40.0, // padding bottom
|
||||
0.0, // padding left
|
||||
0.0, // inset top
|
||||
0.0, // inset right
|
||||
0.0, // inset bottom
|
||||
0.0, // inset left
|
||||
0.0, // system gesture inset top
|
||||
0.0, // system gesture inset right
|
||||
0.0, // system gesture inset bottom
|
||||
0.0, // system gesture inset left
|
||||
);
|
||||
|
||||
_dispatchPlatformMessage('testName', null, null);
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
expect(name, equals('testName'));
|
||||
});
|
||||
expectEquals(window.viewInsets.bottom, 0.0);
|
||||
expectEquals(window.viewPadding.bottom, 40.0);
|
||||
expectEquals(window.padding.bottom, 40.0);
|
||||
expectEquals(window.physicalDepth, 100.0);
|
||||
expectEquals(window.systemGestureInsets.bottom, 0.0);
|
||||
|
||||
test('onTextScaleFactorChanged preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
double textScaleFactor;
|
||||
_updateWindowMetrics(
|
||||
1.0, // DPR
|
||||
800.0, // width
|
||||
600.0, // height
|
||||
100.0, // depth
|
||||
50.0, // padding top
|
||||
0.0, // padding right
|
||||
40.0, // padding bottom
|
||||
0.0, // padding left
|
||||
0.0, // inset top
|
||||
0.0, // inset right
|
||||
400.0, // inset bottom
|
||||
0.0, // inset left
|
||||
0.0, // system gesture insets top
|
||||
0.0, // system gesture insets right
|
||||
44.0, // system gesture insets bottom
|
||||
0.0, // system gesture insets left
|
||||
);
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onTextScaleFactorChanged = () {
|
||||
runZone = Zone.current;
|
||||
textScaleFactor = window.textScaleFactor;
|
||||
};
|
||||
});
|
||||
|
||||
window.onTextScaleFactorChanged();
|
||||
_updateTextScaleFactor(0.5);
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
expect(textScaleFactor, equals(0.5));
|
||||
});
|
||||
|
||||
test('onThemeBrightnessMode preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
Brightness platformBrightness;
|
||||
|
||||
runZoned(() {
|
||||
innerZone = Zone.current;
|
||||
window.onPlatformBrightnessChanged = () {
|
||||
runZone = Zone.current;
|
||||
platformBrightness = window.platformBrightness;
|
||||
};
|
||||
});
|
||||
|
||||
window.onPlatformBrightnessChanged();
|
||||
_updatePlatformBrightness('dark');
|
||||
expect(runZone, isNotNull);
|
||||
expect(runZone, same(innerZone));
|
||||
expect(platformBrightness, equals(Brightness.dark));
|
||||
});
|
||||
|
||||
test('Window padding/insets/viewPadding/systemGestureInsets', () {
|
||||
_updateWindowMetrics(
|
||||
1.0, // DPR
|
||||
800.0, // width
|
||||
600.0, // height
|
||||
100.0, // depth
|
||||
50.0, // padding top
|
||||
0.0, // padding right
|
||||
40.0, // padding bottom
|
||||
0.0, // padding left
|
||||
0.0, // inset top
|
||||
0.0, // inset right
|
||||
0.0, // inset bottom
|
||||
0.0, // inset left
|
||||
0.0, // system gesture inset top
|
||||
0.0, // system gesture inset right
|
||||
0.0, // system gesture inset bottom
|
||||
0.0, // system gesture inset left
|
||||
);
|
||||
|
||||
expect(window.viewInsets.bottom, 0.0);
|
||||
expect(window.viewPadding.bottom, 40.0);
|
||||
expect(window.padding.bottom, 40.0);
|
||||
expect(window.physicalDepth, 100.0);
|
||||
expect(window.systemGestureInsets.bottom, 0.0);
|
||||
|
||||
_updateWindowMetrics(
|
||||
1.0, // DPR
|
||||
800.0, // width
|
||||
600.0, // height
|
||||
100.0, // depth
|
||||
50.0, // padding top
|
||||
0.0, // padding right
|
||||
40.0, // padding bottom
|
||||
0.0, // padding left
|
||||
0.0, // inset top
|
||||
0.0, // inset right
|
||||
400.0, // inset bottom
|
||||
0.0, // inset left
|
||||
0.0, // system gesture insets top
|
||||
0.0, // system gesture insets right
|
||||
44.0, // system gesture insets bottom
|
||||
0.0, // system gesture insets left
|
||||
);
|
||||
|
||||
expect(window.viewInsets.bottom, 400.0);
|
||||
expect(window.viewPadding.bottom, 40.0);
|
||||
expect(window.padding.bottom, 0.0);
|
||||
expect(window.physicalDepth, 100.0);
|
||||
expect(window.systemGestureInsets.bottom, 44.0);
|
||||
});
|
||||
expectEquals(window.viewInsets.bottom, 400.0);
|
||||
expectEquals(window.viewPadding.bottom, 40.0);
|
||||
expectEquals(window.padding.bottom, 0.0);
|
||||
expectEquals(window.physicalDepth, 100.0);
|
||||
expectEquals(window.systemGestureInsets.bottom, 44.0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -183,6 +183,8 @@ def SnapshotTest(build_dir, dart_file, kernel_file_output, verbose_dart_snapshot
|
||||
snapshot_command = [
|
||||
dart,
|
||||
frontend_server,
|
||||
'--enable-experiment=non-nullable',
|
||||
'--no-null-safety',
|
||||
'--sdk-root',
|
||||
flutter_patched_sdk,
|
||||
'--incremental',
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:analyzer/analyzer.dart';
|
||||
import 'package:analyzer/dart/analysis/features.dart';
|
||||
|
||||
// Ignore members defined on Object.
|
||||
const Set<String> _kObjectMembers = <String>{
|
||||
@@ -14,9 +15,14 @@ const Set<String> _kObjectMembers = <String>{
|
||||
};
|
||||
|
||||
void main() {
|
||||
// TODO(yjbanov): fix and re-enable API conform test.
|
||||
if (!Platform.environment.containsKey('REALLY_DO_RUN_API_CONFORM_TEST')) {
|
||||
return;
|
||||
}
|
||||
// These files just contain imports to the part files;
|
||||
final FeatureSet analyzerFeatures = FeatureSet.fromEnableFlags(<String>['non-nullable']);
|
||||
final CompilationUnit uiUnit = parseDartFile('lib/ui/ui.dart',
|
||||
parseFunctionBodies: false, suppressErrors: false);
|
||||
parseFunctionBodies: false, suppressErrors: false, featureSet: analyzerFeatures);
|
||||
final CompilationUnit webUnit = parseDartFile('lib/web_ui/lib/ui.dart',
|
||||
parseFunctionBodies: false, suppressErrors: false);
|
||||
final Map<String, ClassDeclaration> uiClasses = <String, ClassDeclaration>{};
|
||||
@@ -24,7 +30,7 @@ void main() {
|
||||
|
||||
// Gather all public classes from each library. For now we are skiping
|
||||
// other top level members.
|
||||
_collectPublicClasses(uiUnit, uiClasses, 'lib/ui/');
|
||||
_collectPublicClasses(uiUnit, uiClasses, 'lib/ui/', analyzerFeatures: analyzerFeatures);
|
||||
_collectPublicClasses(webUnit, webClasses, 'lib/web_ui/lib/');
|
||||
|
||||
if (uiClasses.isEmpty || webClasses.isEmpty) {
|
||||
@@ -179,7 +185,7 @@ void main() {
|
||||
|
||||
// Collects all public classes defined by the part files of [unit].
|
||||
void _collectPublicClasses(CompilationUnit unit,
|
||||
Map<String, ClassDeclaration> destination, String root) {
|
||||
Map<String, ClassDeclaration> destination, String root, {FeatureSet analyzerFeatures}) {
|
||||
for (Directive directive in unit.directives) {
|
||||
if (directive is! PartDirective) {
|
||||
continue;
|
||||
@@ -190,6 +196,7 @@ void _collectPublicClasses(CompilationUnit unit,
|
||||
'$root${literalUri.substring(1, literalUri.length - 1)}',
|
||||
parseFunctionBodies: false,
|
||||
suppressErrors: false,
|
||||
featureSet: analyzerFeatures,
|
||||
);
|
||||
for (CompilationUnitMember member in subUnit.declarations) {
|
||||
if (member is! ClassDeclaration) {
|
||||
|
||||
Reference in New Issue
Block a user