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
ecbea9a9
Unverified
Commit
ecbea9a9
authored
Apr 19, 2021
by
Abhishek Ghaskata
Committed by
GitHub
Apr 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update android_views to null safety (#80557)
parent
599c95a8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
23 deletions
+23
-23
main.dart
dev/integration_tests/android_views/lib/main.dart
+1
-1
motion_events_page.dart
...tegration_tests/android_views/lib/motion_events_page.dart
+10
-10
page.dart
dev/integration_tests/android_views/lib/page.dart
+1
-1
wm_integrations.dart
dev/integration_tests/android_views/lib/wm_integrations.dart
+9
-9
pubspec.yaml
dev/integration_tests/android_views/pubspec.yaml
+1
-1
main_test.dart
...ntegration_tests/android_views/test_driver/main_test.dart
+1
-1
No files found.
dev/integration_tests/android_views/lib/main.dart
View file @
ecbea9a9
...
...
@@ -20,7 +20,7 @@ void main() {
}
class
Home
extends
StatelessWidget
{
const
Home
({
Key
key
})
:
super
(
key:
key
);
const
Home
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
...
...
dev/integration_tests/android_views/lib/motion_events_page.dart
View file @
ecbea9a9
...
...
@@ -18,7 +18,7 @@ MethodChannel channel = const MethodChannel('android_views_integration');
const
String
kEventsFileName
=
'touchEvents'
;
class
MotionEventsPage
extends
PageWidget
{
const
MotionEventsPage
({
Key
key
})
const
MotionEventsPage
({
Key
?
key
})
:
super
(
'Motion Event Tests'
,
const
ValueKey
<
String
>(
'MotionEventsListTile'
),
key:
key
);
@override
...
...
@@ -35,7 +35,7 @@ class MotionEventsPage extends PageWidget {
class
FutureDataHandler
{
final
Completer
<
DataHandler
>
handlerCompleter
=
Completer
<
DataHandler
>();
Future
<
String
>
handleMessage
(
String
message
)
async
{
Future
<
String
>
handleMessage
(
String
?
message
)
async
{
final
DataHandler
handler
=
await
handlerCompleter
.
future
;
return
handler
(
message
);
}
...
...
@@ -44,7 +44,7 @@ class FutureDataHandler {
FutureDataHandler
driverDataHandler
=
FutureDataHandler
();
class
MotionEventsBody
extends
StatefulWidget
{
const
MotionEventsBody
({
Key
key
})
:
super
(
key:
key
);
const
MotionEventsBody
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
createState
()
=>
MotionEventsBodyState
();
...
...
@@ -53,7 +53,7 @@ class MotionEventsBody extends StatefulWidget {
class
MotionEventsBodyState
extends
State
<
MotionEventsBody
>
{
static
const
int
kEventsBufferSize
=
1000
;
MethodChannel
viewChannel
;
late
MethodChannel
viewChannel
;
/// The list of motion events that were passed to the FlutterView.
List
<
Map
<
String
,
dynamic
>>
flutterViewEvents
=
<
Map
<
String
,
dynamic
>>[];
...
...
@@ -103,7 +103,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
onPressed:
()
{
const
StandardMessageCodec
codec
=
StandardMessageCodec
();
saveRecordedEvents
(
codec
.
encodeMessage
(
flutterViewEvents
),
context
);
codec
.
encodeMessage
(
flutterViewEvents
)
!
,
context
);
},
),
),
...
...
@@ -171,15 +171,15 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
}
Future
<
void
>
saveRecordedEvents
(
ByteData
data
,
BuildContext
context
)
async
{
if
(
!
await
channel
.
invokeMethod
<
bool
>(
'getStoragePermission'
)
)
{
if
(
await
channel
.
invokeMethod
<
bool
>(
'getStoragePermission'
)
==
true
)
{
showMessage
(
context
,
'External storage permissions are required to save events'
);
return
;
}
try
{
final
Directory
outDir
=
await
getExternalStorageDirectory
();
final
Directory
?
outDir
=
await
getExternalStorageDirectory
();
// This test only runs on Android so we can assume path separator is '/'.
final
File
file
=
File
(
'
${outDir.path}
/
$kEventsFileName
'
);
final
File
file
=
File
(
'
${outDir
?
.path}
/
$kEventsFileName
'
);
await
file
.
writeAsBytes
(
data
.
buffer
.
asUint8List
(
0
,
data
.
lengthInBytes
),
flush:
true
);
showMessage
(
context
,
'Saved original events to
${file.path}
'
);
}
catch
(
e
)
{
...
...
@@ -209,7 +209,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
});
}
Future
<
String
>
handleDriverMessage
(
String
message
)
async
{
Future
<
String
>
handleDriverMessage
(
String
?
message
)
async
{
switch
(
message
)
{
case
'run test'
:
return
playEventsFile
();
...
...
@@ -253,7 +253,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
}
class
TouchEventDiff
extends
StatelessWidget
{
const
TouchEventDiff
(
this
.
originalEvent
,
this
.
synthesizedEvent
,
{
Key
key
})
:
super
(
key:
key
);
const
TouchEventDiff
(
this
.
originalEvent
,
this
.
synthesizedEvent
,
{
Key
?
key
})
:
super
(
key:
key
);
final
Map
<
String
,
dynamic
>
originalEvent
;
final
Map
<
String
,
dynamic
>
synthesizedEvent
;
...
...
dev/integration_tests/android_views/lib/page.dart
View file @
ecbea9a9
...
...
@@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
//
/// A testing page has to override this in order to be put as one of the items in the main page.
abstract
class
PageWidget
extends
StatelessWidget
{
const
PageWidget
(
this
.
title
,
this
.
tileKey
,
{
Key
key
})
:
super
(
key:
key
);
const
PageWidget
(
this
.
title
,
this
.
tileKey
,
{
Key
?
key
})
:
super
(
key:
key
);
/// The title of the testing page
///
...
...
dev/integration_tests/android_views/lib/wm_integrations.dart
View file @
ecbea9a9
...
...
@@ -10,7 +10,7 @@ import 'package:flutter/services.dart';
import
'page.dart'
;
class
WindowManagerIntegrationsPage
extends
PageWidget
{
const
WindowManagerIntegrationsPage
({
Key
key
})
const
WindowManagerIntegrationsPage
({
Key
?
key
})
:
super
(
'Window Manager Integrations Tests'
,
const
ValueKey
<
String
>(
'WmIntegrationsListTile'
),
key:
key
);
@override
...
...
@@ -18,7 +18,7 @@ class WindowManagerIntegrationsPage extends PageWidget {
}
class
WindowManagerBody
extends
StatefulWidget
{
const
WindowManagerBody
({
Key
key
})
:
super
(
key:
key
);
const
WindowManagerBody
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
WindowManagerBody
>
createState
()
=>
WindowManagerBodyState
();
...
...
@@ -32,10 +32,10 @@ enum _LastTestStatus {
class
WindowManagerBodyState
extends
State
<
WindowManagerBody
>
{
MethodChannel
viewChannel
;
MethodChannel
?
viewChannel
;
_LastTestStatus
lastTestStatus
=
_LastTestStatus
.
pending
;
String
lastError
;
int
id
;
String
?
lastError
;
int
?
id
;
int
windowClickCount
=
0
;
@override
...
...
@@ -87,11 +87,11 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
Widget
_statusWidget
()
{
assert
(
lastTestStatus
!=
_LastTestStatus
.
pending
);
final
String
message
=
lastTestStatus
==
_LastTestStatus
.
success
?
'Success'
:
lastError
;
final
String
?
message
=
lastTestStatus
==
_LastTestStatus
.
success
?
'Success'
:
lastError
;
return
Container
(
color:
lastTestStatus
==
_LastTestStatus
.
success
?
Colors
.
green
:
Colors
.
red
,
child:
Text
(
message
,
message
!
,
key:
const
ValueKey
<
String
>(
'Status'
),
style:
TextStyle
(
color:
lastTestStatus
==
_LastTestStatus
.
error
?
Colors
.
yellow
:
null
,
...
...
@@ -107,7 +107,7 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
});
}
try
{
await
viewChannel
.
invokeMethod
<
void
>(
'showAndHideAlertDialog'
);
await
viewChannel
?
.
invokeMethod
<
void
>(
'showAndHideAlertDialog'
);
setState
(()
{
lastTestStatus
=
_LastTestStatus
.
success
;
});
...
...
@@ -121,7 +121,7 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
Future
<
void
>
onAddWindowPressed
()
async
{
try
{
await
viewChannel
.
invokeMethod
<
void
>(
'addWindowAndWaitForClick'
);
await
viewChannel
?
.
invokeMethod
<
void
>(
'addWindowAndWaitForClick'
);
setState
(()
{
windowClickCount
++;
});
...
...
dev/integration_tests/android_views/pubspec.yaml
View file @
ecbea9a9
...
...
@@ -4,7 +4,7 @@ publish_to: none
description
:
An integration test for embedded platform views
version
:
1.0.0+1
environment
:
sdk
:
'
>=2.
9
.0
<3.0.0'
sdk
:
'
>=2.
12
.0
<3.0.0'
dependencies
:
flutter
:
...
...
dev/integration_tests/android_views/test_driver/main_test.dart
View file @
ecbea9a9
...
...
@@ -6,7 +6,7 @@ import 'package:flutter_driver/flutter_driver.dart';
import
'package:test/test.dart'
hide
TypeMatcher
,
isInstanceOf
;
Future
<
void
>
main
()
async
{
FlutterDriver
driver
;
late
FlutterDriver
driver
;
setUpAll
(()
async
{
driver
=
await
FlutterDriver
.
connect
();
...
...
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