Skip to content

Commit d5c890f

Browse files
committed
Updates for Flutter 3.27
1 parent 8456274 commit d5c890f

File tree

4 files changed

+109
-10
lines changed

4 files changed

+109
-10
lines changed

lib/src/sky_engine/ui/painting.dart

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:ui';
2+
13
import 'package:dart_eval/dart_eval_bridge.dart';
24
import 'package:flutter/painting.dart';
35

@@ -14,6 +16,20 @@ class $Color implements Color, $Instance {
1416
BridgeParameter('value',
1517
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.int)), false)
1618
])),
19+
'from': BridgeConstructorDef(BridgeFunctionDef(
20+
returns: BridgeTypeAnnotation($type),
21+
namedParams: [
22+
BridgeParameter('alpha',
23+
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.int)), false),
24+
BridgeParameter('red',
25+
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.int)), false),
26+
BridgeParameter('green',
27+
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.int)), false),
28+
BridgeParameter('blue',
29+
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.int)), false),
30+
BridgeParameter(
31+
'colorSpace', BridgeTypeAnnotation($ColorSpace.$type), true)
32+
])),
1733
'fromARGB': BridgeConstructorDef(
1834
BridgeFunctionDef(returns: BridgeTypeAnnotation($type), params: [
1935
BridgeParameter(
@@ -37,6 +53,17 @@ class $Color implements Color, $Instance {
3753
'o', BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.int)), false)
3854
]))
3955
},
56+
fields: {
57+
'a': BridgeFieldDef(
58+
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.double))),
59+
'r': BridgeFieldDef(
60+
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.double))),
61+
'g': BridgeFieldDef(
62+
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.double))),
63+
'b': BridgeFieldDef(
64+
BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.double))),
65+
'colorSpace': BridgeFieldDef(BridgeTypeAnnotation($ColorSpace.$type))
66+
},
4067
wrap: true);
4168

4269
/// Wrap a [Color] in an [$Color]
@@ -65,6 +92,21 @@ class $Color implements Color, $Instance {
6592
throw UnimplementedError();
6693
}
6794

95+
@override
96+
double get a => $value.a;
97+
98+
@override
99+
double get r => $value.r;
100+
101+
@override
102+
double get g => $value.g;
103+
104+
@override
105+
double get b => $value.b;
106+
107+
@override
108+
ColorSpace get colorSpace => $value.colorSpace;
109+
68110
@override
69111
int get alpha => $value.alpha;
70112

@@ -100,6 +142,21 @@ class $Color implements Color, $Instance {
100142

101143
@override
102144
Color withRed(int r) => $value.withRed(r);
145+
146+
@override
147+
Color withValues(
148+
{double? alpha,
149+
double? red,
150+
double? green,
151+
double? blue,
152+
ColorSpace? colorSpace}) =>
153+
$value.withValues(
154+
alpha: alpha,
155+
red: red,
156+
green: green,
157+
blue: blue,
158+
colorSpace: colorSpace,
159+
);
103160
}
104161

105162
/// dart_eval wrapper for [Clip]
@@ -144,3 +201,35 @@ class $Clip implements $Instance {
144201
throw UnimplementedError();
145202
}
146203
}
204+
205+
class $ColorSpace implements $Instance {
206+
static const $type = BridgeTypeRef(BridgeTypeSpec('dart:ui', 'ColorSpace'));
207+
208+
static const $declaration = BridgeEnumDef($type,
209+
values: ['sRGB', 'extendedSRGB', 'displayP3'], fields: {});
210+
211+
static final $values = ColorSpace.values
212+
.asNameMap()
213+
.map((key, value) => MapEntry(key, $ColorSpace.wrap(value)));
214+
215+
const $ColorSpace.wrap(this.$value);
216+
217+
@override
218+
final ColorSpace $value;
219+
220+
@override
221+
ColorSpace get $reified => $value;
222+
223+
@override
224+
$Value? $getProperty(Runtime runtime, String identifier) {
225+
throw UnimplementedError();
226+
}
227+
228+
@override
229+
int $getRuntimeType(Runtime runtime) => runtime.lookupType($type.spec!);
230+
231+
@override
232+
void $setProperty(Runtime runtime, String identifier, $Value value) {
233+
throw UnimplementedError();
234+
}
235+
}

