Adventures in Desktop App development II: Revenge of the Gopher
Tags: go, fyne, gui, flutter
Published: 2022-10-07 09:36:28

---
title: Adventures in Desktop App development II: Revenge of the Gopher
published: true
description: gui development, fyne, golang and other things
tags: golang, fyne, gui, flutter
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t57javhb1oan0h27xvd8.png
# Use a ratio of 100:42 for best results.
---

## Wat
Few weeks ago I [posted](https://vikkio.hashnode.dev/my-adventures-in-desktop-gui-app-development-land) about how I wanted to see what it was like to work with desktop apps.

I ended up saying that I was going to try [Vala](https://vala.dev/), well I did not go too far with that.

If just feels like the community is not there, but I might try again in a few months.

What I did instead was to post the same article on [dev.to](https://dev.to/vikkio88/my-adventures-in-desktop-gui-app-development-land-59b7) and I got some answers to the post, and a few nice suggestions came in:

1. Try [Flutter](https://flutter.dev/multi-platform/desktop)
2. Try [Fyne](https://fyne.io/)
3. Try [Tauri](https://tauri.app/)

All of those would require me to (re)learn another language.

## Flutter

![flutter-lockup.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665129937122/AT5at-Srp.png)
Flutter uses [Dart](https://dart.dev/), a hybrid between Typescript and Java, but better.
It looks like has loads of momentum going and I have to say the [VSCode extension](https://docs.flutter.dev/get-started/editor?tab=vscode) for it works flawlessly and it is just amazing.

I went over some tutorials about the language itself but I got bored quite quickly and I decided to give up for now and come back later.

## Fyne

![fyne.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665130030658/dtA69W7BT.png)

Fyne was fine. It uses [Go](https://go.dev/), which is a language I have used in one of my previous companies, so I decided to dust it off and try it out.

I worked for a few days on a [TODO App](https://github.com/vikkio88/gtodos) with a persistence layer, something I had done with [AvaloniaUI](https://github.com/vikkio88/ToDoAvalonia).

It just not doing anything for me.
I mean it does work and ticks a lot of boxes for me:
![Screenshot 2022-10-07 at 09.10.43.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665130262861/GbxjDx7cC.png)

- Small binary
- Easy to build with
- not too much code to handle basic things

I joined the [discord](https://discord.gg/vvBuDfD5gP) and asked about things, but it kind of felt like it is just the main dev there helping out and most of the time is kind of "find your own solution" or [RTFM](https://en.wikipedia.org/wiki/RTFM), which was exactly the opposite with the community of AvaloniaUI.

What didn't really work was how hard it feels to do simple things, like binding a list of objects to a listview on the actual app UI.
```go
list := widget.NewListWithData(
		data,
		func() fyne.CanvasObject {
        // in this function you design what your item UI looks like
			c := widget.NewCheck("", nil)
			return container.New(layout.NewBorderLayout(nil, nil, nil, c), c, widget.NewLabel(""))
		},
		func(di binding.DataItem, co fyne.CanvasObject) {
        // here will run for each item on the list using the result of the other function as canvas to paint on kind of thing
			t := todoFromDataItem(di)
			container := co.(*fyne.Container)
			label := container.Objects[1].(*widget.Label)
			check := container.Objects[0].(*widget.Check)
			label.Bind(binding.BindString(&t.Description))
			check.Bind(binding.BindBool(&t.Done))
		},
	)

// and to cast your dataitem into your struct you need to do something like this
func todoFromDataItem(item binding.DataItem) *models.Todo {
	u, _ := item.(binding.Untyped)
	v, _ := u.Get()
	t, _ := v.(models.Todo)
	return &t
}
```

There is no simple way of removing items for lists, nor to update a single one on that list.
I think the main problem is that the examples on the main docs: [List](https://developer.fyne.io/widget/list) and [ListWithData](https://developer.fyne.io/binding/list) are using primitive types, and not too many details are given.

Even looking around on the extension libs [fyne-x](https://github.com/fyne-io/fyne-x/tree/master/data/binding) there isn't much for this simple use case.

The layout docs are a bit confusing and the examples are a bit simplistic, so you cant really do a simple operations like `stretch a widget to occupy the whole available space`, unless you combine loads of containers and make your code a bit messy.

I asked if there was a plan to use some sort of XAML kind of language to define UI structure and I was told no, which is fair enough


I guess there are not enough people working on enough complex scenarios to make it worthwhile to build more complex and dev friendly ways of doing things.

It is a pity though as the code looks neat and the app runs smoothly and looks gorgeous.

Will come back to that in the future I am sure, and maybe will edit the main doc to add the simple case scenario of biding a list of struct to the UI for the next person like me.

## Tauri
[Tauri](https://tauri.app/) looks like electron on steroids, and it uses [Rust](https://www.rust-lang.org/) which I am in a bit of a love/hate relationship with and I need to refresh at some point.

## Other things
I really want to like Avalonia and use it more, so I tried out to make packaging and publishing the [Muscurd-i - Password Manager](https://vikkio.hashnode.dev/muscurd-i-my-personal-password-manager) binaries using [GitHub Actions](https://github.com/features/actions). 

I had the problem that cross-building the app with Linux it would always open up a console underneath the app, that does not seem to happen if you cross-build with Windows, so I did [that](https://github.com/vikkio88/muscurd-i/blob/main/.github/workflows/on-release.yml#L10), and it worked like a [charm](https://github.com/vikkio88/muscurd-i/releases/tag/alpha_220921_1).

## What now

Now I am a bit in two minds, I might give a bit more of a chance to Avalonia with a project I tried to do 600 times already: A Football Manager game but focussed on Transfer Market.
I started that in:
- [Rust](https://github.com/vikkio88/foot-md-sim)
- [Php](https://github.com/vikkio88/dsManager-php)
- [Python](https://github.com/vikkio88/pyDsManager)
- [Java](https://github.com/vikkio88/mister)
- [C#/WinForm](https://github.com/vikkio88/dsmanager) before I knew how to code properly.
- [NodeJs/Cli](https://github.com/vikkio88/ads-cli) I think is the one which is closer to completion
- [ReactNative](https://github.com/vikkio88/ads-native)
- [React fully FE](https://github.com/vikkio88/ads-react)
- [Vue-FE](https://github.com/vikkio88/ads-web)/[PHP-BE](https://github.com/vikkio88/ads-api)

That is a lot of tries.... maybe this time is the one, as they say *the 10th is the charm*.

bye for now.