You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: nodetasks_events.go
    path of file: ./repos/dry/app
    
    the code of the file until where you have to start completion: package app

import (
	"fmt"

	"github.com/gdamore/tcell"
	"github.com/moncho/dry/appui/swarm"
)

type taskScreenEventHandler struct {
	baseEventHandler
	widget *swarm.NodeTasksWidget
}

func (h *taskScreenEventHandler) handle(event *tcell.EventKey, f func(eventHandler)) {

	handled := true
	switch event.Key() {
	case tcell.KeyEsc:
		f(viewsToHandlers[Nodes])
		h.dry.changeView(Nodes)
	case tcell.KeyF1: //sort
		widgets.NodeTasks.Sort()
	case tcell.KeyF5: // refresh
		h.widget.Unmount()
	case tc
    
func (h *taskScreenEventHandler) handle(event *tcell.EventKey, f func(eventHandler)) {

	handled := true
	switch event.Key() {
	case tcell.KeyEsc:
		f(viewsToHandlers[Nodes])
		h.dry.changeView(Nodes)
	case tcell.KeyF1: //sort
		widgets.NodeTasks.Sort()
	case tcell.KeyF5: // refresh
		h.widget.Unmount()
	case tcell.KeyEnter:
		forwarder := newEventForwarder()
		f(forwarder)
		if err := h.widget.OnEvent(
			inspect(
				h.screen,
				forwarder.events(),
				func(id string) (interface{}, error) {
					return h.dry.dockerDaemon.Task(id)
				},
				func() {
					h.dry.changeView(Tasks)
					f(h)
					refreshScreen()
				})); err != nil {
			h.dry.message(
				fmt.Sprintf("Error inspecting stack: %s", err.Error()))
		}
	default:
		handled = false
	}
	if !handled {
		switch event.Rune() {
		case '%':
			handled = true
			forwarder := newEventForwarder()
			f(forwarder)
			refreshScreen()
			applyFilter := func(filter string, canceled bool) {
				if !canceled {
					h.widget.Filter(filter)
				}
				f(h)
			}
			showFilterInput(newEventSource(forwarder.events()), applyFilter)
		}
	}
	if !handled {
		h.baseEventHandler.handle(event, f)
	}
}