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
4ead92cf
Unverified
Commit
4ead92cf
authored
Sep 19, 2022
by
fzyzcjy
Committed by
GitHub
Sep 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UiKitView which wrongly unconditionally repaints (#111790)
parent
88707f7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
4 deletions
+43
-4
platform_view.dart
packages/flutter/lib/src/rendering/platform_view.dart
+7
-4
platform_view_test.dart
packages/flutter/test/rendering/platform_view_test.dart
+36
-0
No files found.
packages/flutter/lib/src/rendering/platform_view.dart
View file @
4ead92cf
...
...
@@ -320,10 +320,13 @@ class RenderUiKitView extends RenderBox {
/// must have been created by calling [PlatformViewsService.initUiKitView].
UiKitViewController
get
viewController
=>
_viewController
;
UiKitViewController
_viewController
;
set
viewController
(
UiKitViewController
viewController
)
{
assert
(
viewController
!=
null
);
final
bool
needsSemanticsUpdate
=
_viewController
.
id
!=
viewController
.
id
;
_viewController
=
viewController
;
set
viewController
(
UiKitViewController
value
)
{
assert
(
value
!=
null
);
if
(
_viewController
==
value
)
{
return
;
}
final
bool
needsSemanticsUpdate
=
_viewController
.
id
!=
value
.
id
;
_viewController
=
value
;
markNeedsPaint
();
if
(
needsSemanticsUpdate
)
{
markNeedsSemanticsUpdate
();
...
...
packages/flutter/test/rendering/platform_view_test.dart
View file @
4ead92cf
...
...
@@ -260,6 +260,42 @@ void main() {
expect
(
renderBox
.
debugLayer
,
isNull
);
});
});
test
(
'markNeedsPaint does not get called when setting the same viewController'
,
()
{
FakeAsync
().
run
((
FakeAsync
async
)
{
final
Completer
<
void
>
viewCreation
=
Completer
<
void
>();
const
MethodChannel
channel
=
MethodChannel
(
'flutter/platform_views'
);
binding
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
channel
,
(
MethodCall
methodCall
)
async
{
assert
(
methodCall
.
method
==
'create'
,
'Unexpected method call'
);
await
viewCreation
.
future
;
return
/*textureId=*/
0
;
});
bool
futureCallbackRan
=
false
;
PlatformViewsService
.
initUiKitView
(
id:
0
,
viewType:
'webview'
,
layoutDirection:
TextDirection
.
ltr
).
then
((
UiKitViewController
viewController
)
{
final
RenderUiKitView
renderBox
=
RenderUiKitView
(
viewController:
viewController
,
hitTestBehavior:
PlatformViewHitTestBehavior
.
opaque
,
gestureRecognizers:
<
Factory
<
OneSequenceGestureRecognizer
>>{},
);
layout
(
renderBox
);
pumpFrame
(
phase:
EnginePhase
.
paint
);
expect
(
renderBox
.
debugNeedsPaint
,
isFalse
);
renderBox
.
viewController
=
viewController
;
expect
(
renderBox
.
debugNeedsPaint
,
isFalse
);
futureCallbackRan
=
true
;
});
viewCreation
.
complete
();
async
.
flushMicrotasks
();
expect
(
futureCallbackRan
,
true
);
});
});
}
ui
.
PointerData
_pointerData
(
...
...
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