Skip to content

8. Development

lrorpilla edited this page May 5, 2023 · 17 revisions

This page is under construction. Certain sections are yet to be finalized and supplementary images are not yet included.


This section is dedicated to developers that wish to learn how to work with the jidoujisho project.

Setting Up Flutter

This explains how someone can get set up with using Flutter if they don't already have a developer environment.

Folder Structure

This describes the general location of files if you need to go looking for something in particular.

Once you have checked out the project repository, you may navigate to the yuuna folder where the current project is stored.

The folder structure of the project is as follows:

  • android/: Android-specific files and native code.
  • assets/: Fonts, language dependencies, license information, artwork and icons, ッツ Ebook Reader files.
  • ios/: iOS files. Generally untouched since project creation.
  • lib/: Where the project source code lives.
  • web/: Web files. Generally untouched since project creation.
  • windows/: Windows files. Generally untouched since project creation.
  • analysis_options.yaml: Linter rules.
  • pubspec.yaml: List of dependencies that the project uses.

The following is important in the android directory:

  • android/app/src/main/java/app/lrorpilla/yuuna/MainActivity.java: AnkiDroid function calls via method channel and native entry point.
  • android/app/src/main/AndroidManifest.xml: General app information, permissions and intents that the app handles.
  • android/fastlane/ - Continuous integration and delivery scripts for building and deploying.

The following is the project's source code structure within lib. Mostly directories are mentioned, and generally most important files:

  • i18n/: Localization strings for slang. See the Localization section below for more details.
  • src/
    • creator/: Contains entities specific to card creation and export.
      • actions/: Quick Action implementations.
      • enhancements/: User Enhancement implementations.
      • fields/: Creator Field implementations.
    • dictionary/: Contains entities specific to dictionary schema and import.
      • formats/: Dictionary Format implementations.
    • language/: Contains entities specific to target languages.
      • implementations/: Language implementations.
    • media/: Contains entities specific to media item and source handling.
      • source_types/: Player and reader source-specific functions.
      • sources/: Media sources. (i.e Local Media, YouTube, ッツ, etc.)
      • types/: Navigation tabs. (Player, Reader, Dictionary)
    • models/: Contains app global state and Card Creator logic.
      • app_model.dart: Global state and god object. Handles shared logic.
      • creator_model.dart: Card Creator state management and logic.
    • pages/: Widgets used across the app. Most state management and navigation is here.
      • implementations/: Implementations of the base pages are here. Specific page use cases.
      • base_history_page.dart: Shared code for player and reader media history.
      • base_media_search_bar.dart: Shared code for bar below the top bar in the main menu.
      • base_page.dart: Shared code for all pages in the app.
      • base_source_page.dart: Shared code for all pages that can show a dictionary overlay.
      • base_tab_page.dart: Shared code for all pages that can show a dictionary overlay.
    • utils/: Shared components and entities used in the app.
    • main.dart - Dart entry point of the app.

Project Architecture

This describes which parts are responsible for which behaviors in the app, and how global state interacts with page state.

Main Initialization

This describes what main.dart does, how it initializes the AppModel for use and how the app goes from splash to main menu.

Important Dependencies Used

This lists the dependencies used in pubspec.yaml and why they are included.

Creator Fields

This describes what fields do and how they are pre-filled upon Instant Export or use of the Card Creator.

Quick Actions

This describes how you can make a quick action that can be executed for a specific dictionary search result.

User Enhancements

This describes how you can make a function or automation that affects the content of a specific field when using the Card Creator.

Dictionary Formats

This describes how dictionaries are imported, how the schema works and how dictionary data is imported to the database for use in search, and how you can implement your desired dictionary format.

Languages

This describes how the app allows for certain behavior for a target language, and how to implement a search algorithm for a specific language.

Media Source

This describes how to create your own media source which can be given its own bar, media history and pages you can make dictionary look-ups in.

Localization

This describes how to work with slang and how to implement a new locale for the app.