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
013dc3dd
Unverified
Commit
013dc3dd
authored
Apr 20, 2021
by
Abhishek Ghaskata
Committed by
GitHub
Apr 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate ios_add2app_life_cycle to nullsafety (#80617)
parent
fdda777e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
main.dart
...ion_tests/ios_add2app_life_cycle/flutterapp/lib/main.dart
+12
-12
pubspec.yaml
...tion_tests/ios_add2app_life_cycle/flutterapp/pubspec.yaml
+1
-1
No files found.
dev/integration_tests/ios_add2app_life_cycle/flutterapp/lib/main.dart
View file @
013dc3dd
...
@@ -8,14 +8,14 @@ import 'package:flutter/rendering.dart';
...
@@ -8,14 +8,14 @@ import 'package:flutter/rendering.dart';
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
import
'package:collection/collection.dart'
;
import
'package:collection/collection.dart'
;
VoidCallback
originalSemanticsListener
;
VoidCallback
?
originalSemanticsListener
;
void
main
(
)
{
void
main
(
)
{
WidgetsFlutterBinding
.
ensureInitialized
();
WidgetsFlutterBinding
.
ensureInitialized
();
// Disconnects semantics listener for testing purposes.
// Disconnects semantics listener for testing purposes.
originalSemanticsListener
=
ui
.
window
.
onSemanticsEnabledChanged
;
originalSemanticsListener
=
ui
.
window
.
onSemanticsEnabledChanged
;
ui
.
window
.
onSemanticsEnabledChanged
=
null
;
ui
.
window
.
onSemanticsEnabledChanged
=
null
;
RendererBinding
.
instance
.
setSemanticsEnabled
(
false
);
RendererBinding
.
instance
?
.
setSemanticsEnabled
(
false
);
// If the test passes, LifeCycleSpy will rewire the semantics listener back.
// If the test passes, LifeCycleSpy will rewire the semantics listener back.
runApp
(
const
LifeCycleSpy
());
runApp
(
const
LifeCycleSpy
());
}
}
...
@@ -28,7 +28,7 @@ void main() {
...
@@ -28,7 +28,7 @@ void main() {
///
///
/// Rewiring semantics is a signal to native IOS test that the test has passed.
/// Rewiring semantics is a signal to native IOS test that the test has passed.
class
LifeCycleSpy
extends
StatefulWidget
{
class
LifeCycleSpy
extends
StatefulWidget
{
const
LifeCycleSpy
({
Key
key
})
:
super
(
key:
key
);
const
LifeCycleSpy
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
_LifeCycleSpyState
createState
()
=>
_LifeCycleSpyState
();
_LifeCycleSpyState
createState
()
=>
_LifeCycleSpyState
();
...
@@ -40,36 +40,36 @@ class _LifeCycleSpyState extends State<LifeCycleSpy> with WidgetsBindingObserver
...
@@ -40,36 +40,36 @@ class _LifeCycleSpyState extends State<LifeCycleSpy> with WidgetsBindingObserver
AppLifecycleState
.
inactive
,
AppLifecycleState
.
inactive
,
AppLifecycleState
.
resumed
,
AppLifecycleState
.
resumed
,
];
];
List
<
AppLifecycleState
>
_actualLifeCycleSequence
;
List
<
AppLifecycleState
?>?
_actualLifeCycleSequence
;
@override
@override
void
initState
(){
void
initState
(){
super
.
initState
();
super
.
initState
();
WidgetsBinding
.
instance
.
addObserver
(
this
);
WidgetsBinding
.
instance
?
.
addObserver
(
this
);
_actualLifeCycleSequence
=
<
AppLifecycleState
>[
_actualLifeCycleSequence
=
<
AppLifecycleState
?
>[
ServicesBinding
.
instance
.
lifecycleState
ServicesBinding
.
instance
?
.
lifecycleState
];
];
}
}
@override
@override
void
dispose
()
{
void
dispose
()
{
WidgetsBinding
.
instance
.
removeObserver
(
this
);
WidgetsBinding
.
instance
?
.
removeObserver
(
this
);
super
.
dispose
();
super
.
dispose
();
}
}
@override
@override
void
didChangeAppLifecycleState
(
AppLifecycleState
state
)
{
void
didChangeAppLifecycleState
(
AppLifecycleState
state
)
{
setState
(()
{
setState
(()
{
_actualLifeCycleSequence
=
List
<
AppLifecycleState
>.
from
(
_actualLifeCycleSequence
);
_actualLifeCycleSequence
=
List
<
AppLifecycleState
>.
from
(
_actualLifeCycleSequence
!
);
_actualLifeCycleSequence
.
add
(
state
);
_actualLifeCycleSequence
?
.
add
(
state
);
});
});
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
if
(
const
ListEquality
<
AppLifecycleState
>().
equals
(
_actualLifeCycleSequence
,
_expectedLifeCycleSequence
))
{
if
(
const
ListEquality
<
AppLifecycleState
?
>().
equals
(
_actualLifeCycleSequence
,
_expectedLifeCycleSequence
))
{
// Rewires the semantics harness if test passes.
// Rewires the semantics harness if test passes.
RendererBinding
.
instance
.
setSemanticsEnabled
(
true
);
RendererBinding
.
instance
?
.
setSemanticsEnabled
(
true
);
ui
.
window
.
onSemanticsEnabledChanged
=
originalSemanticsListener
;
ui
.
window
.
onSemanticsEnabledChanged
=
originalSemanticsListener
;
}
}
return
const
MaterialApp
(
return
const
MaterialApp
(
...
...
dev/integration_tests/ios_add2app_life_cycle/flutterapp/pubspec.yaml
View file @
013dc3dd
...
@@ -14,7 +14,7 @@ description: A new flutter module project.
...
@@ -14,7 +14,7 @@ description: A new flutter module project.
version
:
1.0.0+1
version
:
1.0.0+1
environment
:
environment
:
sdk
:
"
>=2.
0.0-dev.68
.0
<3.0.0"
sdk
:
"
>=2.
12
.0
<3.0.0"
dependencies
:
dependencies
:
flutter
:
flutter
:
...
...
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