[PR #2670] [MERGED] [feat] Dynamically Load Themes in AppFlowy #5357

Closed
opened 2026-03-23 22:18:23 +00:00 by mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/2670
Author: @a-wallen
Created: 5/31/2023
Status: Merged
Merged: 7/3/2023
Merged by: @appflowy

Base: mainHead: dynamic_theme_plugin


📝 Commits (10+)

  • 8a1e713 feat: dynamic theme plugin (init)
  • a9baa2e feat: provide fallback color if plugin becomes out of date (transparent)
  • 254749d feat: use applicationDocumentsDirectory to store plugins
  • 5ed6b75 chore: remove json files
  • 33bc14d fix: add toJson to resolve analyzer errors
  • 17041ac fix: analyzer (unused imports)
  • 1b7c83a feat: add code generation scripts for freezed files (call recursively in packages)
  • b57a725 fix: revert changes to dry generation
  • b638279 feat: call directly into script
  • f1d0829 refactor: scripts try to be stateless :)

📊 Changes

51 files changed (+1413 additions, -130 deletions)

View changed files

📝 frontend/.vscode/tasks.json (+21 -5)
📝 frontend/appflowy_flutter/assets/translations/en.json (+13 -1)
📝 frontend/appflowy_flutter/integration_test/util/mock/mock_file_picker.dart (+6 -8)
📝 frontend/appflowy_flutter/lib/plugins/document/document_page.dart (+1 -1)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart (+1 -1)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker_bloc.dart (+2 -3)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_selection_menu.dart (+1 -1)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart (+1 -1)
📝 frontend/appflowy_flutter/lib/startup/deps_resolver.dart (+2 -2)
📝 frontend/appflowy_flutter/lib/user/presentation/folder/folder_widget.dart (+1 -1)
📝 frontend/appflowy_flutter/lib/workspace/application/appearance.dart (+3 -3)
📝 frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/import/import_panel.dart (+1 -2)
📝 frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance_view.dart (+160 -46)
📝 frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart (+1 -1)
📝 frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_exporter_widget.dart (+2 -2)
frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_confirm_delete_dialog.dart (+59 -0)
frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_button.dart (+41 -0)
frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart (+40 -0)
frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart (+41 -0)
frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart (+34 -0)

...and 31 more files

📄 Description

Feature Preview

https://github.com/AppFlowy-IO/AppFlowy/assets/44445638/2ce856ab-b5a8-4e67-8830-0c6c633446dd

Loads themes from a JSON file at runtime.

TODO

  • Run build_runner in flowy_infra to pass CI
  • Fix InvalidType build_runner errors.
  • Provide default values or throw an error if FlowyColorScheme API changes and the old theme is incompatible with the new API.
  • Load the themes from a different directory (for example, path_provider getApplicationDocumentsDirectory()).
  • Allow users to drag and drop themes via the GUI (in the appearance settings menu).

https://github.com/AppFlowy-IO/AppFlowy/assets/44445638/f6d32036-73b3-4cdc-96ec-cef34b587331

  • Delete uploaded themes.

https://github.com/AppFlowy-IO/AppFlowy/assets/44445638/e4b050eb-b07a-421a-88d8-fea7978877e2

  • Better prompt messages
  • Better error messages
  • Fix all merge conflicts from the recent merge of develop into main
  • Refactor (code style)
  • Widget/integration test for previous use cases.
  • Users should be able to browse available JSON themes on a website.

Issues https://github.com/AppFlowy-IO/AppFlowy/issues/1070. It does not fix but makes it easier to experiment with new themes.


