mirror of
https://github.com/flutter/flutter
synced 2024-08-24 18:36:03 +00:00
Add missing parameter to TableBorder.symmetric
, and improve class constructors (#144279)
Originally, my aim was just to refactor (as per usual), but while messing around with the `TableBorder.symmetric` constructor, I realized that `borderRadius` was missing! This pull request makes a few class constructors more efficient, and it fixes #144277 by adding the missing parameter. <br>
This commit is contained in:
parent
1d7f4a9afa
commit
1a0dc8f1e1
|
@ -76,7 +76,7 @@ ${parser.usage}
|
||||||
|
|
||||||
final FrameworkRepository framework = FrameworkRepository(
|
final FrameworkRepository framework = FrameworkRepository(
|
||||||
_localCheckouts(token),
|
_localCheckouts(token),
|
||||||
mirrorRemote: Remote.mirror(mirrorUrl),
|
mirrorRemote: const Remote.mirror(mirrorUrl),
|
||||||
upstreamRemote: Remote.upstream(upstreamUrl),
|
upstreamRemote: Remote.upstream(upstreamUrl),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -23,25 +23,11 @@ enum RemoteName {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Remote {
|
class Remote {
|
||||||
const Remote({
|
const Remote({required RemoteName name, required this.url})
|
||||||
required RemoteName name,
|
: _name = name, assert(url != '');
|
||||||
required this.url,
|
|
||||||
}) : _name = name,
|
|
||||||
assert(url != '');
|
|
||||||
|
|
||||||
factory Remote.mirror(String url) {
|
const Remote.mirror(String url) : this(name: RemoteName.mirror, url: url);
|
||||||
return Remote(
|
const Remote.upstream(String url) : this(name: RemoteName.upstream, url: url);
|
||||||
name: RemoteName.mirror,
|
|
||||||
url: url,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
factory Remote.upstream(String url) {
|
|
||||||
return Remote(
|
|
||||||
name: RemoteName.upstream,
|
|
||||||
url: url,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final RemoteName _name;
|
final RemoteName _name;
|
||||||
|
|
||||||
|
|
|
@ -422,18 +422,6 @@ Duration _computeAverageDuration(List<BlinkTraceEvent> events) {
|
||||||
/// See also:
|
/// See also:
|
||||||
/// * https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
|
/// * https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
|
||||||
class BlinkTraceEvent {
|
class BlinkTraceEvent {
|
||||||
BlinkTraceEvent._({
|
|
||||||
required this.args,
|
|
||||||
required this.cat,
|
|
||||||
required this.name,
|
|
||||||
required this.ph,
|
|
||||||
this.pid,
|
|
||||||
this.tid,
|
|
||||||
this.ts,
|
|
||||||
this.tts,
|
|
||||||
this.tdur,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// Parses an event from its JSON representation.
|
/// Parses an event from its JSON representation.
|
||||||
///
|
///
|
||||||
/// Sample event encoded as JSON (the data is bogus, this just shows the format):
|
/// Sample event encoded as JSON (the data is bogus, this just shows the format):
|
||||||
|
@ -458,19 +446,16 @@ class BlinkTraceEvent {
|
||||||
/// For detailed documentation of the format see:
|
/// For detailed documentation of the format see:
|
||||||
///
|
///
|
||||||
/// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
|
/// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
|
||||||
static BlinkTraceEvent fromJson(Map<String, dynamic> json) {
|
BlinkTraceEvent.fromJson(Map<String, dynamic> json)
|
||||||
return BlinkTraceEvent._(
|
: args = json['args'] as Map<String, dynamic>,
|
||||||
args: json['args'] as Map<String, dynamic>,
|
cat = json['cat'] as String,
|
||||||
cat: json['cat'] as String,
|
name = json['name'] as String,
|
||||||
name: json['name'] as String,
|
ph = json['ph'] as String,
|
||||||
ph: json['ph'] as String,
|
pid = _readInt(json, 'pid'),
|
||||||
pid: _readInt(json, 'pid'),
|
tid = _readInt(json, 'tid'),
|
||||||
tid: _readInt(json, 'tid'),
|
ts = _readInt(json, 'ts'),
|
||||||
ts: _readInt(json, 'ts'),
|
tts = _readInt(json, 'tts'),
|
||||||
tts: _readInt(json, 'tts'),
|
tdur = _readInt(json, 'tdur');
|
||||||
tdur: _readInt(json, 'tdur'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Event-specific data.
|
/// Event-specific data.
|
||||||
final Map<String, dynamic> args;
|
final Map<String, dynamic> args;
|
||||||
|
|
|
@ -22,8 +22,6 @@ import 'constants.dart';
|
||||||
///
|
///
|
||||||
/// * [AccessibilityNodeInfo](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo)
|
/// * [AccessibilityNodeInfo](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo)
|
||||||
class AndroidSemanticsNode {
|
class AndroidSemanticsNode {
|
||||||
AndroidSemanticsNode._(this._values);
|
|
||||||
|
|
||||||
/// Deserializes a new [AndroidSemanticsNode] from a json map.
|
/// Deserializes a new [AndroidSemanticsNode] from a json map.
|
||||||
///
|
///
|
||||||
/// The structure of the JSON:
|
/// The structure of the JSON:
|
||||||
|
@ -54,9 +52,7 @@ class AndroidSemanticsNode {
|
||||||
/// int,
|
/// int,
|
||||||
/// ]
|
/// ]
|
||||||
/// }
|
/// }
|
||||||
factory AndroidSemanticsNode.deserialize(String value) {
|
AndroidSemanticsNode.deserialize(String value) : _values = json.decode(value);
|
||||||
return AndroidSemanticsNode._(json.decode(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
final dynamic _values;
|
final dynamic _values;
|
||||||
final List<AndroidSemanticsNode> _children = <AndroidSemanticsNode>[];
|
final List<AndroidSemanticsNode> _children = <AndroidSemanticsNode>[];
|
||||||
|
|
|
@ -183,8 +183,8 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final SyntaxHighlighterStyle style = Theme.of(context).brightness == Brightness.dark
|
final SyntaxHighlighterStyle style = Theme.of(context).brightness == Brightness.dark
|
||||||
? SyntaxHighlighterStyle.darkThemeStyle()
|
? SyntaxHighlighterStyle.darkThemeStyle
|
||||||
: SyntaxHighlighterStyle.lightThemeStyle();
|
: SyntaxHighlighterStyle.lightThemeStyle;
|
||||||
|
|
||||||
Widget body;
|
Widget body;
|
||||||
if (_exampleCode == null) {
|
if (_exampleCode == null) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:string_scanner/string_scanner.dart';
|
import 'package:string_scanner/string_scanner.dart';
|
||||||
|
|
||||||
class SyntaxHighlighterStyle {
|
class SyntaxHighlighterStyle {
|
||||||
SyntaxHighlighterStyle({
|
const SyntaxHighlighterStyle({
|
||||||
this.baseStyle,
|
this.baseStyle,
|
||||||
this.numberStyle,
|
this.numberStyle,
|
||||||
this.commentStyle,
|
this.commentStyle,
|
||||||
|
@ -17,31 +17,27 @@ class SyntaxHighlighterStyle {
|
||||||
this.constantStyle,
|
this.constantStyle,
|
||||||
});
|
});
|
||||||
|
|
||||||
static SyntaxHighlighterStyle lightThemeStyle() {
|
static const SyntaxHighlighterStyle lightThemeStyle = SyntaxHighlighterStyle(
|
||||||
return SyntaxHighlighterStyle(
|
baseStyle: TextStyle(color: Color(0xFF000000)),
|
||||||
baseStyle: const TextStyle(color: Color(0xFF000000)),
|
numberStyle: TextStyle(color: Color(0xFF1565C0)),
|
||||||
numberStyle: const TextStyle(color: Color(0xFF1565C0)),
|
commentStyle: TextStyle(color: Color(0xFF9E9E9E)),
|
||||||
commentStyle: const TextStyle(color: Color(0xFF9E9E9E)),
|
keywordStyle: TextStyle(color: Color(0xFF9C27B0)),
|
||||||
keywordStyle: const TextStyle(color: Color(0xFF9C27B0)),
|
stringStyle: TextStyle(color: Color(0xFF43A047)),
|
||||||
stringStyle: const TextStyle(color: Color(0xFF43A047)),
|
punctuationStyle: TextStyle(color: Color(0xFF000000)),
|
||||||
punctuationStyle: const TextStyle(color: Color(0xFF000000)),
|
classStyle: TextStyle(color: Color(0xFF512DA8)),
|
||||||
classStyle: const TextStyle(color: Color(0xFF512DA8)),
|
constantStyle: TextStyle(color: Color(0xFF795548)),
|
||||||
constantStyle: const TextStyle(color: Color(0xFF795548)),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static SyntaxHighlighterStyle darkThemeStyle() {
|
static const SyntaxHighlighterStyle darkThemeStyle = SyntaxHighlighterStyle(
|
||||||
return SyntaxHighlighterStyle(
|
baseStyle: TextStyle(color: Color(0xFFFFFFFF)),
|
||||||
baseStyle: const TextStyle(color: Color(0xFFFFFFFF)),
|
numberStyle: TextStyle(color: Color(0xFF1565C0)),
|
||||||
numberStyle: const TextStyle(color: Color(0xFF1565C0)),
|
commentStyle: TextStyle(color: Color(0xFF9E9E9E)),
|
||||||
commentStyle: const TextStyle(color: Color(0xFF9E9E9E)),
|
keywordStyle: TextStyle(color: Color(0xFF80CBC4)),
|
||||||
keywordStyle: const TextStyle(color: Color(0xFF80CBC4)),
|
stringStyle: TextStyle(color: Color(0xFF009688)),
|
||||||
stringStyle: const TextStyle(color: Color(0xFF009688)),
|
punctuationStyle: TextStyle(color: Color(0xFFFFFFFF)),
|
||||||
punctuationStyle: const TextStyle(color: Color(0xFFFFFFFF)),
|
classStyle: TextStyle(color: Color(0xFF009688)),
|
||||||
classStyle: const TextStyle(color: Color(0xFF009688)),
|
constantStyle: TextStyle(color: Color(0xFF795548)),
|
||||||
constantStyle: const TextStyle(color: Color(0xFF795548)),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final TextStyle? baseStyle;
|
final TextStyle? baseStyle;
|
||||||
final TextStyle? numberStyle;
|
final TextStyle? numberStyle;
|
||||||
|
@ -60,7 +56,7 @@ abstract class SyntaxHighlighter {
|
||||||
class DartSyntaxHighlighter extends SyntaxHighlighter {
|
class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||||
DartSyntaxHighlighter([this._style]) {
|
DartSyntaxHighlighter([this._style]) {
|
||||||
_spans = <_HighlightSpan>[];
|
_spans = <_HighlightSpan>[];
|
||||||
_style ??= SyntaxHighlighterStyle.darkThemeStyle();
|
_style ??= SyntaxHighlighterStyle.darkThemeStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
SyntaxHighlighterStyle? _style;
|
SyntaxHighlighterStyle? _style;
|
||||||
|
|
|
@ -9,9 +9,7 @@ class TypographyTemplate extends TokenTemplate {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String generate() => '''
|
String generate() => '''
|
||||||
class _M3Typography {
|
abstract final class _M3Typography {
|
||||||
_M3Typography._();
|
|
||||||
|
|
||||||
${_textTheme('englishLike', 'alphabetic')}
|
${_textTheme('englishLike', 'alphabetic')}
|
||||||
|
|
||||||
${_textTheme('dense', 'ideographic')}
|
${_textTheme('dense', 'ideographic')}
|
||||||
|
|
|
@ -760,15 +760,15 @@ class OffsetPair {
|
||||||
|
|
||||||
/// Creates a [OffsetPair] from [PointerEvent.localPosition] and
|
/// Creates a [OffsetPair] from [PointerEvent.localPosition] and
|
||||||
/// [PointerEvent.position].
|
/// [PointerEvent.position].
|
||||||
factory OffsetPair.fromEventPosition(PointerEvent event) {
|
OffsetPair.fromEventPosition(PointerEvent event)
|
||||||
return OffsetPair(local: event.localPosition, global: event.position);
|
: local = event.localPosition,
|
||||||
}
|
global = event.position;
|
||||||
|
|
||||||
/// Creates a [OffsetPair] from [PointerEvent.localDelta] and
|
/// Creates a [OffsetPair] from [PointerEvent.localDelta] and
|
||||||
/// [PointerEvent.delta].
|
/// [PointerEvent.delta].
|
||||||
factory OffsetPair.fromEventDelta(PointerEvent event) {
|
OffsetPair.fromEventDelta(PointerEvent event)
|
||||||
return OffsetPair(local: event.localDelta, global: event.delta);
|
: local = event.localDelta,
|
||||||
}
|
global = event.delta;
|
||||||
|
|
||||||
/// A [OffsetPair] where both [Offset]s are [Offset.zero].
|
/// A [OffsetPair] where both [Offset]s are [Offset.zero].
|
||||||
static const OffsetPair zero = OffsetPair(local: Offset.zero, global: Offset.zero);
|
static const OffsetPair zero = OffsetPair(local: Offset.zero, global: Offset.zero);
|
||||||
|
|
|
@ -321,12 +321,6 @@ abstract class MaterialStateBorderSide extends BorderSide implements MaterialSta
|
||||||
/// const constructors so that they can be used in const expressions.
|
/// const constructors so that they can be used in const expressions.
|
||||||
const MaterialStateBorderSide();
|
const MaterialStateBorderSide();
|
||||||
|
|
||||||
/// Returns a [BorderSide] that's to be used when a Material component is
|
|
||||||
/// in the specified state. Return null to defer to the default value of the
|
|
||||||
/// widget or theme.
|
|
||||||
@override
|
|
||||||
BorderSide? resolve(Set<MaterialState> states);
|
|
||||||
|
|
||||||
/// Creates a [MaterialStateBorderSide] from a
|
/// Creates a [MaterialStateBorderSide] from a
|
||||||
/// [MaterialPropertyResolver<BorderSide?>] callback function.
|
/// [MaterialPropertyResolver<BorderSide?>] callback function.
|
||||||
///
|
///
|
||||||
|
@ -364,8 +358,13 @@ abstract class MaterialStateBorderSide extends BorderSide implements MaterialSta
|
||||||
/// }),
|
/// }),
|
||||||
/// ),
|
/// ),
|
||||||
/// ```
|
/// ```
|
||||||
static MaterialStateBorderSide resolveWith(MaterialPropertyResolver<BorderSide?> callback) =>
|
const factory MaterialStateBorderSide.resolveWith(MaterialPropertyResolver<BorderSide?> callback) = _MaterialStateBorderSide;
|
||||||
_MaterialStateBorderSide(callback);
|
|
||||||
|
/// Returns a [BorderSide] that's to be used when a Material component is
|
||||||
|
/// in the specified state. Return null to defer to the default value of the
|
||||||
|
/// widget or theme.
|
||||||
|
@override
|
||||||
|
BorderSide? resolve(Set<MaterialState> states);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [MaterialStateBorderSide] created from a
|
/// A [MaterialStateBorderSide] created from a
|
||||||
|
@ -381,9 +380,7 @@ class _MaterialStateBorderSide extends MaterialStateBorderSide {
|
||||||
final MaterialPropertyResolver<BorderSide?> _resolve;
|
final MaterialPropertyResolver<BorderSide?> _resolve;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
BorderSide? resolve(Set<MaterialState> states) {
|
BorderSide? resolve(Set<MaterialState> states) => _resolve(states);
|
||||||
return _resolve(states);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines an [OutlinedBorder] whose value depends on a set of [MaterialState]s
|
/// Defines an [OutlinedBorder] whose value depends on a set of [MaterialState]s
|
||||||
|
@ -457,8 +454,7 @@ abstract class MaterialStateTextStyle extends TextStyle implements MaterialState
|
||||||
///
|
///
|
||||||
/// The given callback parameter must return a non-null text style in the default
|
/// The given callback parameter must return a non-null text style in the default
|
||||||
/// state.
|
/// state.
|
||||||
static MaterialStateTextStyle resolveWith(MaterialPropertyResolver<TextStyle> callback) =>
|
const factory MaterialStateTextStyle.resolveWith(MaterialPropertyResolver<TextStyle> callback) = _MaterialStateTextStyle;
|
||||||
_MaterialStateTextStyle(callback);
|
|
||||||
|
|
||||||
/// Returns a [TextStyle] that's to be used when a Material component is in the
|
/// Returns a [TextStyle] that's to be used when a Material component is in the
|
||||||
/// specified state.
|
/// specified state.
|
||||||
|
@ -520,8 +516,7 @@ abstract class MaterialStateOutlineInputBorder extends OutlineInputBorder implem
|
||||||
///
|
///
|
||||||
/// The given callback parameter must return a non-null text style in the default
|
/// The given callback parameter must return a non-null text style in the default
|
||||||
/// state.
|
/// state.
|
||||||
static MaterialStateOutlineInputBorder resolveWith(MaterialPropertyResolver<InputBorder> callback) =>
|
const factory MaterialStateOutlineInputBorder.resolveWith(MaterialPropertyResolver<InputBorder> callback) = _MaterialStateOutlineInputBorder;
|
||||||
_MaterialStateOutlineInputBorder(callback);
|
|
||||||
|
|
||||||
/// Returns a [InputBorder] that's to be used when a Material component is in the
|
/// Returns a [InputBorder] that's to be used when a Material component is in the
|
||||||
/// specified state.
|
/// specified state.
|
||||||
|
@ -583,8 +578,7 @@ abstract class MaterialStateUnderlineInputBorder extends UnderlineInputBorder im
|
||||||
///
|
///
|
||||||
/// The given callback parameter must return a non-null text style in the default
|
/// The given callback parameter must return a non-null text style in the default
|
||||||
/// state.
|
/// state.
|
||||||
static MaterialStateUnderlineInputBorder resolveWith(MaterialPropertyResolver<InputBorder> callback) =>
|
const factory MaterialStateUnderlineInputBorder.resolveWith(MaterialPropertyResolver<InputBorder> callback) = _MaterialStateUnderlineInputBorder;
|
||||||
_MaterialStateUnderlineInputBorder(callback);
|
|
||||||
|
|
||||||
/// Returns a [InputBorder] that's to be used when a Material component is in the
|
/// Returns a [InputBorder] that's to be used when a Material component is in the
|
||||||
/// specified state.
|
/// specified state.
|
||||||
|
|
|
@ -64,7 +64,7 @@ class TimeOfDay {
|
||||||
///
|
///
|
||||||
/// The [hour] is set to the current hour and the [minute] is set to the
|
/// The [hour] is set to the current hour and the [minute] is set to the
|
||||||
/// current minute in the local time zone.
|
/// current minute in the local time zone.
|
||||||
factory TimeOfDay.now() { return TimeOfDay.fromDateTime(DateTime.now()); }
|
TimeOfDay.now() : this.fromDateTime(DateTime.now());
|
||||||
|
|
||||||
/// The number of hours in one day, i.e. 24.
|
/// The number of hours in one day, i.e. 24.
|
||||||
static const int hoursPerDay = 24;
|
static const int hoursPerDay = 24;
|
||||||
|
|
|
@ -745,9 +745,7 @@ class Typography with Diagnosticable {
|
||||||
// Design token database by the script:
|
// Design token database by the script:
|
||||||
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
// dev/tools/gen_defaults/bin/gen_defaults.dart.
|
||||||
|
|
||||||
class _M3Typography {
|
abstract final class _M3Typography {
|
||||||
_M3Typography._();
|
|
||||||
|
|
||||||
static const TextTheme englishLike = TextTheme(
|
static const TextTheme englishLike = TextTheme(
|
||||||
displayLarge: TextStyle(debugLabel: 'englishLike displayLarge 2021', inherit: false, fontSize: 57.0, fontWeight: FontWeight.w400, letterSpacing: -0.25, height: 1.12, textBaseline: TextBaseline.alphabetic, leadingDistribution: TextLeadingDistribution.even),
|
displayLarge: TextStyle(debugLabel: 'englishLike displayLarge 2021', inherit: false, fontSize: 57.0, fontWeight: FontWeight.w400, letterSpacing: -0.25, height: 1.12, textBaseline: TextBaseline.alphabetic, leadingDistribution: TextLeadingDistribution.even),
|
||||||
displayMedium: TextStyle(debugLabel: 'englishLike displayMedium 2021', inherit: false, fontSize: 45.0, fontWeight: FontWeight.w400, letterSpacing: 0.0, height: 1.16, textBaseline: TextBaseline.alphabetic, leadingDistribution: TextLeadingDistribution.even),
|
displayMedium: TextStyle(debugLabel: 'englishLike displayMedium 2021', inherit: false, fontSize: 45.0, fontWeight: FontWeight.w400, letterSpacing: 0.0, height: 1.16, textBaseline: TextBaseline.alphabetic, leadingDistribution: TextLeadingDistribution.even),
|
||||||
|
|
|
@ -26,9 +26,11 @@ class RelativeRect {
|
||||||
/// Creates a RelativeRect from a Rect and a Size. The Rect (first argument)
|
/// Creates a RelativeRect from a Rect and a Size. The Rect (first argument)
|
||||||
/// and the RelativeRect (the output) are in the coordinate space of the
|
/// and the RelativeRect (the output) are in the coordinate space of the
|
||||||
/// rectangle described by the Size, with 0,0 being at the top left.
|
/// rectangle described by the Size, with 0,0 being at the top left.
|
||||||
factory RelativeRect.fromSize(Rect rect, Size container) {
|
RelativeRect.fromSize(Rect rect, Size container)
|
||||||
return RelativeRect.fromLTRB(rect.left, rect.top, container.width - rect.right, container.height - rect.bottom);
|
: left = rect.left,
|
||||||
}
|
top = rect.top,
|
||||||
|
right = container.width - rect.right,
|
||||||
|
bottom = container.height - rect.bottom;
|
||||||
|
|
||||||
/// Creates a RelativeRect from two Rects. The second Rect provides the
|
/// Creates a RelativeRect from two Rects. The second Rect provides the
|
||||||
/// container, the first provides the rectangle, in the same coordinate space,
|
/// container, the first provides the rectangle, in the same coordinate space,
|
||||||
|
@ -42,14 +44,11 @@ class RelativeRect {
|
||||||
/// If the first rect is actually in the container's coordinate space, then
|
/// If the first rect is actually in the container's coordinate space, then
|
||||||
/// use [RelativeRect.fromSize] and pass the container's size as the second
|
/// use [RelativeRect.fromSize] and pass the container's size as the second
|
||||||
/// argument instead.
|
/// argument instead.
|
||||||
factory RelativeRect.fromRect(Rect rect, Rect container) {
|
RelativeRect.fromRect(Rect rect, Rect container)
|
||||||
return RelativeRect.fromLTRB(
|
: left = rect.left - container.left,
|
||||||
rect.left - container.left,
|
top = rect.top - container.top,
|
||||||
rect.top - container.top,
|
right = container.right - rect.right,
|
||||||
container.right - rect.right,
|
bottom = container.bottom - rect.bottom;
|
||||||
container.bottom - rect.bottom,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a RelativeRect from horizontal position using `start` and `end`
|
/// Creates a RelativeRect from horizontal position using `start` and `end`
|
||||||
/// rather than `left` and `right`.
|
/// rather than `left` and `right`.
|
||||||
|
|
|
@ -41,19 +41,16 @@ class TableBorder {
|
||||||
|
|
||||||
/// Creates a border for a table where all the interior sides use the same
|
/// Creates a border for a table where all the interior sides use the same
|
||||||
/// styling and all the exterior sides use the same styling.
|
/// styling and all the exterior sides use the same styling.
|
||||||
factory TableBorder.symmetric({
|
const TableBorder.symmetric({
|
||||||
BorderSide inside = BorderSide.none,
|
BorderSide inside = BorderSide.none,
|
||||||
BorderSide outside = BorderSide.none,
|
BorderSide outside = BorderSide.none,
|
||||||
}) {
|
this.borderRadius = BorderRadius.zero,
|
||||||
return TableBorder(
|
}) : top = outside,
|
||||||
top: outside,
|
right = outside,
|
||||||
right: outside,
|
bottom = outside,
|
||||||
bottom: outside,
|
left = outside,
|
||||||
left: outside,
|
horizontalInside = inside,
|
||||||
horizontalInside: inside,
|
verticalInside = inside;
|
||||||
verticalInside: inside,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The top side of this border.
|
/// The top side of this border.
|
||||||
final BorderSide top;
|
final BorderSide top;
|
||||||
|
|
|
@ -13,11 +13,7 @@ export 'text_input.dart' show TextEditingValue, TextInputClient, TextInputConfig
|
||||||
/// Each hint is pre-defined on at least one supported platform. See their
|
/// Each hint is pre-defined on at least one supported platform. See their
|
||||||
/// documentation for their availability on each platform, and the platform
|
/// documentation for their availability on each platform, and the platform
|
||||||
/// values each autofill hint corresponds to.
|
/// values each autofill hint corresponds to.
|
||||||
class AutofillHints {
|
abstract final class AutofillHints {
|
||||||
// This class is not meant to be instantiated or extended; this constructor
|
|
||||||
// prevents instantiation and extension.
|
|
||||||
AutofillHints._();
|
|
||||||
|
|
||||||
/// The input field expects an address locality (city/town).
|
/// The input field expects an address locality (city/town).
|
||||||
///
|
///
|
||||||
/// This hint will be translated to the below values on different platforms:
|
/// This hint will be translated to the below values on different platforms:
|
||||||
|
|
|
@ -12,11 +12,7 @@ import 'system_channels.dart';
|
||||||
/// See also:
|
/// See also:
|
||||||
/// * <https://developer.apple.com/documentation/uikit/uiresponder/3778577-capturetextfromcamera>
|
/// * <https://developer.apple.com/documentation/uikit/uiresponder/3778577-capturetextfromcamera>
|
||||||
/// * <https://support.apple.com/guide/iphone/use-live-text-iphcf0b71b0e/ios>
|
/// * <https://support.apple.com/guide/iphone/use-live-text-iphcf0b71b0e/ios>
|
||||||
class LiveText {
|
abstract final class LiveText {
|
||||||
// This class is not meant to be instantiated or extended; this constructor
|
|
||||||
// prevents instantiation and extension.
|
|
||||||
LiveText._();
|
|
||||||
|
|
||||||
/// Returns true if the Live Text input feature is available on the current device.
|
/// Returns true if the Live Text input feature is available on the current device.
|
||||||
static Future<bool> isLiveTextInputAvailable() async {
|
static Future<bool> isLiveTextInputAvailable() async {
|
||||||
final bool supportLiveTextInput =
|
final bool supportLiveTextInput =
|
||||||
|
|
|
@ -399,11 +399,7 @@ class SystemMouseCursor extends MouseCursor {
|
||||||
/// The cursors should be named based on the cursors' use cases instead of their
|
/// The cursors should be named based on the cursors' use cases instead of their
|
||||||
/// appearance, because different platforms might (although not commonly) use
|
/// appearance, because different platforms might (although not commonly) use
|
||||||
/// different shapes for the same use case.
|
/// different shapes for the same use case.
|
||||||
class SystemMouseCursors {
|
abstract final class SystemMouseCursors {
|
||||||
// This class only contains static members, and should not be instantiated or
|
|
||||||
// extended.
|
|
||||||
SystemMouseCursors._();
|
|
||||||
|
|
||||||
// The mapping in this class must be kept in sync with the following files in
|
// The mapping in this class must be kept in sync with the following files in
|
||||||
// the engine:
|
// the engine:
|
||||||
//
|
//
|
||||||
|
|
|
@ -91,6 +91,10 @@ abstract class TextInputFormatter {
|
||||||
/// This constructor enables subclasses to provide const constructors so that they can be used in const expressions.
|
/// This constructor enables subclasses to provide const constructors so that they can be used in const expressions.
|
||||||
const TextInputFormatter();
|
const TextInputFormatter();
|
||||||
|
|
||||||
|
/// A shorthand to creating a custom [TextInputFormatter] which formats
|
||||||
|
/// incoming text input changes with the given function.
|
||||||
|
const factory TextInputFormatter.withFunction(TextInputFormatFunction formatFunction) = _SimpleTextInputFormatter;
|
||||||
|
|
||||||
/// Called when text is being typed or cut/copy/pasted in the [EditableText].
|
/// Called when text is being typed or cut/copy/pasted in the [EditableText].
|
||||||
///
|
///
|
||||||
/// You can override the resulting text based on the previous text value and
|
/// You can override the resulting text based on the previous text value and
|
||||||
|
@ -102,14 +106,6 @@ abstract class TextInputFormatter {
|
||||||
TextEditingValue oldValue,
|
TextEditingValue oldValue,
|
||||||
TextEditingValue newValue,
|
TextEditingValue newValue,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// A shorthand to creating a custom [TextInputFormatter] which formats
|
|
||||||
/// incoming text input changes with the given function.
|
|
||||||
static TextInputFormatter withFunction(
|
|
||||||
TextInputFormatFunction formatFunction,
|
|
||||||
) {
|
|
||||||
return _SimpleTextInputFormatter(formatFunction);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function signature expected for creating custom [TextInputFormatter]
|
/// Function signature expected for creating custom [TextInputFormatter]
|
||||||
|
@ -121,7 +117,7 @@ typedef TextInputFormatFunction = TextEditingValue Function(
|
||||||
|
|
||||||
/// Wiring for [TextInputFormatter.withFunction].
|
/// Wiring for [TextInputFormatter.withFunction].
|
||||||
class _SimpleTextInputFormatter extends TextInputFormatter {
|
class _SimpleTextInputFormatter extends TextInputFormatter {
|
||||||
_SimpleTextInputFormatter(this.formatFunction);
|
const _SimpleTextInputFormatter(this.formatFunction);
|
||||||
|
|
||||||
final TextInputFormatFunction formatFunction;
|
final TextInputFormatFunction formatFunction;
|
||||||
|
|
||||||
|
|
|
@ -6763,10 +6763,8 @@ class RepaintBoundary extends SingleChildRenderObjectWidget {
|
||||||
///
|
///
|
||||||
/// The key for the [RepaintBoundary] is derived either from the child's key
|
/// The key for the [RepaintBoundary] is derived either from the child's key
|
||||||
/// (if the child has a non-null key) or from the given `childIndex`.
|
/// (if the child has a non-null key) or from the given `childIndex`.
|
||||||
factory RepaintBoundary.wrap(Widget child, int childIndex) {
|
RepaintBoundary.wrap(Widget child, int childIndex)
|
||||||
final Key key = child.key != null ? ValueKey<Key>(child.key!) : ValueKey<int>(childIndex);
|
: super(key: ValueKey<Object>(child.key ?? childIndex), child: child);
|
||||||
return RepaintBoundary(key: key, child: child);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Wraps each of the given children in [RepaintBoundary]s.
|
/// Wraps each of the given children in [RepaintBoundary]s.
|
||||||
///
|
///
|
||||||
|
@ -7557,16 +7555,11 @@ class IndexedSemantics extends SingleChildRenderObjectWidget {
|
||||||
/// Useful for attaching a key to an existing widget.
|
/// Useful for attaching a key to an existing widget.
|
||||||
class KeyedSubtree extends StatelessWidget {
|
class KeyedSubtree extends StatelessWidget {
|
||||||
/// Creates a widget that builds its child.
|
/// Creates a widget that builds its child.
|
||||||
const KeyedSubtree({
|
const KeyedSubtree({super.key, required this.child});
|
||||||
super.key,
|
|
||||||
required this.child,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// Creates a KeyedSubtree for child with a key that's based on the child's existing key or childIndex.
|
/// Creates a KeyedSubtree for child with a key that's based on the child's existing key or childIndex.
|
||||||
factory KeyedSubtree.wrap(Widget child, int childIndex) {
|
KeyedSubtree.wrap(this.child, int childIndex)
|
||||||
final Key key = child.key != null ? ValueKey<Key>(child.key!) : ValueKey<int>(childIndex);
|
: super(key: ValueKey<Object>(child.key ?? childIndex));
|
||||||
return KeyedSubtree(key: key, child: child);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The widget below this widget in the tree.
|
/// The widget below this widget in the tree.
|
||||||
///
|
///
|
||||||
|
|
|
@ -190,7 +190,7 @@ class MediaQueryData {
|
||||||
'This constructor was deprecated in preparation for the upcoming multi-window support. '
|
'This constructor was deprecated in preparation for the upcoming multi-window support. '
|
||||||
'This feature was deprecated after v3.7.0-32.0.pre.'
|
'This feature was deprecated after v3.7.0-32.0.pre.'
|
||||||
)
|
)
|
||||||
factory MediaQueryData.fromWindow(ui.FlutterView window) => MediaQueryData.fromView(window);
|
factory MediaQueryData.fromWindow(ui.FlutterView window) = MediaQueryData.fromView;
|
||||||
|
|
||||||
/// Creates data for a [MediaQuery] based on the given `view`.
|
/// Creates data for a [MediaQuery] based on the given `view`.
|
||||||
///
|
///
|
||||||
|
@ -924,29 +924,23 @@ class MediaQuery extends InheritedModel<_MediaQueryAspect> {
|
||||||
/// adds a [Padding] widget.
|
/// adds a [Padding] widget.
|
||||||
/// * [MediaQueryData.padding], the affected property of the
|
/// * [MediaQueryData.padding], the affected property of the
|
||||||
/// [MediaQueryData].
|
/// [MediaQueryData].
|
||||||
/// * [removeViewInsets], the same thing but for [MediaQueryData.viewInsets].
|
/// * [MediaQuery.removeViewInsets], the same thing but for [MediaQueryData.viewInsets].
|
||||||
/// * [removeViewPadding], the same thing but for
|
/// * [MediaQuery.removeViewPadding], the same thing but for
|
||||||
/// [MediaQueryData.viewPadding].
|
/// [MediaQueryData.viewPadding].
|
||||||
factory MediaQuery.removePadding({
|
MediaQuery.removePadding({
|
||||||
Key? key,
|
super.key,
|
||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
bool removeLeft = false,
|
bool removeLeft = false,
|
||||||
bool removeTop = false,
|
bool removeTop = false,
|
||||||
bool removeRight = false,
|
bool removeRight = false,
|
||||||
bool removeBottom = false,
|
bool removeBottom = false,
|
||||||
required Widget child,
|
required super.child,
|
||||||
}) {
|
}) : data = MediaQuery.of(context).removePadding(
|
||||||
return MediaQuery(
|
|
||||||
key: key,
|
|
||||||
data: MediaQuery.of(context).removePadding(
|
|
||||||
removeLeft: removeLeft,
|
removeLeft: removeLeft,
|
||||||
removeTop: removeTop,
|
removeTop: removeTop,
|
||||||
removeRight: removeRight,
|
removeRight: removeRight,
|
||||||
removeBottom: removeBottom,
|
removeBottom: removeBottom,
|
||||||
),
|
);
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
|
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
|
||||||
/// from the given context, but removes the specified view insets.
|
/// from the given context, but removes the specified view insets.
|
||||||
|
@ -966,29 +960,23 @@ class MediaQuery extends InheritedModel<_MediaQueryAspect> {
|
||||||
///
|
///
|
||||||
/// * [MediaQueryData.viewInsets], the affected property of the
|
/// * [MediaQueryData.viewInsets], the affected property of the
|
||||||
/// [MediaQueryData].
|
/// [MediaQueryData].
|
||||||
/// * [removePadding], the same thing but for [MediaQueryData.padding].
|
/// * [MediaQuery.removePadding], the same thing but for [MediaQueryData.padding].
|
||||||
/// * [removeViewPadding], the same thing but for
|
/// * [MediaQuery.removeViewPadding], the same thing but for
|
||||||
/// [MediaQueryData.viewPadding].
|
/// [MediaQueryData.viewPadding].
|
||||||
factory MediaQuery.removeViewInsets({
|
MediaQuery.removeViewInsets({
|
||||||
Key? key,
|
super.key,
|
||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
bool removeLeft = false,
|
bool removeLeft = false,
|
||||||
bool removeTop = false,
|
bool removeTop = false,
|
||||||
bool removeRight = false,
|
bool removeRight = false,
|
||||||
bool removeBottom = false,
|
bool removeBottom = false,
|
||||||
required Widget child,
|
required super.child,
|
||||||
}) {
|
}) : data = MediaQuery.of(context).removeViewInsets(
|
||||||
return MediaQuery(
|
|
||||||
key: key,
|
|
||||||
data: MediaQuery.of(context).removeViewInsets(
|
|
||||||
removeLeft: removeLeft,
|
removeLeft: removeLeft,
|
||||||
removeTop: removeTop,
|
removeTop: removeTop,
|
||||||
removeRight: removeRight,
|
removeRight: removeRight,
|
||||||
removeBottom: removeBottom,
|
removeBottom: removeBottom,
|
||||||
),
|
);
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
|
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
|
||||||
/// from the given context, but removes the specified view padding.
|
/// from the given context, but removes the specified view padding.
|
||||||
|
@ -1008,28 +996,22 @@ class MediaQuery extends InheritedModel<_MediaQueryAspect> {
|
||||||
///
|
///
|
||||||
/// * [MediaQueryData.viewPadding], the affected property of the
|
/// * [MediaQueryData.viewPadding], the affected property of the
|
||||||
/// [MediaQueryData].
|
/// [MediaQueryData].
|
||||||
/// * [removePadding], the same thing but for [MediaQueryData.padding].
|
/// * [MediaQuery.removePadding], the same thing but for [MediaQueryData.padding].
|
||||||
/// * [removeViewInsets], the same thing but for [MediaQueryData.viewInsets].
|
/// * [MediaQuery.removeViewInsets], the same thing but for [MediaQueryData.viewInsets].
|
||||||
factory MediaQuery.removeViewPadding({
|
MediaQuery.removeViewPadding({
|
||||||
Key? key,
|
super.key,
|
||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
bool removeLeft = false,
|
bool removeLeft = false,
|
||||||
bool removeTop = false,
|
bool removeTop = false,
|
||||||
bool removeRight = false,
|
bool removeRight = false,
|
||||||
bool removeBottom = false,
|
bool removeBottom = false,
|
||||||
required Widget child,
|
required super.child,
|
||||||
}) {
|
}) : data = MediaQuery.of(context).removeViewPadding(
|
||||||
return MediaQuery(
|
|
||||||
key: key,
|
|
||||||
data: MediaQuery.of(context).removeViewPadding(
|
|
||||||
removeLeft: removeLeft,
|
removeLeft: removeLeft,
|
||||||
removeTop: removeTop,
|
removeTop: removeTop,
|
||||||
removeRight: removeRight,
|
removeRight: removeRight,
|
||||||
removeBottom: removeBottom,
|
removeBottom: removeBottom,
|
||||||
),
|
);
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Deprecated. Use [MediaQuery.fromView] instead.
|
/// Deprecated. Use [MediaQuery.fromView] instead.
|
||||||
///
|
///
|
||||||
|
|
|
@ -5647,14 +5647,12 @@ class _NamedRestorationInformation extends _RestorationInformation {
|
||||||
required this.restorationScopeId,
|
required this.restorationScopeId,
|
||||||
}) : super(_RouteRestorationType.named);
|
}) : super(_RouteRestorationType.named);
|
||||||
|
|
||||||
factory _NamedRestorationInformation.fromSerializableData(List<Object?> data) {
|
_NamedRestorationInformation.fromSerializableData(List<Object?> data)
|
||||||
assert(data.length >= 2);
|
: assert(data.length > 1),
|
||||||
return _NamedRestorationInformation(
|
restorationScopeId = data[0]! as int,
|
||||||
restorationScopeId: data[0]! as int,
|
name = data[1]! as String,
|
||||||
name: data[1]! as String,
|
arguments = data.elementAtOrNull(2),
|
||||||
arguments: data.length > 2 ? data[2] : null,
|
super(_RouteRestorationType.named);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> computeSerializableData() {
|
List<Object> computeSerializableData() {
|
||||||
|
@ -5685,15 +5683,12 @@ class _AnonymousRestorationInformation extends _RestorationInformation {
|
||||||
required this.restorationScopeId,
|
required this.restorationScopeId,
|
||||||
}) : super(_RouteRestorationType.anonymous);
|
}) : super(_RouteRestorationType.anonymous);
|
||||||
|
|
||||||
factory _AnonymousRestorationInformation.fromSerializableData(List<Object?> data) {
|
_AnonymousRestorationInformation.fromSerializableData(List<Object?> data)
|
||||||
assert(data.length > 1);
|
: assert(data.length > 1),
|
||||||
final RestorableRouteBuilder<Object?> routeBuilder = ui.PluginUtilities.getCallbackFromHandle(ui.CallbackHandle.fromRawHandle(data[1]! as int))! as RestorableRouteBuilder;
|
restorationScopeId = data[0]! as int,
|
||||||
return _AnonymousRestorationInformation(
|
routeBuilder = ui.PluginUtilities.getCallbackFromHandle(ui.CallbackHandle.fromRawHandle(data[1]! as int))! as RestorableRouteBuilder,
|
||||||
restorationScopeId: data[0]! as int,
|
arguments = data.elementAtOrNull(2),
|
||||||
routeBuilder: routeBuilder,
|
super(_RouteRestorationType.anonymous);
|
||||||
arguments: data.length > 2 ? data[2] : null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
// TODO(goderbauer): remove the kIsWeb check when https://github.com/flutter/flutter/issues/33615 is resolved.
|
// TODO(goderbauer): remove the kIsWeb check when https://github.com/flutter/flutter/issues/33615 is resolved.
|
||||||
|
|
|
@ -44,9 +44,9 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('TableBorder.symmetric constructor', () {
|
test('TableBorder.symmetric constructor', () {
|
||||||
final TableBorder border3 = TableBorder.symmetric(
|
const TableBorder border3 = TableBorder.symmetric(
|
||||||
inside: const BorderSide(width: 3.0),
|
inside: BorderSide(width: 3.0),
|
||||||
outside: const BorderSide(color: Color(0xFFFF0000)),
|
outside: BorderSide(color: Color(0xFFFF0000)),
|
||||||
);
|
);
|
||||||
expect(border3.top, const BorderSide(color: Color(0xFFFF0000)));
|
expect(border3.top, const BorderSide(color: Color(0xFFFF0000)));
|
||||||
expect(border3.right, const BorderSide(color: Color(0xFFFF0000)));
|
expect(border3.right, const BorderSide(color: Color(0xFFFF0000)));
|
||||||
|
@ -56,8 +56,8 @@ void main() {
|
||||||
expect(border3.verticalInside, const BorderSide(width: 3.0));
|
expect(border3.verticalInside, const BorderSide(width: 3.0));
|
||||||
expect(border3.dimensions, const EdgeInsets.symmetric(horizontal: 1.0, vertical: 1.0));
|
expect(border3.dimensions, const EdgeInsets.symmetric(horizontal: 1.0, vertical: 1.0));
|
||||||
expect(border3.isUniform, isFalse);
|
expect(border3.isUniform, isFalse);
|
||||||
expect(border3.scale(0.0), TableBorder.symmetric(
|
expect(border3.scale(0.0), const TableBorder.symmetric(
|
||||||
outside: const BorderSide(width: 0.0, color: Color(0xFFFF0000), style: BorderStyle.none),
|
outside: BorderSide(width: 0.0, color: Color(0xFFFF0000), style: BorderStyle.none),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,14 +22,12 @@ class LayerTree extends Result {
|
||||||
/// Creates a [LayerTree] object with the given string representation.
|
/// Creates a [LayerTree] object with the given string representation.
|
||||||
const LayerTree(this.tree);
|
const LayerTree(this.tree);
|
||||||
|
|
||||||
|
/// Deserializes the result from JSON.
|
||||||
|
LayerTree.fromJson(Map<String, dynamic> json) : tree = json['tree'] as String;
|
||||||
|
|
||||||
/// String representation of the layer tree.
|
/// String representation of the layer tree.
|
||||||
final String? tree;
|
final String? tree;
|
||||||
|
|
||||||
/// Deserializes the result from JSON.
|
|
||||||
static LayerTree fromJson(Map<String, dynamic> json) {
|
|
||||||
return LayerTree(json['tree'] as String);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||||
'tree': tree,
|
'tree': tree,
|
||||||
|
|
|
@ -11,13 +11,9 @@ const String kUIThreadVsyncProcessEvent = 'VsyncProcessCallback';
|
||||||
///
|
///
|
||||||
/// `RefreshRate` is the time between the start of a vsync pulse and the target time of that vsync.
|
/// `RefreshRate` is the time between the start of a vsync pulse and the target time of that vsync.
|
||||||
class RefreshRateSummary {
|
class RefreshRateSummary {
|
||||||
|
|
||||||
/// Creates a [RefreshRateSummary] given the timeline events.
|
/// Creates a [RefreshRateSummary] given the timeline events.
|
||||||
factory RefreshRateSummary({required List<TimelineEvent> vsyncEvents}) {
|
RefreshRateSummary({required List<TimelineEvent> vsyncEvents}) {
|
||||||
return RefreshRateSummary._(refreshRates: _computeRefreshRates(vsyncEvents));
|
final List<double> refreshRates = _computeRefreshRates(vsyncEvents);
|
||||||
}
|
|
||||||
|
|
||||||
RefreshRateSummary._({required List<double> refreshRates}) {
|
|
||||||
_numberOfTotalFrames = refreshRates.length;
|
_numberOfTotalFrames = refreshRates.length;
|
||||||
for (final double refreshRate in refreshRates) {
|
for (final double refreshRate in refreshRates) {
|
||||||
if ((refreshRate - 30).abs() < _kErrorMargin) {
|
if ((refreshRate - 30).abs() < _kErrorMargin) {
|
||||||
|
|
|
@ -10,11 +10,7 @@ class Timeline {
|
||||||
/// and loaded in Chrome for visual inspection.
|
/// and loaded in Chrome for visual inspection.
|
||||||
///
|
///
|
||||||
/// See https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
|
/// See https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
|
||||||
factory Timeline.fromJson(Map<String, dynamic> json) {
|
Timeline.fromJson(this.json) : events = _parseEvents(json);
|
||||||
return Timeline._(json, _parseEvents(json));
|
|
||||||
}
|
|
||||||
|
|
||||||
Timeline._(this.json, this.events);
|
|
||||||
|
|
||||||
/// The original timeline JSON.
|
/// The original timeline JSON.
|
||||||
final Map<String, dynamic> json;
|
final Map<String, dynamic> json;
|
||||||
|
|
|
@ -16,14 +16,14 @@ import 'package:flutter/services.dart';
|
||||||
/// - [MockStreamHandlerEventSink.endOfStream] sends an end of stream event.
|
/// - [MockStreamHandlerEventSink.endOfStream] sends an end of stream event.
|
||||||
abstract class MockStreamHandler {
|
abstract class MockStreamHandler {
|
||||||
/// Create a new [MockStreamHandler].
|
/// Create a new [MockStreamHandler].
|
||||||
MockStreamHandler();
|
const MockStreamHandler();
|
||||||
|
|
||||||
/// Create a new inline [MockStreamHandler] with the given [onListen] and
|
/// Create a new inline [MockStreamHandler] with the given [onListen] and
|
||||||
/// [onCancel] handlers.
|
/// [onCancel] handlers.
|
||||||
factory MockStreamHandler.inline({
|
const factory MockStreamHandler.inline({
|
||||||
required MockStreamHandlerOnListenCallback onListen,
|
required MockStreamHandlerOnListenCallback onListen,
|
||||||
MockStreamHandlerOnCancelCallback? onCancel,
|
MockStreamHandlerOnCancelCallback? onCancel,
|
||||||
}) => _InlineMockStreamHandler(onListen: onListen, onCancel: onCancel);
|
}) = _InlineMockStreamHandler;
|
||||||
|
|
||||||
/// Handler for the listen event.
|
/// Handler for the listen event.
|
||||||
void onListen(Object? arguments, MockStreamHandlerEventSink events);
|
void onListen(Object? arguments, MockStreamHandlerEventSink events);
|
||||||
|
@ -39,7 +39,7 @@ typedef MockStreamHandlerOnListenCallback = void Function(Object? arguments, Moc
|
||||||
typedef MockStreamHandlerOnCancelCallback = void Function(Object? arguments);
|
typedef MockStreamHandlerOnCancelCallback = void Function(Object? arguments);
|
||||||
|
|
||||||
class _InlineMockStreamHandler extends MockStreamHandler {
|
class _InlineMockStreamHandler extends MockStreamHandler {
|
||||||
_InlineMockStreamHandler({
|
const _InlineMockStreamHandler({
|
||||||
required MockStreamHandlerOnListenCallback onListen,
|
required MockStreamHandlerOnListenCallback onListen,
|
||||||
MockStreamHandlerOnCancelCallback? onCancel,
|
MockStreamHandlerOnCancelCallback? onCancel,
|
||||||
}) : _onListenInline = onListen,
|
}) : _onListenInline = onListen,
|
||||||
|
|
|
@ -387,9 +387,9 @@ class Stdio {
|
||||||
|
|
||||||
/// An overridable version of io.ProcessInfo.
|
/// An overridable version of io.ProcessInfo.
|
||||||
abstract class ProcessInfo {
|
abstract class ProcessInfo {
|
||||||
factory ProcessInfo(FileSystem fs) => _DefaultProcessInfo(fs);
|
factory ProcessInfo(FileSystem fs) = _DefaultProcessInfo;
|
||||||
|
|
||||||
factory ProcessInfo.test(FileSystem fs) => _TestProcessInfo(fs);
|
factory ProcessInfo.test(FileSystem fs) = _TestProcessInfo;
|
||||||
|
|
||||||
int get currentRss;
|
int get currentRss;
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,10 @@ typedef ShutdownHook = FutureOr<void> Function();
|
||||||
// for more details.
|
// for more details.
|
||||||
|
|
||||||
abstract class ShutdownHooks {
|
abstract class ShutdownHooks {
|
||||||
factory ShutdownHooks() => _DefaultShutdownHooks();
|
factory ShutdownHooks() = _DefaultShutdownHooks;
|
||||||
|
|
||||||
/// Registers a [ShutdownHook] to be executed before the VM exits.
|
/// Registers a [ShutdownHook] to be executed before the VM exits.
|
||||||
void addShutdownHook(
|
void addShutdownHook(ShutdownHook shutdownHook);
|
||||||
ShutdownHook shutdownHook
|
|
||||||
);
|
|
||||||
|
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
List<ShutdownHook> get registeredHooks;
|
List<ShutdownHook> get registeredHooks;
|
||||||
|
@ -139,10 +137,7 @@ abstract class ProcessUtils {
|
||||||
factory ProcessUtils({
|
factory ProcessUtils({
|
||||||
required ProcessManager processManager,
|
required ProcessManager processManager,
|
||||||
required Logger logger,
|
required Logger logger,
|
||||||
}) => _DefaultProcessUtils(
|
}) = _DefaultProcessUtils;
|
||||||
processManager: processManager,
|
|
||||||
logger: logger,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Spawns a child process to run the command [cmd].
|
/// Spawns a child process to run the command [cmd].
|
||||||
///
|
///
|
||||||
|
|
|
@ -152,9 +152,7 @@ class SettingsFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
factory SettingsFile.parseFromFile(File file) {
|
SettingsFile.parseFromFile(File file) : this.parse(file.readAsStringSync());
|
||||||
return SettingsFile.parse(file.readAsStringSync());
|
|
||||||
}
|
|
||||||
|
|
||||||
final Map<String, String> values = <String, String>{};
|
final Map<String, String> values = <String, String>{};
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,7 @@ class DartPluginRegistrantTarget extends Target {
|
||||||
///
|
///
|
||||||
/// If `project` is unset, a [FlutterProject] based on environment is used.
|
/// If `project` is unset, a [FlutterProject] based on environment is used.
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
factory DartPluginRegistrantTarget.test(FlutterProject project) {
|
const DartPluginRegistrantTarget.test(FlutterProject project) : _project = project;
|
||||||
return DartPluginRegistrantTarget._(project);
|
|
||||||
}
|
|
||||||
|
|
||||||
DartPluginRegistrantTarget._(this._project);
|
|
||||||
|
|
||||||
final FlutterProject? _project;
|
final FlutterProject? _project;
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,7 @@ class FlutterAttachRequestArguments
|
||||||
program = obj['program'] as String?,
|
program = obj['program'] as String?,
|
||||||
super.fromMap();
|
super.fromMap();
|
||||||
|
|
||||||
static FlutterAttachRequestArguments fromJson(Map<String, Object?> obj) =>
|
factory FlutterAttachRequestArguments.fromJson(Map<String, Object?> obj) = FlutterAttachRequestArguments.fromMap;
|
||||||
FlutterAttachRequestArguments.fromMap(obj);
|
|
||||||
|
|
||||||
/// Arguments to be passed to the tool that will run [program] (for example, the VM or Flutter tool).
|
/// Arguments to be passed to the tool that will run [program] (for example, the VM or Flutter tool).
|
||||||
final List<String>? toolArgs;
|
final List<String>? toolArgs;
|
||||||
|
@ -128,6 +127,8 @@ class FlutterLaunchRequestArguments
|
||||||
customToolReplacesArgs = obj['customToolReplacesArgs'] as int?,
|
customToolReplacesArgs = obj['customToolReplacesArgs'] as int?,
|
||||||
super.fromMap();
|
super.fromMap();
|
||||||
|
|
||||||
|
factory FlutterLaunchRequestArguments.fromJson(Map<String, Object?> obj) = FlutterLaunchRequestArguments.fromMap;
|
||||||
|
|
||||||
/// If noDebug is true the launch request should launch the program without enabling debugging.
|
/// If noDebug is true the launch request should launch the program without enabling debugging.
|
||||||
@override
|
@override
|
||||||
final bool? noDebug;
|
final bool? noDebug;
|
||||||
|
@ -170,7 +171,4 @@ class FlutterLaunchRequestArguments
|
||||||
if (customToolReplacesArgs != null)
|
if (customToolReplacesArgs != null)
|
||||||
'customToolReplacesArgs': customToolReplacesArgs,
|
'customToolReplacesArgs': customToolReplacesArgs,
|
||||||
};
|
};
|
||||||
|
|
||||||
static FlutterLaunchRequestArguments fromJson(Map<String, Object?> obj) =>
|
|
||||||
FlutterLaunchRequestArguments.fromMap(obj);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,12 +167,8 @@ class FuchsiaPM {
|
||||||
/// server.stop();
|
/// server.stop();
|
||||||
/// }
|
/// }
|
||||||
class FuchsiaPackageServer {
|
class FuchsiaPackageServer {
|
||||||
factory FuchsiaPackageServer(
|
FuchsiaPackageServer(String repo, this.name, String host, int port)
|
||||||
String repo, String name, String host, int port) {
|
: _repo = repo, _host = host, _port = port;
|
||||||
return FuchsiaPackageServer._(repo, name, host, port);
|
|
||||||
}
|
|
||||||
|
|
||||||
FuchsiaPackageServer._(this._repo, this.name, this._host, this._port);
|
|
||||||
|
|
||||||
static const String deviceHost = 'fuchsia.com';
|
static const String deviceHost = 'fuchsia.com';
|
||||||
static const String toolHost = 'flutter-tool';
|
static const String toolHost = 'flutter-tool';
|
||||||
|
|
|
@ -18,19 +18,12 @@ abstract class PersistentToolState {
|
||||||
required FileSystem fileSystem,
|
required FileSystem fileSystem,
|
||||||
required Logger logger,
|
required Logger logger,
|
||||||
required Platform platform,
|
required Platform platform,
|
||||||
}) => _DefaultPersistentToolState(
|
}) = _DefaultPersistentToolState;
|
||||||
fileSystem: fileSystem,
|
|
||||||
logger: logger,
|
|
||||||
platform: platform,
|
|
||||||
);
|
|
||||||
|
|
||||||
factory PersistentToolState.test({
|
factory PersistentToolState.test({
|
||||||
required Directory directory,
|
required Directory directory,
|
||||||
required Logger logger,
|
required Logger logger,
|
||||||
}) => _DefaultPersistentToolState.test(
|
}) = _DefaultPersistentToolState.test;
|
||||||
directory: directory,
|
|
||||||
logger: logger,
|
|
||||||
);
|
|
||||||
|
|
||||||
static PersistentToolState? get instance => context.get<PersistentToolState>();
|
static PersistentToolState? get instance => context.get<PersistentToolState>();
|
||||||
|
|
||||||
|
|
|
@ -84,19 +84,14 @@ class AndroidPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||||
}) : _fileSystem = fileSystem,
|
}) : _fileSystem = fileSystem,
|
||||||
ffiPlugin = ffiPlugin ?? false;
|
ffiPlugin = ffiPlugin ?? false;
|
||||||
|
|
||||||
factory AndroidPlugin.fromYaml(String name, YamlMap yaml, String pluginPath, FileSystem fileSystem) {
|
AndroidPlugin.fromYaml(this.name, YamlMap yaml, this.pluginPath, FileSystem fileSystem)
|
||||||
assert(validate(yaml));
|
: assert(validate(yaml)),
|
||||||
return AndroidPlugin(
|
package = yaml['package'] as String?,
|
||||||
name: name,
|
pluginClass = yaml[kPluginClass] as String?,
|
||||||
package: yaml['package'] as String?,
|
dartPluginClass = yaml[kDartPluginClass] as String?,
|
||||||
pluginClass: yaml[kPluginClass] as String?,
|
ffiPlugin = yaml[kFfiPlugin] as bool? ?? false,
|
||||||
dartPluginClass: yaml[kDartPluginClass] as String?,
|
defaultPackage = yaml[kDefaultPackage] as String?,
|
||||||
ffiPlugin: yaml[kFfiPlugin] as bool?,
|
_fileSystem = fileSystem;
|
||||||
defaultPackage: yaml[kDefaultPackage] as String?,
|
|
||||||
pluginPath: pluginPath,
|
|
||||||
fileSystem: fileSystem,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final FileSystem _fileSystem;
|
final FileSystem _fileSystem;
|
||||||
|
|
||||||
|
@ -244,18 +239,14 @@ class IOSPlugin extends PluginPlatform implements NativeOrDartPlugin, DarwinPlug
|
||||||
}) : ffiPlugin = ffiPlugin ?? false,
|
}) : ffiPlugin = ffiPlugin ?? false,
|
||||||
sharedDarwinSource = sharedDarwinSource ?? false;
|
sharedDarwinSource = sharedDarwinSource ?? false;
|
||||||
|
|
||||||
factory IOSPlugin.fromYaml(String name, YamlMap yaml) {
|
IOSPlugin.fromYaml(this.name, YamlMap yaml)
|
||||||
assert(validate(yaml)); // TODO(zanderso): https://github.com/flutter/flutter/issues/67241
|
: assert(validate(yaml)), // TODO(zanderso): https://github.com/flutter/flutter/issues/67241
|
||||||
return IOSPlugin(
|
classPrefix = '',
|
||||||
name: name,
|
pluginClass = yaml[kPluginClass] as String?,
|
||||||
classPrefix: '',
|
dartPluginClass = yaml[kDartPluginClass] as String?,
|
||||||
pluginClass: yaml[kPluginClass] as String?,
|
ffiPlugin = yaml[kFfiPlugin] as bool? ?? false,
|
||||||
dartPluginClass: yaml[kDartPluginClass] as String?,
|
defaultPackage = yaml[kDefaultPackage] as String?,
|
||||||
ffiPlugin: yaml[kFfiPlugin] as bool?,
|
sharedDarwinSource = yaml[kSharedDarwinSource] as bool? ?? false;
|
||||||
defaultPackage: yaml[kDefaultPackage] as String?,
|
|
||||||
sharedDarwinSource: yaml[kSharedDarwinSource] as bool?,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool validate(YamlMap yaml) {
|
static bool validate(YamlMap yaml) {
|
||||||
return yaml[kPluginClass] is String ||
|
return yaml[kPluginClass] is String ||
|
||||||
|
@ -321,22 +312,14 @@ class MacOSPlugin extends PluginPlatform implements NativeOrDartPlugin, DarwinPl
|
||||||
}) : ffiPlugin = ffiPlugin ?? false,
|
}) : ffiPlugin = ffiPlugin ?? false,
|
||||||
sharedDarwinSource = sharedDarwinSource ?? false;
|
sharedDarwinSource = sharedDarwinSource ?? false;
|
||||||
|
|
||||||
factory MacOSPlugin.fromYaml(String name, YamlMap yaml) {
|
MacOSPlugin.fromYaml(this.name, YamlMap yaml)
|
||||||
assert(validate(yaml));
|
: assert(validate(yaml)),
|
||||||
// Treat 'none' as not present. See https://github.com/flutter/flutter/issues/57497.
|
// Treat 'none' as not present. See https://github.com/flutter/flutter/issues/57497.
|
||||||
String? pluginClass = yaml[kPluginClass] as String?;
|
pluginClass = yaml[kPluginClass] == 'none' ? null : yaml[kPluginClass] as String?,
|
||||||
if (pluginClass == 'none') {
|
dartPluginClass = yaml[kDartPluginClass] as String?,
|
||||||
pluginClass = null;
|
ffiPlugin = yaml[kFfiPlugin] as bool? ?? false,
|
||||||
}
|
defaultPackage = yaml[kDefaultPackage] as String?,
|
||||||
return MacOSPlugin(
|
sharedDarwinSource = yaml[kSharedDarwinSource] as bool? ?? false;
|
||||||
name: name,
|
|
||||||
pluginClass: pluginClass,
|
|
||||||
dartPluginClass: yaml[kDartPluginClass] as String?,
|
|
||||||
ffiPlugin: yaml[kFfiPlugin] as bool?,
|
|
||||||
defaultPackage: yaml[kDefaultPackage] as String?,
|
|
||||||
sharedDarwinSource: yaml[kSharedDarwinSource] as bool?,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool validate(YamlMap yaml) {
|
static bool validate(YamlMap yaml) {
|
||||||
return yaml[kPluginClass] is String ||
|
return yaml[kPluginClass] is String ||
|
||||||
|
@ -487,21 +470,13 @@ class LinuxPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||||
}) : ffiPlugin = ffiPlugin ?? false,
|
}) : ffiPlugin = ffiPlugin ?? false,
|
||||||
assert(pluginClass != null || dartPluginClass != null || (ffiPlugin ?? false) || defaultPackage != null);
|
assert(pluginClass != null || dartPluginClass != null || (ffiPlugin ?? false) || defaultPackage != null);
|
||||||
|
|
||||||
factory LinuxPlugin.fromYaml(String name, YamlMap yaml) {
|
LinuxPlugin.fromYaml(this.name, YamlMap yaml)
|
||||||
assert(validate(yaml));
|
: assert(validate(yaml)),
|
||||||
// Treat 'none' as not present. See https://github.com/flutter/flutter/issues/57497.
|
// Treat 'none' as not present. See https://github.com/flutter/flutter/issues/57497.
|
||||||
String? pluginClass = yaml[kPluginClass] as String?;
|
pluginClass = yaml[kPluginClass] == 'none' ? null : yaml[kPluginClass] as String?,
|
||||||
if (pluginClass == 'none') {
|
dartPluginClass = yaml[kDartPluginClass] as String?,
|
||||||
pluginClass = null;
|
ffiPlugin = yaml[kFfiPlugin] as bool? ?? false,
|
||||||
}
|
defaultPackage = yaml[kDefaultPackage] as String?;
|
||||||
return LinuxPlugin(
|
|
||||||
name: name,
|
|
||||||
pluginClass: pluginClass,
|
|
||||||
dartPluginClass: yaml[kDartPluginClass] as String?,
|
|
||||||
ffiPlugin: yaml[kFfiPlugin] as bool?,
|
|
||||||
defaultPackage: yaml[kDefaultPackage] as String?,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool validate(YamlMap yaml) {
|
static bool validate(YamlMap yaml) {
|
||||||
return yaml[kPluginClass] is String ||
|
return yaml[kPluginClass] is String ||
|
||||||
|
|
|
@ -8,9 +8,7 @@ import 'cache.dart';
|
||||||
|
|
||||||
/// A validator that runs before the tool runs any command.
|
/// A validator that runs before the tool runs any command.
|
||||||
abstract class PreRunValidator {
|
abstract class PreRunValidator {
|
||||||
factory PreRunValidator({
|
factory PreRunValidator({required FileSystem fileSystem}) = _DefaultPreRunValidator;
|
||||||
required FileSystem fileSystem,
|
|
||||||
}) => _DefaultPreRunValidator(fileSystem: fileSystem);
|
|
||||||
|
|
||||||
void validate();
|
void validate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import '../convert.dart';
|
||||||
|
|
||||||
/// Adler-32 and MD5 hashes of blocks in files.
|
/// Adler-32 and MD5 hashes of blocks in files.
|
||||||
class BlockHashes {
|
class BlockHashes {
|
||||||
BlockHashes({
|
const BlockHashes({
|
||||||
required this.blockSize,
|
required this.blockSize,
|
||||||
required this.totalSize,
|
required this.totalSize,
|
||||||
required this.adler32,
|
required this.adler32,
|
||||||
|
@ -23,6 +23,13 @@ class BlockHashes {
|
||||||
required this.fileMd5,
|
required this.fileMd5,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
BlockHashes.fromJson(Map<String, Object?> obj)
|
||||||
|
: blockSize = obj['blockSize']! as int,
|
||||||
|
totalSize = obj['totalSize']! as int,
|
||||||
|
adler32 = Uint32List.view(base64.decode(obj['adler32']! as String).buffer),
|
||||||
|
md5 = (obj['md5']! as List<Object?>).cast<String>(),
|
||||||
|
fileMd5 = obj['fileMd5']! as String;
|
||||||
|
|
||||||
/// The block size used to generate the hashes.
|
/// The block size used to generate the hashes.
|
||||||
final int blockSize;
|
final int blockSize;
|
||||||
|
|
||||||
|
@ -45,16 +52,6 @@ class BlockHashes {
|
||||||
'md5': md5,
|
'md5': md5,
|
||||||
'fileMd5': fileMd5,
|
'fileMd5': fileMd5,
|
||||||
};
|
};
|
||||||
|
|
||||||
static BlockHashes fromJson(Map<String, Object?> obj) {
|
|
||||||
return BlockHashes(
|
|
||||||
blockSize: obj['blockSize']! as int,
|
|
||||||
totalSize: obj['totalSize']! as int,
|
|
||||||
adler32: Uint32List.view(base64.decode(obj['adler32']! as String).buffer),
|
|
||||||
md5: (obj['md5']! as List<Object?>).cast<String>(),
|
|
||||||
fileMd5: obj['fileMd5']! as String,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts a stream of bytes, into a stream of bytes of fixed chunk size.
|
/// Converts a stream of bytes, into a stream of bytes of fixed chunk size.
|
||||||
|
|
|
@ -431,7 +431,7 @@ void main() {
|
||||||
testWithoutContext('transfers file to the daemon with delta turned on, file exists on remote', () async {
|
testWithoutContext('transfers file to the daemon with delta turned on, file exists on remote', () async {
|
||||||
bufferLogger = BufferLogger.test();
|
bufferLogger = BufferLogger.test();
|
||||||
final FakeFileTransfer fileTransfer = FakeFileTransfer();
|
final FakeFileTransfer fileTransfer = FakeFileTransfer();
|
||||||
final BlockHashes blockHashes = BlockHashes(
|
const BlockHashes blockHashes = BlockHashes(
|
||||||
blockSize: 10,
|
blockSize: 10,
|
||||||
totalSize: 30,
|
totalSize: 30,
|
||||||
adler32: <int>[1, 2, 3],
|
adler32: <int>[1, 2, 3],
|
||||||
|
|
Loading…
Reference in a new issue