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
c7f09251
Unverified
Commit
c7f09251
authored
Nov 12, 2020
by
Michael Goderbauer
Committed by
GitHub
Nov 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix return type of ContextAction.invoke (#70397)
parent
5fedad91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
actions.dart
packages/flutter/lib/src/widgets/actions.dart
+1
-1
actions_test.dart
packages/flutter/test/widgets/actions_test.dart
+37
-0
No files found.
packages/flutter/lib/src/widgets/actions.dart
View file @
c7f09251
...
...
@@ -342,7 +342,7 @@ abstract class ContextAction<T extends Intent> extends Action<T> {
/// ```
@protected
@override
Object
invoke
(
covariant
T
intent
,
[
BuildContext
?
context
]);
Object
?
invoke
(
covariant
T
intent
,
[
BuildContext
?
context
]);
}
/// The signature of a callback accepted by [CallbackAction].
...
...
packages/flutter/test/widgets/actions_test.dart
View file @
c7f09251
...
...
@@ -448,6 +448,33 @@ void main() {
expect
(
identical
(
result
,
sentinel
),
isTrue
);
expect
(
invoked
,
isTrue
);
});
testWidgets
(
'ContextAction can return null'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
containerKey
=
GlobalKey
();
const
TestIntent
intent
=
TestIntent
();
final
TestContextAction
testAction
=
TestContextAction
();
await
tester
.
pumpWidget
(
Actions
(
dispatcher:
TestDispatcher1
(
postInvoke:
collect
),
actions:
<
Type
,
Action
<
Intent
>>{
TestIntent:
testAction
,
},
child:
Container
(
key:
containerKey
),
),
);
await
tester
.
pump
();
final
Object
?
result
=
Actions
.
invoke
<
TestIntent
>(
containerKey
.
currentContext
!,
intent
,
);
expect
(
result
,
isNull
);
expect
(
invokedIntent
,
equals
(
intent
));
expect
(
invokedAction
,
equals
(
testAction
));
expect
(
invokedDispatcher
.
runtimeType
,
equals
(
TestDispatcher1
));
expect
(
testAction
.
capturedContexts
.
single
,
containerKey
.
currentContext
);
});
});
group
(
'Listening'
,
()
{
...
...
@@ -834,3 +861,13 @@ void main() {
});
});
}
class
TestContextAction
extends
ContextAction
<
TestIntent
>
{
List
<
BuildContext
?>
capturedContexts
=
<
BuildContext
?>[];
@override
Object
?
invoke
(
covariant
TestIntent
intent
,
[
BuildContext
?
context
])
{
capturedContexts
.
add
(
context
);
return
null
;
}
}
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