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
9f142710
Commit
9f142710
authored
Mar 04, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2425 from abarth/view_owner
Teaches ChildViewConnection to wrap an existing ViewOwner
parents
089ce483
118c4ed8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
child_view.dart
packages/flutter/lib/src/rendering/child_view.dart
+18
-7
No files found.
packages/flutter/lib/src/rendering/child_view.dart
View file @
9f142710
...
...
@@ -20,7 +20,7 @@ import 'object.dart';
mojom
.
ViewProxy
_initViewProxy
(
)
{
int
viewHandle
=
ui
.
takeViewHandle
();
assert
(()
{
if
(
viewHandle
==
0
)
if
(
viewHandle
==
core
.
MojoHandle
.
INVALID
)
debugPrint
(
'Child view are supported only when running in Mojo shell.'
);
return
true
;
});
...
...
@@ -35,8 +35,12 @@ mojom.ViewProxy _initViewProxy() {
final
mojom
.
ViewProxy
_viewProxy
=
_initViewProxy
();
final
mojom
.
View
_view
=
_viewProxy
?.
ptr
;
/// (mojo-only) A connection with a child view.
///
/// Used with the [ChildView] widget to display a child view.
class
ChildViewConnection
{
ChildViewConnection
({
this
.
url
})
{
/// Establishes a connection to the app at the given URL.
ChildViewConnection
({
String
url
})
{
mojom
.
ViewProviderProxy
viewProvider
=
new
mojom
.
ViewProviderProxy
.
unbound
();
shell
.
connectToService
(
url
,
viewProvider
);
mojom
.
ServiceProviderProxy
incomingServices
=
new
mojom
.
ServiceProviderProxy
.
unbound
();
...
...
@@ -47,8 +51,16 @@ class ChildViewConnection {
_connection
=
new
ApplicationConnection
(
outgoingServices
,
incomingServices
);
}
final
String
url
;
/// Wraps an already-established connection ot a child app.
ChildViewConnection
.
fromViewOwner
({
mojom
.
ViewOwnerProxy
viewOwner
,
ApplicationConnection
connection
})
:
_connection
=
connection
,
_viewOwner
=
viewOwner
;
/// The underlying application connection to the child app.
///
/// Useful for requesting services from the child app and for providing
/// services to the child app.
ApplicationConnection
get
connection
=>
_connection
;
ApplicationConnection
_connection
;
...
...
@@ -120,18 +132,16 @@ class ChildViewConnection {
..
devicePixelRatio
=
scale
;
return
(
await
_view
.
layoutChild
(
_viewKey
,
layoutParams
)).
info
;
}
String
toString
()
{
return
'
$runtimeType
(url:
$url
)'
;
}
}
/// (mojo-only) A view of a child application.
class
RenderChildView
extends
RenderBox
{
RenderChildView
({
ChildViewConnection
child
,
double
scale
})
:
_child
=
child
,
_scale
=
scale
;
/// The child to display.
ChildViewConnection
get
child
=>
_child
;
ChildViewConnection
_child
;
void
set
child
(
ChildViewConnection
value
)
{
...
...
@@ -150,6 +160,7 @@ class RenderChildView extends RenderBox {
}
}
/// The device pixel ratio to provide the child.
double
get
scale
=>
_scale
;
double
_scale
;
void
set
scale
(
double
value
)
{
...
...
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