Organizing the Interface’s Layout

Learn how to add an interface layout to our application.

Now that we’ve added the main widgets, we can create the buttons to start and pause Pomodoro intervals. To make it easier to maintain and update the code, we’ll add the buttons in a different file. Save and close the widgets.go file and open a new file buttons.go for editing.

Creating the buttons

We start by adding the package definition and the import list. For this file, we’ll use the following packages:

  • context to carry cancellation signals.
  • fmt to format strings.
  • termdash/cell, which provides customization options for widgets.
  • termdash/widgets/button to define a button widget.
  • pomodoro, which we created with the business logic.

Get hands-on with 1200+ tech skills courses.