lib/src/widgets/container.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,13 @@ class $Container implements Container, $Instance {
178178
String toStringDeep(
179179
{String prefixLineOne = '',
180180
String? prefixOtherLines,
181-
DiagnosticLevel minLevel = DiagnosticLevel.debug}) =>
181+
DiagnosticLevel minLevel = DiagnosticLevel.debug,
182+
int wrapWidth = 65}) =>
182183
$value.toStringDeep(
183184
prefixLineOne: prefixLineOne,
184185
prefixOtherLines: prefixOtherLines,
185-
minLevel: minLevel);
186+
minLevel: minLevel,
187+
wrapWidth: wrapWidth);
186188

187189
@override
188190
String toStringShallow(

lib/src/widgets/framework.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ class $Widget implements Widget, $Instance {
7171
String toStringDeep(
7272
{String prefixLineOne = '',
7373
String? prefixOtherLines,
74-
DiagnosticLevel minLevel = DiagnosticLevel.debug}) =>
74+
DiagnosticLevel minLevel = DiagnosticLevel.debug,
75+
int wrapWidth = 65}) =>
7576
$value.toStringDeep(
7677
prefixLineOne: prefixLineOne,
7778
prefixOtherLines: prefixOtherLines,
78-
minLevel: minLevel);
79+
minLevel: minLevel,
80+
wrapWidth: wrapWidth);
7981

8082
@override
8183
String toStringShallow(
@@ -146,11 +148,13 @@ class $StatelessWidget implements StatelessWidget, $Instance {
146148
String toStringDeep(
147149
{String prefixLineOne = '',
148150
String? prefixOtherLines,
149-
DiagnosticLevel minLevel = DiagnosticLevel.debug}) =>
151+
DiagnosticLevel minLevel = DiagnosticLevel.debug,
152+
int wrapWidth = 65}) =>
150153
$value.toStringDeep(
151154
prefixLineOne: prefixLineOne,
152155
prefixOtherLines: prefixOtherLines,
153-
minLevel: minLevel);
156+
minLevel: minLevel,
157+
wrapWidth: wrapWidth);
154158

155159
@override
156160
String toStringShallow(
@@ -259,11 +263,13 @@ class $StatelessWidget$bridge extends StatelessWidget
259263
String toStringDeep(
260264
{String prefixLineOne = '',
261265
String? prefixOtherLines,
262-
DiagnosticLevel minLevel = DiagnosticLevel.debug}) =>
266+
DiagnosticLevel minLevel = DiagnosticLevel.debug,
267+
int wrapWidth = 65}) =>
263268
$_invoke('toStringDeep', [
264269
$String(prefixLineOne),
265270
prefixOtherLines == null ? const $null() : $String(prefixOtherLines),
266-
$DiagnosticLevel.wrap(minLevel)
271+
$DiagnosticLevel.wrap(minLevel),
272+
$int(wrapWidth)
267273
]);
268274

269275
@override

lib/src/widgets/text.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,13 @@ class $Text implements Text, $Instance {
8383
String toStringDeep(
8484
{String prefixLineOne = '',
8585
String? prefixOtherLines,
86-
DiagnosticLevel minLevel = DiagnosticLevel.debug}) =>
86+
DiagnosticLevel minLevel = DiagnosticLevel.debug,
87+
int wrapWidth = 65}) =>
8788
$value.toStringDeep(
8889
prefixLineOne: prefixLineOne,
8990
prefixOtherLines: prefixOtherLines,
90-
minLevel: minLevel);
91+
minLevel: minLevel,
92+
wrapWidth: wrapWidth);
9193

9294
@override
9395
String toStringShallow(

0 commit comments

Comments
 (0)