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
c05c9f77
Unverified
Commit
c05c9f77
authored
Apr 06, 2022
by
chunhtai
Committed by
GitHub
Apr 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makes AutomaticKeepAlive.child non null (#101376)
parent
7f64e2ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
automatic_keep_alive.dart
packages/flutter/lib/src/widgets/automatic_keep_alive.dart
+5
-6
No files found.
packages/flutter/lib/src/widgets/automatic_keep_alive.dart
View file @
c05c9f77
...
@@ -28,13 +28,13 @@ class AutomaticKeepAlive extends StatefulWidget {
...
@@ -28,13 +28,13 @@ class AutomaticKeepAlive extends StatefulWidget {
/// [KeepAlive] widget appropriately.
/// [KeepAlive] widget appropriately.
const
AutomaticKeepAlive
({
const
AutomaticKeepAlive
({
Key
?
key
,
Key
?
key
,
this
.
child
,
required
this
.
child
,
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
/// The widget below this widget in the tree.
/// The widget below this widget in the tree.
///
///
/// {@macro flutter.widgets.ProxyWidget.child}
/// {@macro flutter.widgets.ProxyWidget.child}
final
Widget
?
child
;
final
Widget
child
;
@override
@override
State
<
AutomaticKeepAlive
>
createState
()
=>
_AutomaticKeepAliveState
();
State
<
AutomaticKeepAlive
>
createState
()
=>
_AutomaticKeepAliveState
();
...
@@ -42,7 +42,7 @@ class AutomaticKeepAlive extends StatefulWidget {
...
@@ -42,7 +42,7 @@ class AutomaticKeepAlive extends StatefulWidget {
class
_AutomaticKeepAliveState
extends
State
<
AutomaticKeepAlive
>
{
class
_AutomaticKeepAliveState
extends
State
<
AutomaticKeepAlive
>
{
Map
<
Listenable
,
VoidCallback
>?
_handles
;
Map
<
Listenable
,
VoidCallback
>?
_handles
;
Widget
?
_child
;
late
Widget
_child
;
bool
_keepingAlive
=
false
;
bool
_keepingAlive
=
false
;
@override
@override
...
@@ -60,7 +60,7 @@ class _AutomaticKeepAliveState extends State<AutomaticKeepAlive> {
...
@@ -60,7 +60,7 @@ class _AutomaticKeepAliveState extends State<AutomaticKeepAlive> {
void
_updateChild
()
{
void
_updateChild
()
{
_child
=
NotificationListener
<
KeepAliveNotification
>(
_child
=
NotificationListener
<
KeepAliveNotification
>(
onNotification:
_addClient
,
onNotification:
_addClient
,
child:
widget
.
child
!
,
child:
widget
.
child
,
);
);
}
}
...
@@ -228,10 +228,9 @@ class _AutomaticKeepAliveState extends State<AutomaticKeepAlive> {
...
@@ -228,10 +228,9 @@ class _AutomaticKeepAliveState extends State<AutomaticKeepAlive> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
_child
!=
null
);
return
KeepAlive
(
return
KeepAlive
(
keepAlive:
_keepingAlive
,
keepAlive:
_keepingAlive
,
child:
_child
!
,
child:
_child
,
);
);
}
}
...
...
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