Skip to content
This repository was archived by the owner on Apr 22, 2022. It is now read-only.

Development

CaptainDario edited this page Nov 1, 2021 · 11 revisions

Setting up a development environment

This app was developed using dart, the flutter framework and Tensorflow (lite).
The Machine Learning project can be found here.
Flutter needs to be installed. For this please follow the guide on the official website.

Now the repository of DaKanji needs to be cloned:

git clone https://github.com/CaptainDario/DaKanji-Mobile

Than all necessary packages need to be installed:

flutter pub get

Platform dependent features

This is a (hopefully) complete table of features which need platform dependent implementations and if they are currently implemented.

Android iOS Linux MacOS Web Windows
rate app in store X X ️ O O O O
deep linking X X O O O O
app dictionaries X X O O O O
OS browser for dict X X O O O X
WebView X X W W W W
Single Kanji CNN X X ️ O O W X
use system theme X X ️ O O O W

Legend: X - done | W - waiting for plugin / flutter | O - not started

Internationalization and localization

PR's for new languages or updates to existing ones are always welcome.

To manage localizations you can use i18n manager. First add a .json-file with your language code (ex.: russian -> ru.json). Than open the localization folder (assets\translations) with i18n manager and fill all the necessary fields. Finally open a PR and your language will be included in the next release of DaKanji.

Important things to know:

While adding a translation a few things regarding syntax are important to know.

syntax meaning
@:link Link to a different i18n translation element
Ex.: @:dark will be replaced by the translation of the dark element.
[text which users sees](url) A link where the part in [] is the text the users sees.
And () is the url which the user will be redirected when clicking on it.
WORDS_IN_CAPS_WITH_UNDERSCORE Those are variables which will be replaced by a value at runtime.
They should not be changed while translating.

Generating the code files from the json-files

The following command (python in PATH needed) generates the localization files for the flutter project from the i18n files.

python localization.py

Important: do not forget to add the new locales in:

  • ios/Runner/Info.plist
  • lib/main.dart Setting up the TensorFlow lite interpreter depends on the platform you want to develop for. Therefore refer to the tflite_flutter package for the installation.

Additionally the tflite models (and their labels) need to be copied from the Machine Learning repository. Go to the release page, download the files and move them to the dakanji\assets\

Screens, Popups and Overlays

A complete overview of all screens, popups and oerlays can be found here.

Updating icons

For updating the icons the flutter_launcher_icons package was used. To update all icons, replace media/icon.png and run:

flutter pub run flutter_launcher_icons:main

Editing Splashscreen

For generating a splashscreen the flutter_native_splash package was used. The details of the splashscreen are stored in flutter_native_splash.yaml.

To generate platform dependent splashscreens just invoke (in the root folder):

flutter pub run flutter_native_splash:create

Building an executable

Android

To build the app as app bundle just invoke

flutter build appbundle

To obfuscate, save the symbol files and build the app.

flutter build appbundle --obfuscate --split-debug-info=obfuscate_debug_info

To build an fat apk:

flutter build apk --obfuscate --split-debug-info=obfuscate_debug_info

and platform dependent, smaller apk's:

flutter build apk --split-per-abi --obfuscate --split-debug-info=obfuscate_debug_info