Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playground theme import / export. #257

Merged
merged 5 commits into from
Oct 19, 2024

Conversation

akiller
Copy link
Contributor

@akiller akiller commented Oct 19, 2024

Adds a simple way to export playground themes to JSON and then reimport back into the playground so an existing theme can be modified again.

From some discussions in #236.

@rydmike rydmike merged commit 2ff338b into rydmike:version-8-0-0 Oct 19, 2024
@akiller akiller deleted the playground-theme-export-v8 branch October 19, 2024 21:21
@rydmike
Copy link
Owner

rydmike commented Oct 19, 2024

Thanks a lot @akiller!

Awesome contribution, much appreciated and I'm sure Playground users will love it too.
I'm going to add attributions of this to release notes and docs too! 😄

I removed the version info pkg, mostly because it cannot handle versions with "-" in it like the one in the dev releases on iOS etc. There is a very simple manually maintained App.version constant in the app that I use instead and keep updated. No way you could have known and I forgot to mention it.

Fix some linter nits, I use super strict linting settings.

With this feature I can add some really cool "integration" like tests to the Playground app, curious to try it out later as well.

@akiller
Copy link
Contributor Author

akiller commented Oct 20, 2024

Thanks a lot @akiller!

Awesome contribution, much appreciated and I'm sure Playground users will love it too. I'm going to add attributions of this to release notes and docs too! 😄

Sounds great, and no problem.

I removed the version info pkg, mostly because it cannot handle versions with "-" in it like the one in the dev releases on iOS etc. There is a very simple manually maintained App.version constant in the app that I use instead and keep updated. No way you could have known and I forgot to mention it.

Oh oops!

Fix some linter nits, I use super strict linting settings.

With this feature I can add some really cool "integration" like tests to the Playground app, curious to try it out later as well.

Heh I did try and clear up most of the vscode linter errors. Personally I'm a renegade who likes using var 😊.

@rydmike
Copy link
Owner

rydmike commented Oct 22, 2024

Naah, all good @akiller! 😄
I know everyone is not an "must add all types kind" of person 😃
Flutter repo uses it too and I kind of just got used to it.


So for info.

I did some other minor tuning to the feature. I think it is a bit safer not having a TextField for copy paste, since you can edit and change it by mistake. So I made a staging area where you can only see see what is going in/out and added some own buttons to copy/paste it.

Plus it now skips exporting values that are null in the storage.

A long time ago there where cases where a lack of key of course meant use default value, but sometimes when values were nullable, null was not the default value for the key, so I needed to store null value as another setting than the default, that was maybe not null. That is still there and the playground stores "null" settings values too, instead of assuming it is the default.

Null has meaning in theming in Flutter and often produces different results in M2 and M3 mode, as they have different null default results in the framework.

But nowadays props in Playground are all null by default too, so we can skip all those too in the export, makes it cleaner.

Also since it is in theory possible to edit and maybe get crap into the storage there is an option to nuke it too. If you nuke it, and export, you get a file with nothing, but that still loads the correct default Playground settings corresponding to it.

I also cleaned up and changed a lot of the storage keys to make them more descriptive (and always sync names with controller props too). This is breaking release and it is also the first time this features exists so, I can change the storage key now to whatever, there is not going to be any option to keep and use settings from a V7 local storage anyway.

Then I got paranoid and added valid key checking to imports too (plus some size limits). To do this, I made a python script that extracts all the keys from the store.dart file and I put them in a list and just check import keys against it, and skip things that are not valid. A bit of schema checking. Before you could add whatever keys to the imported JSON and get them imported into the storage and thrown out again when you exported it, not so nice. So that should not be as easily possible anymore.

Still since there is no back-end, all you could muck up is your own local storage, so maybe not so critical, but it is there now anyway.

Going to release a 8.0.0-dev.2 version and build soonish, so people can test it out.

Screen.Recording.2024-10-22.at.21.56.00.mov

@akiller
Copy link
Contributor Author

akiller commented Oct 25, 2024

Oh that's looking really good, you've definitely put the finishing touches it needed into it. It will be nice to properly give it a try when you have released it for testing.

Oh that's interesting with the nulls, I just assumed if they were in the database they were there for a reason so good job you spotted it.

@rydmike
Copy link
Owner

rydmike commented Oct 29, 2024

In case you missed it on X/Twitter, there is 8.0.0-dev.2 release and dev build of the Playground with it included out, made some quick videos too...
https://x.com/RydMike/status/1850651938297159833

@rydmike
Copy link
Owner

rydmike commented Nov 3, 2024

Version 8.0.0 package https://pub.dev/packages/flex_color_scheme
and Playground https://rydmike.com/flexcolorscheme/themesplayground-latest/ has been released!

And there you are too, among contributors! 😄
Screenshot 2024-11-04 at 0 44 59

@akiller
Copy link
Contributor Author

akiller commented Nov 3, 2024

Version 8.0.0 package https://pub.dev/packages/flex_color_scheme and Playground https://rydmike.com/flexcolorscheme/themesplayground-latest/ has been released!

And there you are too, among contributors! 😄

Ooh, that's my favourite part!

Thanks for merging!

@rydmike
Copy link
Owner

rydmike commented Nov 3, 2024

I still got as lot of docs to write for https://docs.flexcolorscheme.com/ and video to record as promised, this earlier one, was as mentioned just a teaser https://x.com/RydMike/status/1850651938297159833

@JJRCSoft
Copy link

JJRCSoft commented Nov 3, 2024

Hi! Great video—thanks for the update! I was really impressed with the screen recording tool you used in the demo (the one you published on X); it looks fantastic! Could you let me know which tool it is? I’d really appreciate it.

@rydmike
Copy link
Owner

rydmike commented Nov 4, 2024

Thanks 🙏🙂

I used Screen Studio, all the videos were just short single shot quick recordings with no cuts or edits, I only trimmed start and end.

It does the zooming and panning and bigger smooth mouse movement, and head inset that shrinks when it zooms, pretty cool. You can do basic edits with it too and manual zooms.

I plan to use it for a series of short tutorials that I have been getting requests for.

Since these were published on X/Twitter from my free account, it severely reduces video quality, so while I will post the tutorials there too, I will probably post them on YouTube too in 16:9 format, for better quality. I will keep them short by limiting the topic/scope of each one, with some kind of logical progression.

Link to the SW https://screen.studio/

It is macOS only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants