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
09f6515b
Unverified
Commit
09f6515b
authored
Aug 16, 2019
by
Chris Yang
Committed by
GitHub
Aug 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlatformViewLink: Rename CreatePlatformViewController to CreatePlatformViewCallback (#38710)
parent
cac8fa5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
platform_view.dart
packages/flutter/lib/src/widgets/platform_view.dart
+11
-11
platform_view_test.dart
packages/flutter/test/widgets/platform_view_test.dart
+4
-4
No files found.
packages/flutter/lib/src/widgets/platform_view.dart
View file @
09f6515b
...
...
@@ -583,7 +583,7 @@ class _UiKitPlatformView extends LeafRenderObjectWidget {
/// The parameters used to create a [PlatformViewController].
///
/// See also [CreatePlatformViewC
ontroller
] which uses this object to create a [PlatformViewController].
/// See also [CreatePlatformViewC
allback
] which uses this object to create a [PlatformViewController].
class
PlatformViewCreationParams
{
const
PlatformViewCreationParams
.
_
({
...
...
@@ -615,7 +615,7 @@ typedef PlatformViewSurfaceFactory = Widget Function(BuildContext context, Platf
/// params [PlatformViewCreationParams.id] field.
///
/// See also [PlatformViewLink.onCreate].
typedef
CreatePlatformViewC
ontroller
=
PlatformViewController
Function
(
PlatformViewCreationParams
params
);
typedef
CreatePlatformViewC
allback
=
PlatformViewController
Function
(
PlatformViewCreationParams
params
);
/// Links a platform view with the Flutter framework.
///
...
...
@@ -631,7 +631,7 @@ typedef CreatePlatformViewController = PlatformViewController Function(PlatformV
/// @override
/// Widget build(BuildContext context) {
/// return PlatformViewLink(
///
createCallback
: createFooWebView,
///
onCreatePlatformView
: createFooWebView,
/// surfaceFactory: (BuildContext context, PlatformViewController controller) {
/// return PlatformViewSurface(
/// gestureRecognizers: gestureRecognizers,
...
...
@@ -644,13 +644,13 @@ typedef CreatePlatformViewController = PlatformViewController Function(PlatformV
/// }
/// ```
///
/// The `surfaceFactory` and the `
createPlatformViewController
` only take affect when the state of this widget is initialized.
/// If the widget is rebuilt without losing its state, `surfaceFactory` and `
createPlatformViewController
` are ignored.
/// The `surfaceFactory` and the `
onCreatePlatformView
` only take affect when the state of this widget is initialized.
/// If the widget is rebuilt without losing its state, `surfaceFactory` and `
onCreatePlatformView
` are ignored.
class
PlatformViewLink
extends
StatefulWidget
{
/// Construct a [PlatformViewLink] widget.
///
/// The `surfaceFactory` and the `
createPlatformViewController
` must not be null.
/// The `surfaceFactory` and the `
onCreatePlatformView
` must not be null.
///
/// See also:
/// * [PlatformViewSurface] for details on the widget returned by `surfaceFactory`.
...
...
@@ -658,16 +658,16 @@ class PlatformViewLink extends StatefulWidget {
const
PlatformViewLink
({
Key
key
,
@required
PlatformViewSurfaceFactory
surfaceFactory
,
@required
CreatePlatformViewC
ontroller
createPlatformViewController
,
@required
CreatePlatformViewC
allback
onCreatePlatformView
,
})
:
assert
(
surfaceFactory
!=
null
),
assert
(
createPlatformViewController
!=
null
),
assert
(
onCreatePlatformView
!=
null
),
_surfaceFactory
=
surfaceFactory
,
_
createPlatformViewController
=
createPlatformViewController
,
_
onCreatePlatformView
=
onCreatePlatformView
,
super
(
key:
key
);
final
PlatformViewSurfaceFactory
_surfaceFactory
;
final
CreatePlatformViewC
ontroller
_createPlatformViewController
;
final
CreatePlatformViewC
allback
_onCreatePlatformView
;
@override
State
<
StatefulWidget
>
createState
()
=>
_PlatformViewLinkState
();
...
...
@@ -697,7 +697,7 @@ class _PlatformViewLinkState extends State<PlatformViewLink> {
void
_initialize
()
{
_id
=
platformViewsRegistry
.
getNextPlatformViewId
();
_controller
=
widget
.
_
createPlatformViewController
(
PlatformViewCreationParams
.
_
(
id:
_id
,
onPlatformViewCreated:
_onPlatformViewCreated
));
_controller
=
widget
.
_
onCreatePlatformView
(
PlatformViewCreationParams
.
_
(
id:
_id
,
onPlatformViewCreated:
_onPlatformViewCreated
));
}
void
_onPlatformViewCreated
(
int
id
)
{
...
...
packages/flutter/test/widgets/platform_view_test.dart
View file @
09f6515b
...
...
@@ -1939,7 +1939,7 @@ void main() {
PlatformViewCreatedCallback
onPlatformViewCreatedCallBack
;
final
PlatformViewLink
platformViewLink
=
PlatformViewLink
(
createPlatformViewController
:
(
PlatformViewCreationParams
params
){
final
PlatformViewLink
platformViewLink
=
PlatformViewLink
(
onCreatePlatformView
:
(
PlatformViewCreationParams
params
){
onPlatformViewCreatedCallBack
=
params
.
onPlatformViewCreated
;
createdPlatformViewId
=
params
.
id
;
return
FakePlatformViewController
(
params
.
id
);
...
...
@@ -1967,7 +1967,7 @@ void main() {
testWidgets
(
'PlatformViewLink Widget dispose'
,
(
WidgetTester
tester
)
async
{
FakePlatformViewController
disposedController
;
final
PlatformViewLink
platformViewLink
=
PlatformViewLink
(
createPlatformViewController
:
(
PlatformViewCreationParams
params
){
final
PlatformViewLink
platformViewLink
=
PlatformViewLink
(
onCreatePlatformView
:
(
PlatformViewCreationParams
params
){
disposedController
=
FakePlatformViewController
(
params
.
id
);
params
.
onPlatformViewCreated
(
params
.
id
);
return
disposedController
;
...
...
@@ -1996,7 +1996,7 @@ void main() {
PlatformViewLink
createPlatformViewLink
()
{
return
PlatformViewLink
(
key:
key
,
createPlatformViewController
:
(
PlatformViewCreationParams
params
){
onCreatePlatformView
:
(
PlatformViewCreationParams
params
){
ids
.
add
(
params
.
id
);
controller
=
FakePlatformViewController
(
params
.
id
);
params
.
onPlatformViewCreated
(
params
.
id
);
...
...
@@ -2042,7 +2042,7 @@ void main() {
});
testWidgets
(
'PlatformViewLink can take any widget to return in the SurfaceFactory'
,
(
WidgetTester
tester
)
async
{
final
PlatformViewLink
platformViewLink
=
PlatformViewLink
(
createPlatformViewController
:
(
PlatformViewCreationParams
params
){
final
PlatformViewLink
platformViewLink
=
PlatformViewLink
(
onCreatePlatformView
:
(
PlatformViewCreationParams
params
){
params
.
onPlatformViewCreated
(
params
.
id
);
return
FakePlatformViewController
(
params
.
id
);
},
surfaceFactory:
(
BuildContext
context
,
PlatformViewController
controller
)
{
...
...
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