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
e82a69a9
Unverified
Commit
e82a69a9
authored
Jul 08, 2021
by
Maurice Parrish
Committed by
GitHub
Jul 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create flag to enable/disable FlutterView render surface conversion (#85648)
parent
fecf2383
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
platform_views.dart
packages/flutter/lib/src/services/platform_views.dart
+18
-0
fake_platform_views.dart
packages/flutter/test/services/fake_platform_views.dart
+9
-0
platform_views_test.dart
packages/flutter/test/services/platform_views_test.dart
+5
-0
No files found.
packages/flutter/lib/src/services/platform_views.dart
View file @
e82a69a9
...
...
@@ -179,6 +179,24 @@ class PlatformViewsService {
return
controller
;
}
/// Whether the render surface of the Android `FlutterView` should be converted to a `FlutterImageView`.
///
/// When adding platform views using
/// [Hybrid Composition](https://flutter.dev/docs/development/platform-integration/platform-views),
/// the engine converts the render surface to a `FlutterImageView` to improve
/// animation synchronization between Flutter widgets and the Android platform
/// views. On Android versions < 10, this can have some performance issues.
/// This flag allows disabling this conversion.
///
/// Defaults to true.
static
Future
<
void
>
synchronizeToNativeViewHierarchy
(
bool
yes
)
{
assert
(
defaultTargetPlatform
==
TargetPlatform
.
android
);
return
SystemChannels
.
platform_views
.
invokeMethod
<
void
>(
'synchronizeToNativeViewHierarchy'
,
yes
,
);
}
// TODO(amirh): reference the iOS plugin API for registering a UIView factory once it lands.
/// This is work in progress, not yet ready to be used, and requires a custom engine build. Creates a controller for a new iOS UIView.
///
...
...
packages/flutter/test/services/fake_platform_views.dart
View file @
e82a69a9
...
...
@@ -141,6 +141,8 @@ class FakeAndroidPlatformViewsController {
int
?
lastClearedFocusViewId
;
bool
synchronizeToNativeViewHierarchy
=
true
;
void
registerViewType
(
String
viewType
)
{
_registeredViewTypes
.
add
(
viewType
);
}
...
...
@@ -166,6 +168,8 @@ class FakeAndroidPlatformViewsController {
return
_setDirection
(
call
);
case
'clearFocus'
:
return
_clearFocus
(
call
);
case
'synchronizeToNativeViewHierarchy'
:
return
_synchronizeToNativeViewHierarchy
(
call
);
}
return
Future
<
dynamic
>.
sync
(()
=>
null
);
}
...
...
@@ -299,6 +303,11 @@ class FakeAndroidPlatformViewsController {
lastClearedFocusViewId
=
id
;
return
Future
<
dynamic
>.
sync
(()
=>
null
);
}
Future
<
dynamic
>
_synchronizeToNativeViewHierarchy
(
MethodCall
call
)
{
synchronizeToNativeViewHierarchy
=
call
.
arguments
as
bool
;
return
Future
<
dynamic
>.
sync
(()
=>
null
);
}
}
class
FakeIosPlatformViewsController
{
...
...
packages/flutter/test/services/platform_views_test.dart
View file @
e82a69a9
...
...
@@ -218,6 +218,11 @@ void main() {
]),
);
});
test
(
'synchronizeToNativeViewHierarchy'
,
()
async
{
await
PlatformViewsService
.
synchronizeToNativeViewHierarchy
(
false
);
expect
(
viewsController
.
synchronizeToNativeViewHierarchy
,
false
);
});
});
group
(
'iOS'
,
()
{
...
...
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