Make Action.enabled be isEnabled(Intent intent) instead. (#55230)

This commit is contained in:
Greg Spencer
2020-04-21 13:18:04 -07:00
committed by GitHub
parent 8ee26efb93
commit 36767d01e4
4 changed files with 31 additions and 49 deletions

View File

@@ -193,7 +193,7 @@ class UndoIntent extends Intent {
class UndoAction extends Action<UndoIntent> {
@override
bool get enabled {
bool isEnabled(UndoIntent intent) {
final UndoableActionDispatcher manager = Actions.of(primaryFocus?.context ?? FocusDemo.appKey.currentContext, nullOk: true) as UndoableActionDispatcher;
return manager.canUndo;
}
@@ -211,7 +211,7 @@ class RedoIntent extends Intent {
class RedoAction extends Action<RedoIntent> {
@override
bool get enabled {
bool isEnabled(RedoIntent intent) {
final UndoableActionDispatcher manager = Actions.of(primaryFocus.context, nullOk: true) as UndoableActionDispatcher;
return manager.canRedo;
}