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
efdbe403
Unverified
Commit
efdbe403
authored
May 24, 2021
by
Abhishek Ghaskata
Committed by
GitHub
May 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor android_view example (#83160)
parent
ee17ebe5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
motion_events_page.dart
...tegration_tests/android_views/lib/motion_events_page.dart
+6
-6
No files found.
dev/integration_tests/android_views/lib/motion_events_page.dart
View file @
efdbe403
...
...
@@ -53,7 +53,7 @@ class MotionEventsBody extends StatefulWidget {
class
MotionEventsBodyState
extends
State
<
MotionEventsBody
>
{
static
const
int
kEventsBufferSize
=
1000
;
late
MethodChannel
viewChannel
;
MethodChannel
?
viewChannel
;
/// The list of motion events that were passed to the FlutterView.
List
<
Map
<
String
,
dynamic
>>
flutterViewEvents
=
<
Map
<
String
,
dynamic
>>[];
...
...
@@ -137,14 +137,14 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
.
map
<
Map
<
String
,
dynamic
>>((
Map
<
dynamic
,
dynamic
>
e
)
=>
e
.
cast
<
String
,
dynamic
>())
.
toList
();
await
channel
.
invokeMethod
<
void
>(
'pipeFlutterViewEvents'
);
await
viewChannel
.
invokeMethod
<
void
>(
'pipeTouchEvents'
);
await
viewChannel
?
.
invokeMethod
<
void
>(
'pipeTouchEvents'
);
print
(
'replaying
${recordedEvents.length}
motion events'
);
for
(
final
Map
<
String
,
dynamic
>
event
in
recordedEvents
.
reversed
)
{
await
channel
.
invokeMethod
<
void
>(
'synthesizeEvent'
,
event
);
}
await
channel
.
invokeMethod
<
void
>(
'stopFlutterViewEvents'
);
await
viewChannel
.
invokeMethod
<
void
>(
'stopTouchEvents'
);
await
viewChannel
?
.
invokeMethod
<
void
>(
'stopTouchEvents'
);
if
(
flutterViewEvents
.
length
!=
embeddedViewEvents
.
length
)
return
'Synthesized
${flutterViewEvents.length}
events but the embedded view received
${embeddedViewEvents.length}
events'
;
...
...
@@ -196,16 +196,16 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
void
onPlatformViewCreated
(
int
id
)
{
viewChannel
=
MethodChannel
(
'simple_view/
$id
'
);
viewChannel
.
setMethodCallHandler
(
onViewMethodChannelCall
);
viewChannel
?
.
setMethodCallHandler
(
onViewMethodChannelCall
);
driverDataHandler
.
handlerCompleter
.
complete
(
handleDriverMessage
);
}
void
listenToFlutterViewEvents
()
{
channel
.
invokeMethod
<
void
>(
'pipeFlutterViewEvents'
);
viewChannel
.
invokeMethod
<
void
>(
'pipeTouchEvents'
);
viewChannel
?
.
invokeMethod
<
void
>(
'pipeTouchEvents'
);
Timer
(
const
Duration
(
seconds:
3
),
()
{
channel
.
invokeMethod
<
void
>(
'stopFlutterViewEvents'
);
viewChannel
.
invokeMethod
<
void
>(
'stopTouchEvents'
);
viewChannel
?
.
invokeMethod
<
void
>(
'stopTouchEvents'
);
});
}
...
...
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