PR Checklist

  • My code adheres to the AppFlowy Style Guide
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AppFlowy-IO/AppFlowy/pull/2670 **Author:** [@a-wallen](https://github.com/a-wallen) **Created:** 5/31/2023 **Status:** ✅ Merged **Merged:** 7/3/2023 **Merged by:** [@appflowy](https://github.com/appflowy) **Base:** `main` ← **Head:** `dynamic_theme_plugin` --- ### 📝 Commits (10+) - [`8a1e713`](https://github.com/AppFlowy-IO/AppFlowy/commit/8a1e713c0fc6b00f64b1c2598f4bd07c982ed7be) feat: dynamic theme plugin (init) - [`a9baa2e`](https://github.com/AppFlowy-IO/AppFlowy/commit/a9baa2e3b27465a758dba54c6434997c48f600aa) feat: provide fallback color if plugin becomes out of date (transparent) - [`254749d`](https://github.com/AppFlowy-IO/AppFlowy/commit/254749d159398f5a4fdf31b061a8dbdf391d7b54) feat: use applicationDocumentsDirectory to store plugins - [`5ed6b75`](https://github.com/AppFlowy-IO/AppFlowy/commit/5ed6b75632f8da188dc6770b7be0e041601d8b6a) chore: remove json files - [`33bc14d`](https://github.com/AppFlowy-IO/AppFlowy/commit/33bc14dcf598e999b54c6020e0de93330cde7d99) fix: add toJson to resolve analyzer errors - [`17041ac`](https://github.com/AppFlowy-IO/AppFlowy/commit/17041ac8ef67cbc27caf46c72e4d53fa74a603e5) fix: analyzer (unused imports) - [`1b7c83a`](https://github.com/AppFlowy-IO/AppFlowy/commit/1b7c83ae11fc27e9f2231df27c9bd9b9ade7a774) feat: add code generation scripts for freezed files (call recursively in packages) - [`b57a725`](https://github.com/AppFlowy-IO/AppFlowy/commit/b57a725accda839e045f7ea41dc88022bae9bb58) fix: revert changes to dry generation - [`b638279`](https://github.com/AppFlowy-IO/AppFlowy/commit/b638279d3b141759efdc15acefb007e2008628b2) feat: call directly into script - [`f1d0829`](https://github.com/AppFlowy-IO/AppFlowy/commit/f1d082968f7ab3b7ccfdf10a0c728fec110ff63c) refactor: scripts try to be stateless :) ### 📊 Changes **51 files changed** (+1413 additions, -130 deletions) <details> <summary>View changed files</summary> 📝 `frontend/.vscode/tasks.json` (+21 -5) 📝 `frontend/appflowy_flutter/assets/translations/en.json` (+13 -1) 📝 `frontend/appflowy_flutter/integration_test/util/mock/mock_file_picker.dart` (+6 -8) 📝 `frontend/appflowy_flutter/lib/plugins/document/document_page.dart` (+1 -1) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart` (+1 -1) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker_bloc.dart` (+2 -3) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_selection_menu.dart` (+1 -1) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart` (+1 -1) 📝 `frontend/appflowy_flutter/lib/startup/deps_resolver.dart` (+2 -2) 📝 `frontend/appflowy_flutter/lib/user/presentation/folder/folder_widget.dart` (+1 -1) 📝 `frontend/appflowy_flutter/lib/workspace/application/appearance.dart` (+3 -3) 📝 `frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/import/import_panel.dart` (+1 -2) 📝 `frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance_view.dart` (+160 -46) 📝 `frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart` (+1 -1) 📝 `frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_exporter_widget.dart` (+2 -2) ➕ `frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_confirm_delete_dialog.dart` (+59 -0) ➕ `frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_button.dart` (+41 -0) ➕ `frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart` (+40 -0) ➕ `frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart` (+41 -0) ➕ `frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart` (+34 -0) _...and 31 more files_ </details> ### 📄 Description <!--- Thank you for submitting a pull request to AppFlowy. The team will dedicate their best efforts to reviewing and approving your pull request. If you have any questions about the project or feedback for us, please join our [Discord](https://discord.gg/wdjWUXXhtw). --> <!--- If your pull request adds a new feature, please drag and drop a video into this section to showcase what you've done! If not, you may delete this section. --> ### Feature Preview https://github.com/AppFlowy-IO/AppFlowy/assets/44445638/2ce856ab-b5a8-4e67-8830-0c6c633446dd Loads themes from a JSON file at runtime. TODO - [x] Run build_runner in flowy_infra to pass CI - [x] Fix `InvalidType` build_runner errors. - [X] Provide default values or throw an error if `FlowyColorScheme` API changes and the old theme is incompatible with the new API. - [x] Load the themes from a different directory (for example, `path_provider` `getApplicationDocumentsDirectory()`). - [x] Allow users to drag and drop themes via the GUI (in the appearance settings menu). https://github.com/AppFlowy-IO/AppFlowy/assets/44445638/f6d32036-73b3-4cdc-96ec-cef34b587331 - [x] Delete uploaded themes. https://github.com/AppFlowy-IO/AppFlowy/assets/44445638/e4b050eb-b07a-421a-88d8-fea7978877e2 - [ ] ~Better prompt messages~ - [ ] ~Better error messages~ - [x] Fix all merge conflicts from the recent merge of `develop` into `main` - [x] Refactor (code style) - [ ] Widget/integration test for previous use cases. - [ ] Users should be able to browse available JSON themes on a website. <!--- List at least one issue here that this PR addresses. If it fixes the issue, please use the [fixes](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests) keyword to close the issue. For example: fixes https://github.com/AppFlowy-IO/AppFlowy/pull/2106 --> Issues https://github.com/AppFlowy-IO/AppFlowy/issues/1070. It does not fix but makes it easier to experiment with new themes. --- <!--- Before you mark this PR ready for review, run through this checklist! --> #### PR Checklist - [x] My code adheres to the [AppFlowy Style Guide](https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/software-contributions/submitting-code/style-guides) - [x] I've listed at least one issue that this PR fixes in the description above. - [ ] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes. - [ ] All existing tests are passing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 22:18:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#5357
No description provided.