Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/src/terminal_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TerminalView extends StatefulWidget {
this.alwaysShowCursor = false,
this.deleteDetection = false,
this.shortcuts,
this.actions,
this.readOnly = false,
this.hardwareKeyboardOnly = false,
}) : super(key: key);
Expand Down Expand Up @@ -118,6 +119,9 @@ class TerminalView extends StatefulWidget {
/// of the terminal If not provided, [defaultTerminalShortcuts] will be used.
final Map<ShortcutActivator, Intent>? shortcuts;

/// Optional actions for this terminal.
final Map<Type, Action<Intent>>? actions;

/// True if no input should send to the terminal.
final bool readOnly;

Expand Down Expand Up @@ -261,6 +265,7 @@ class TerminalViewState extends State<TerminalView> {
child = TerminalActions(
terminal: widget.terminal,
controller: _controller,
actions: widget.actions,
child: child,
);

Expand Down
4 changes: 4 additions & 0 deletions lib/src/ui/shortcut/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TerminalActions extends StatelessWidget {
super.key,
required this.terminal,
required this.controller,
required this.actions,
required this.child,
});

Expand All @@ -19,6 +20,8 @@ class TerminalActions extends StatelessWidget {

final Widget child;

final Map<Type, Action<Intent>>? actions;

@override
Widget build(BuildContext context) {
return Actions(
Expand Down Expand Up @@ -60,6 +63,7 @@ class TerminalActions extends StatelessWidget {
return null;
},
),
...?actions,
},
child: child,
);
Expand Down