zcode_embed_ime_db 0.0.3 copy "zcode_embed_ime_db: ^0.0.3" to clipboard
zcode_embed_ime_db: ^0.0.3 copied to clipboard

Zcode 52 standard Mongol embed IME. Soft/Hard layout, word database, words suggestion and next word suggestion.

English is not my mother tongue, please correct the mistake.

Zcode 52 standard Mongolian Embed IME with the word database.

Web Demo click here

NOTE: This package uses the sqlite3 package. If your app using sqlite3 or not any SQLite package, there is no problem using this package. However, using another library of SQLite package instead of sqlite3, such as sqflite, may conflict with sqlite3. Anyway, you try to use this package first. After, if something is not working, there may be conflict. In this situation, please use the zcode_embed_ime instead of this package. zcode_embed_ime does not contain any word databases and SQLite package and just contains inputting logic. In this situation, you will import the Word database yourself and you can reference this package's source code.

Features #

  • Embed into the Flutter app, support all platform.

  • On mobile, use a soft keyboard by default.

  • On mobile, the soft keyboard auto show or hide when one MongolTextField or TextField gets or loses focus.

  • On the Desktop, use a hard keyboard by default.

  • Show basic candidate words using the inputting logic.

  • Show extra candidate words using the database.

  • Show the next candidate words after the user selects a word from the Candidate Box.

  • Support MongolTextField and TextField.

Getting started #

Although the mongol library is optional, I recommend adding it. It contains MongolTextField, MongolText, and other vertical Mongol components. For convenience, in this guide, I did not import the mongol libray. If you want to use the mongol library, import the the mongol library following the official guide and replace TextField used in this guide with MongolTextField.

1. Add needed library

dependencies:
  zcode_embed_ime_db: ^0.0.1

Run Flutter pub get.

2. Add Zcode 52 Mongol Font

If you using the mongol library, skip this step. However, please ensure that you are using a Zcode 52 font in your project.

  • Get a Zcode font

  • Add the font to your project

    Basically you just need to create an fonts folder for it and then declare the font in pubspec.yaml like this:

     flutter:
     fonts:
         - family: ZcodeQagan
         fonts:
             - asset: fonts/z52tsagaantig.ttf
    
  • Set the default Mongol font for your app

    In your main.dart file, set the fontFamily for the app theme.

    MaterialApp(
       theme: ThemeData(fontFamily: 'ZcodeQagan'),
       // ...
    );
    

    Now you won't have to manually set the font for every text widget. If you want to use a different font for some widgets, though, you can still set the fontFamily as you normally would inside TextStyle.

3. Initialize word database

On your app's main.dart, add initZcodeDB.

void main() {
  runApp(const DemoApp());
  initZcodeDB();
}

If your app support Web, I recommend you to set optional params dbUrl and sqlite3Url.

void main() {
  runApp(const DemoApp());
  initZcodeDB(
    dbUrl: "https://zcode_ime.db/remote/path",
    sqlite3Url: "https://sqlite3.wasm/remote/path",
  );
}

Upload zcode_ime.db and sqlite3.wasm to your object server supporting CDN. These files are too large to maybe freeze your Web app server if you do not set dbUrl and sqlite3Url. If you not setting these parameters, this package will fetch these files from your Web app server.

dbUrl is the URL of the zcode_ime.db file you uploaded. sqlite3Url is the URL of the sqlite3.wasm file you uploaded.

4. Use zcode_embed_ime_db

  • Import library

    import 'package:zcode_embed_ime_db/zcode_embed_ime_db.dart';
    
  • Add EmbedKeyboard

    @override
    Widget build() {
      return Scaffold(
        body: Column(children: [
         const Expanded(child: TextField()),
         EmbedKeyboard(
           layoutBuilders: [
             (i) => ZcodeLayout(i, converter: DBZcodeLayoutConverter()),
             EnglishLayout.create,
           ],
         ),
        ]),
      );
    }
    

    After completing this step, the library is imported at the lowest cost. You run your project and see what's going on.

Statement #

The Zcode inputting logic is copied from Zmongol's zmongol2021 library. The copyright belongs to Zmongol.

The word database is provided by ZUGA. The copyright belongs to ZUGA

If someone finds cannot input some words or has any other problem with this library, please feel free to open an issue or PR.

0
likes
150
pub points
0%
popularity

Publisher

verified publishersatsrag.dev

Zcode 52 standard Mongol embed IME. Soft/Hard layout, word database, words suggestion and next word suggestion.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, path, path_provider, sqlite3, sqlite3_flutter_libs, zcode_embed_ime

More

Packages that depend on zcode_embed_ime_db