mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Use Dart 2 camel case constants in the engine Dart libraries (#4766)
This commit is contained in:
parent
9c1e48434b
commit
e2c4b27600
@ -17,16 +17,16 @@ abstract class OffsetBase {
|
||||
final double _dx;
|
||||
final double _dy;
|
||||
|
||||
/// Returns true if either component is [double.INFINITY], and false if both
|
||||
/// Returns true if either component is [double.infinity], and false if both
|
||||
/// are finite (or negative infinity, or NaN).
|
||||
///
|
||||
/// This is different than comparing for equality with an instance that has
|
||||
/// _both_ components set to [double.INFINITY].
|
||||
/// _both_ components set to [double.infinity].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [isFinite], which is true if both components are finite (and not NaN).
|
||||
bool get isInfinite => _dx >= double.INFINITY || _dy >= double.INFINITY;
|
||||
bool get isInfinite => _dx >= double.infinity || _dy >= double.infinity;
|
||||
|
||||
/// Whether both components are finite (neither infinite nor NaN).
|
||||
///
|
||||
@ -183,7 +183,7 @@ class Offset extends OffsetBase {
|
||||
/// * [isInfinite], which checks whether either component is infinite.
|
||||
/// * [isFinite], which checks whether both components are finite.
|
||||
// This is included for completeness, because [Size.infinite] exists.
|
||||
static const Offset infinite = const Offset(double.INFINITY, double.INFINITY);
|
||||
static const Offset infinite = const Offset(double.infinity, double.infinity);
|
||||
|
||||
/// Returns a new offset with the x component scaled by `scaleX` and the y
|
||||
/// component scaled by `scaleY`.
|
||||
@ -352,10 +352,10 @@ class Size extends OffsetBase {
|
||||
const Size.square(double dimension) : super(dimension, dimension);
|
||||
|
||||
/// Creates a [Size] with the given [width] and an infinite [height].
|
||||
const Size.fromWidth(double width) : super(width, double.INFINITY);
|
||||
const Size.fromWidth(double width) : super(width, double.infinity);
|
||||
|
||||
/// Creates a [Size] with the given [height] and an infinite [width].
|
||||
const Size.fromHeight(double height) : super(double.INFINITY, height);
|
||||
const Size.fromHeight(double height) : super(double.infinity, height);
|
||||
|
||||
/// Creates a square [Size] whose [width] and [height] are twice the given
|
||||
/// dimension.
|
||||
@ -382,7 +382,7 @@ class Size extends OffsetBase {
|
||||
///
|
||||
/// * [isInfinite], which checks whether either dimension is infinite.
|
||||
/// * [isFinite], which checks whether both dimensions are finite.
|
||||
static const Size infinite = const Size(double.INFINITY, double.INFINITY);
|
||||
static const Size infinite = const Size(double.infinity, double.infinity);
|
||||
|
||||
/// Whether this size encloses a non-zero area.
|
||||
///
|
||||
@ -670,10 +670,10 @@ class Rect {
|
||||
/// Whether any of the coordinates of this rectangle are equal to positive infinity.
|
||||
// included for consistency with Offset and Size
|
||||
bool get isInfinite {
|
||||
return left >= double.INFINITY
|
||||
|| top >= double.INFINITY
|
||||
|| right >= double.INFINITY
|
||||
|| bottom >= double.INFINITY;
|
||||
return left >= double.infinity
|
||||
|| top >= double.infinity
|
||||
|| right >= double.infinity
|
||||
|| bottom >= double.infinity;
|
||||
}
|
||||
|
||||
/// Whether all coordinates of this rectangle are finite.
|
||||
|
||||
@ -5,11 +5,11 @@
|
||||
part of dart.ui;
|
||||
|
||||
String _decodeUTF8(ByteData message) {
|
||||
return message != null ? UTF8.decoder.convert(message.buffer.asUint8List()) : null;
|
||||
return message != null ? utf8.decoder.convert(message.buffer.asUint8List()) : null;
|
||||
}
|
||||
|
||||
dynamic _decodeJSON(String message) {
|
||||
return message != null ? JSON.decode(message) : null;
|
||||
return message != null ? json.decode(message) : null;
|
||||
}
|
||||
|
||||
void _updateWindowMetrics(double devicePixelRatio,
|
||||
@ -50,8 +50,8 @@ void _updateLocale(String languageCode, String countryCode) {
|
||||
_invoke(window.onLocaleChanged, window._onLocaleChangedZone);
|
||||
}
|
||||
|
||||
void _updateUserSettingsData(String json) {
|
||||
final Map<String, dynamic> data = JSON.decode(json);
|
||||
void _updateUserSettingsData(String jsonData) {
|
||||
final Map<String, dynamic> data = json.decode(jsonData);
|
||||
_updateTextScaleFactor(data['textScaleFactor'].toDouble());
|
||||
_updateAlwaysUse24HourFormat(data['alwaysUse24HourFormat']);
|
||||
}
|
||||
@ -174,7 +174,7 @@ void _invoke3<A1, A2, A3>(void callback(A1 a1, A2 a2, A3 a3), Zone zone, A1 arg1
|
||||
const int _kPointerDataFieldCount = 19;
|
||||
|
||||
PointerDataPacket _unpackPointerDataPacket(ByteData packet) {
|
||||
const int kStride = Int64List.BYTES_PER_ELEMENT;
|
||||
const int kStride = Int64List.bytesPerElement;
|
||||
const int kBytesPerPointerData = _kPointerDataFieldCount * kStride;
|
||||
final int length = packet.lengthInBytes ~/ kBytesPerPointerData;
|
||||
assert(length * kBytesPerPointerData == packet.lengthInBytes);
|
||||
|
||||
@ -22,7 +22,7 @@ Future<developer.ServiceExtensionResponse> _scheduleFrame(
|
||||
// Schedule the frame.
|
||||
window.scheduleFrame();
|
||||
// Always succeed.
|
||||
return new developer.ServiceExtensionResponse.result(JSON.encode(<String, String>{
|
||||
return new developer.ServiceExtensionResponse.result(json.encode(<String, String>{
|
||||
'type': 'Success',
|
||||
}));
|
||||
}
|
||||
|
||||
@ -838,9 +838,9 @@ enum PaintingStyle {
|
||||
}
|
||||
|
||||
// If we actually run on big endian machines, we'll need to do something smarter
|
||||
// here. We don't use [Endianness.HOST_ENDIAN] because it's not a compile-time
|
||||
// here. We don't use [Endian.Host] because it's not a compile-time
|
||||
// constant and can't propagate into the set/get calls.
|
||||
const Endianness _kFakeHostEndian = Endianness.LITTLE_ENDIAN;
|
||||
const Endian _kFakeHostEndian = Endian.little;
|
||||
|
||||
/// A description of the style to use when drawing on a [Canvas].
|
||||
///
|
||||
|
||||
@ -55,7 +55,7 @@ enum PointerDeviceKind {
|
||||
class PointerData {
|
||||
/// Creates an object that represents the state of a pointer.
|
||||
const PointerData({
|
||||
this.timeStamp: Duration.ZERO,
|
||||
this.timeStamp: Duration.zero,
|
||||
this.change: PointerChange.cancel,
|
||||
this.kind: PointerDeviceKind.touch,
|
||||
this.device: 0,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user