47 Commits

Author SHA1 Message Date
7fd1c99287 Use Provider's context.read/watch
Instead of the legacy Provider.of. Less scope of bugs this way and the
code is so much nicer to read.
2023-12-06 08:20:40 +01:00
833dcd3294 Improve code readability 2023-12-06 08:20:40 +01:00
88d5cf8713 Upgrade deps + flutter
* Also remove dart_code_metrics
2023-11-25 00:51:25 +01:00
657721adc6 Update dart-git and stop using the Result class
Instead we're going to move back to standard exceptions.

Using a custom Result class has created far far more problems
- The Stacktraces aren't always right
- Sometimes one forgets to check the Result error
- All other exception throwing code needing to be converted to Results
- Non idiomatic Dart code

I think it's better to just go back to exceptions. They have their
problems, but overall, I think it's a better approach.
2023-11-24 14:03:30 +01:00
83c689d668 NoteEditorSelector -> NoteEditorSelectionDialog
Also add it to WidgetBook
2023-02-21 16:08:21 +01:00
536f909bba Fix bug where saving new note can create duplicate files 2023-02-16 13:43:33 +01:00
2de590aa63 Fixed bug where the delete button inside an editor wouldn't work due to the note having a reset oid 2023-02-16 13:25:16 +01:00
d164562b54 Make sure the rootFolder says "Root Folder"
Instead of some empty text
2023-01-20 12:52:06 +01:00
6d453ee62a Rename app_localization_context to l10n
It's easier to enter and this file now contains far more things
2022-11-27 17:52:03 +01:00
a1e562b5d8 Translate a few more fields 2022-11-21 03:12:02 +01:00
b925da7a47 Use the generated localization instead of easy_localization
Not everywhere, but a large part of the code base.

This way, hot reloading will also reload the strings which makes for
such a better developer experience.
2022-11-19 03:02:01 +01:00
2661eda3da Editor: Buffer all async actions
This isn't a perfect fix, but it should fix all the issues with the
double notes.
2022-06-24 17:12:27 +02:00
7c1f92df88 Run dart fix --apply 2022-06-07 11:30:06 +02:00
92e73c414d Move core Note classes into a separate file
I'm trying to get ride of this huge 'Note' class, and have it be quite
dumb. The idea is that we'll have separate Note subclasses - TxtNote,
MdNote, etc
2022-04-24 13:09:14 +02:00
e6140fe80a Add a test for sharing an image to GitJournal
I cannot seem to get this to work. Async code in tests is problematic.

Related to #611
2022-03-18 16:45:13 +01:00
dc5763de6a Add a test for testing sharing some text 2022-03-18 16:33:52 +01:00
51a2b09332 Write a test for heading being deleted
This test passes :(

https://github.com/GitJournal/GitJournal/issues/579

On the plus side, I've learnt a lot about widget testing.
2022-03-01 17:10:47 +01:00
61c0052e2d Fix using note's title as filename
Also added a full end-to-end test which uses the NoteEditor and types
some text + saves the note. This has taken more than an hour, but is
going to be very useful to improve GitJournal's reliability.

Fixes #604
2022-02-24 14:26:25 +01:00
0a085e78e7 MdYamlDoc: Make it immutable 2022-01-27 15:17:56 +01:00
dca9064b80 NoteEditor: Ensure only state variables are modified in setState
I'm trying to use the convention where all internal variables start with
an _
2022-01-27 12:22:43 +01:00
afd7690611 Use fast_immutable_collections instead of Kt
It's much more intuitive to use, and is way more performant.
2022-01-27 12:13:34 +01:00
3841cdcab9 Note.tags: Use an compile time immutable set 2022-01-27 11:52:43 +01:00
c56da852b6 Add more specialized snackbox functions
It's easier to control how the errors look this way.
2022-01-27 10:26:23 +01:00
c9a031dd29 moveNote: Add test + fix
Fixes #590
2022-01-26 12:01:47 +01:00
3a4606b836 Image: Handle FS exceptions 2022-01-25 14:23:37 +01:00
901e4b5cb9 Avoid importing dart_git's Result class
It's easier to see where all dart_git is used this way, and this result
class should be refactored into its own package anyway.
2022-01-22 10:11:45 +01:00
2e2e371c25 Repository.addNote: Allow it to fail 2022-01-21 21:54:38 +01:00
da5346e0f4 Repository.updateNote: Handle failures
We were silently ignoring them before.
2022-01-21 21:44:01 +01:00
c72f020620 NoteEditor: Handle the case when the rename fails
This should never happen, but in the event that it does.
2022-01-21 21:31:54 +01:00
f5ef08fd09 Repository.rename: Fail if the destination exists 2022-01-21 21:29:11 +01:00
abbfbba961 Add a high level test for renaming a Note
Now that GitJournal is following a redux style, writing tests for the
domain logic is much easier.
2022-01-21 16:27:48 +01:00
9249dd1246 Add convenience method to reset the Oid 2022-01-21 16:12:24 +01:00
dcfa272a45 Editors: Simplify having to clear the Note's oid 2022-01-20 13:02:34 +01:00
e28c319406 Ensure all editors reset the note's oid 2022-01-20 12:29:13 +01:00
7fce95c187 Make Note class immutable
This greatly simplifies the entire data flow. Though, it comes at the
risk of introducing bugs, but I think it's worth it.

Plus, it makes everything far far more testable.
2022-01-18 21:42:56 +01:00
e6a24f8897 Fix note renaming to change editor type 2022-01-14 17:34:19 +01:00
a6eb613b5a Fix note renaming 2022-01-14 17:09:41 +01:00
7bb7fb94f2 note.title: Let it be null
This is a remanent from the time when non-nulllable didn't exist in
Dart.
2022-01-14 10:26:03 +01:00
4b658e3580 Move markdown handling to its own folder 2021-12-14 14:12:12 +01:00
e5eb8c1576 lint: avoid-ignoring-return-values++ 2021-11-17 18:10:59 +01:00
43eb41fcba NoteEditor: Rename notes properly 2021-11-17 18:10:59 +01:00
015659d58f Allow a note to be renamed to whatever
Earlier one could never change a note type, and therefore its extension.
Now you can rename a note's filename to whatever and accordingly the
editor will change.

A warning message is shown when changing the file type.

Fixes #474
2021-11-15 12:39:12 +01:00
a149371a44 Map EditorTypes with NoteFileFormat
Certain Editors only support certain file formats. We can create an
editor either by -

* Giving it a Note, and letting it choose an editor based on the default
/ note metadata
* New Note with a file type
* New Note with a editor type + possible file type
2021-11-09 15:43:57 +01:00
5535c269e4 NoteEditor: Only give a max width to the editor
Not the AppBar or the Bottom bars.
2021-11-07 17:16:55 +01:00
e67e4d29b4 NoteEditor: Give the container a max width
Typing on such a huge screen is just impossible. I'm putting it as 65ch,
as that is the width tailwindcss uses, and that looks pretty decent.
2021-11-07 17:08:41 +01:00
2ca51c70d7 Rename new notes correctly 2021-11-07 16:32:32 +01:00
4b641f88c8 Move NoteEditor screen to the editors folder 2021-11-04 15:14:52 +01:00