hamaluik / timecop

A time tracking app that respects your privacy and the gets the job done without being fancy.
https://timecop.app/
Apache License 2.0
796 stars 149 forks source link

Fix #105 #106

Closed Adrian-Samoticha closed 1 year ago

Adrian-Samoticha commented 1 year ago

This PR fixes #105.

The issue was caused by the fact that the “(no project)” choice of the user was represented by the chosenProject variable in the ProjectSelectField.dart file being null. Since dismissing the dialog also caused null to be returned from the showDialog function, the dialog's barrierDismissible property was set to false to prevent bugs.

This PR adds a new private class called _ProjectChoice which is instead returned from the showDialog function. If it is null, then the dialog has been dismissed and the Bloc is not notified of any ProjectChangedEvent. Otherwise, the Bloc is notified of the _ProjectChoice's chosenProject property, which may be null in case the user selected the “(no project)” choice in the dialog.