Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e1645b15
Unverified
Commit
e1645b15
authored
Feb 12, 2024
by
Kevin Moore
Committed by
GitHub
Feb 12, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[web] Move JS interop to extension types (#143274)
Now that we can bump the min SDK to latest.
parent
52f923c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
89 deletions
+23
-89
web.dart
packages/flutter/lib/src/web.dart
+22
-88
pubspec.yaml
packages/flutter/pubspec.yaml
+1
-1
No files found.
packages/flutter/lib/src/web.dart
View file @
e1645b15
...
...
@@ -33,11 +33,7 @@ external Document get document;
@JS
()
external
Window
get
window
;
@JS
(
'CSSStyleDeclaration'
)
@staticInterop
class
CSSStyleDeclaration
{}
extension
CSSStyleDeclarationExtension
on
CSSStyleDeclaration
{
extension
type
CSSStyleDeclaration
.
_
(
JSObject
_
)
implements
JSObject
{
external
set
backgroundColor
(
String
value
);
external
String
get
backgroundColor
;
external
set
border
(
String
value
);
...
...
@@ -48,22 +44,14 @@ extension CSSStyleDeclarationExtension on CSSStyleDeclaration {
external
String
get
width
;
}
@JS
(
'CSSStyleSheet'
)
@staticInterop
class
CSSStyleSheet
{}
extension
CSSStyleSheetExtension
on
CSSStyleSheet
{
extension
type
CSSStyleSheet
.
_
(
JSObject
_
)
implements
JSObject
{
external
int
insertRule
(
String
rule
,
[
int
index
,
]);
}
@JS
(
'Document'
)
@staticInterop
class
Document
implements
Node
{}
extension
DocumentExtension
on
Document
{
extension
type
Document
.
_
(
JSObject
_
)
implements
JSObject
{
external
Element
createElement
(
String
localName
,
[
JSAny
options
,
...
...
@@ -72,32 +60,18 @@ extension DocumentExtension on Document {
external
HTMLHeadElement
?
get
head
;
}
@JS
(
'DOMTokenList'
)
@staticInterop
class
DOMTokenList
{}
extension
DOMTokenListExtension
on
DOMTokenList
{
extension
type
DOMTokenList
.
_
(
JSObject
_
)
implements
JSObject
{
external
void
add
(
String
tokens
);
}
@JS
(
'Element'
)
@staticInterop
class
Element
implements
Node
{}
extension
ElementExtension
on
Element
{
extension
type
Element
.
_
(
JSObject
_
)
implements
Node
,
JSObject
{
external
DOMTokenList
get
classList
;
external
void
append
(
JSAny
nodes
);
}
@JS
(
'Event'
)
@staticInterop
class
Event
{}
@JS
(
'EventTarget'
)
@staticInterop
class
EventTarget
{}
extension
type
Event
.
_
(
JSObject
_
)
implements
JSObject
{}
extension
EventTargetExtension
on
EventTarge
t
{
extension
type
EventTarget
.
_
(
JSObject
_
)
implements
JSObjec
t
{
external
void
addEventListener
(
String
type
,
EventListener
?
callback
,
[
...
...
@@ -105,91 +79,52 @@ extension EventTargetExtension on EventTarget {
]);
}
@JS
(
'HTMLElement'
)
@staticInterop
class
HTMLElement
implements
Element
{}
extension
HTMLElementExtension
on
HTMLElement
{
extension
type
HTMLElement
.
_
(
JSObject
_
)
implements
Element
,
JSObject
{
external
String
get
innerText
;
external
set
innerText
(
String
value
);
external
CSSStyleDeclaration
get
style
;
}
@JS
(
'HTMLHeadElement'
)
@staticInterop
class
HTMLHeadElement
implements
HTMLElement
{}
@JS
(
'HTMLStyleElement'
)
@staticInterop
class
HTMLStyleElement
implements
HTMLElement
{}
extension
type
HTMLHeadElement
.
_
(
JSObject
_
)
implements
HTMLElement
,
JSObject
{}
extension
HTMLStyleElementExtension
on
HTMLStyleElemen
t
{
extension
type
HTMLStyleElement
.
_
(
JSObject
_
)
implements
HTMLElement
,
JSObjec
t
{
external
CSSStyleSheet
?
get
sheet
;
}
@JS
(
'MediaQueryList'
)
@staticInterop
class
MediaQueryList
{}
extension
MediaQueryListExtension
on
MediaQueryList
{
extension
type
MediaQueryList
.
_
(
JSObject
_
)
implements
EventTarget
,
JSObject
{
external
bool
get
matches
;
}
@JS
(
'MouseEvent'
)
@staticInterop
class
MouseEvent
{}
extension
MouseEventExtension
on
MouseEvent
{
extension
type
MouseEvent
.
_
(
JSObject
_
)
implements
JSObject
{
external
num
get
offsetX
;
external
num
get
offsetY
;
external
int
get
button
;
}
@JS
(
'Navigator'
)
@staticInterop
class
Navigator
{}
extension
NavigatorExtension
on
Navigator
{
extension
type
Navigator
.
_
(
JSObject
_
)
implements
JSObject
{
external
String
get
platform
;
}
@JS
(
'Node'
)
@staticInterop
class
Node
implements
EventTarget
{}
@JS
(
'Range'
)
@staticInterop
class
Range
{}
extension
type
Node
.
_
(
JSObject
_
)
implements
EventTarget
,
JSObject
{}
extension
RangeExtension
on
Range
{
extension
type
Range
.
_
(
JSObject
_
)
implements
JSObject
{
external
void
selectNode
(
Node
node
);
}
@JS
(
'Selection'
)
@staticInterop
class
Selection
{}
extension
SelectionExtension
on
Selection
{
extension
type
Selection
.
_
(
JSObject
_
)
implements
JSObject
{
external
void
addRange
(
Range
range
);
external
void
removeAllRanges
();
}
@JS
(
'Window'
)
@staticInterop
class
Window
{}
extension
WindowExtension
on
Window
{
extension
type
Window
.
_
(
JSObject
_
)
implements
EventTarget
,
JSObject
{
external
Navigator
get
navigator
;
external
MediaQueryList
matchMedia
(
String
query
);
external
Selection
?
getSelection
();
}
@JS
(
'XMLHttpRequest'
)
@staticInterop
class
XMLHttpRequest
implements
XMLHttpRequestEventTarget
{
extension
type
XMLHttpRequest
.
_
(
JSObject
_
)
implements
XMLHttpRequestEventTarget
,
JSObject
{
external
factory
XMLHttpRequest
();
}
extension
XMLHttpRequestExtension
on
XMLHttpRequest
{
external
void
open
(
String
method
,
String
url
,
[
...
...
@@ -208,6 +143,5 @@ extension XMLHttpRequestExtension on XMLHttpRequest {
external
JSAny
?
get
response
;
}
@JS
(
'XMLHttpRequestEventTarget'
)
@staticInterop
class
XMLHttpRequestEventTarget
implements
EventTarget
{}
extension
type
XMLHttpRequestEventTarget
.
_
(
JSObject
_
)
implements
EventTarget
,
JSObject
{}
packages/flutter/pubspec.yaml
View file @
e1645b15
...
...
@@ -3,7 +3,7 @@ description: A framework for writing Flutter applications
homepage
:
https://flutter.dev
environment
:
sdk
:
'
>=3.
2
.0-0
<4.0.0'
sdk
:
'
>=3.
3
.0-0
<4.0.0'
dependencies
:
# To update these, use "flutter update-packages --force-upgrade".
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment