mongol 2.2.0
mongol: ^2.2.0 copied to clipboard

Flutter widget package for displaying and editing vertical Mongolian text.

mongol #

This library is a collection of Flutter widgets for displaying and editing traditional Mongolian vertical text.

The primary ones include:

  • MongolText: vertical version of Text
  • MongolTextField: vertical version of TextField
  • MongolListTile: vertical version of ListTile, for use in horizontal listviews and menus
  • MongolPopupMenuButton: vertical version of PopupMenuButton, for displaying menus
  • MongolAlertDialog: vertical version of AlertDialog

Browse the sections below to see images of what the widgets look like. Check out the live web version of the example project for a more detailed demonstration.

Displaying vertical text #

MongolText is a vertical text version of Flutter's Text widget. Left-to-right line wrapping is supported.

MongolText('ᠨᠢᠭᠡ ᠬᠣᠶᠠᠷ ᠭᠤᠷᠪᠠ ᠳᠦᠷᠪᠡ ᠲᠠᠪᠤ ᠵᠢᠷᠭᠤᠭ᠎ᠠ ᠳᠣᠯᠣᠭ᠎ᠠ ᠨᠠᠢᠮᠠ ᠶᠢᠰᠦ ᠠᠷᠪᠠ'),

The library supports mobile, web, and desktop.

Emoji and CJK characters #

The library rotates emoji and CJK (Chinese, Japanese, and Korean) characters for proper orientation.

Text styling #

You add styling using TextSpan and/or TextStyle, just as you would for a Text widget.
  textScaleFactor: 2.5,

where textSpan is defined like so:

const textSpan = TextSpan(
  style: TextStyle(fontSize: 30, color:,
  children: [
    TextSpan(text: 'ᠨᠢᠭᠡ\n', style: TextStyle(fontSize: 40)),
    TextSpan(text: 'ᠬᠣᠶᠠᠷ', style: TextStyle(backgroundColor: Colors.yellow)),
      text: ' ᠭᠤᠷᠪᠠ ',
      style: TextStyle(shadows: [
          blurRadius: 3.0,
          color: Colors.lightGreen,
          offset: Offset(3.0, -3.0),
    TextSpan(text: 'ᠳᠦᠷ'),
    TextSpan(text: 'ᠪᠡ ᠲᠠᠪᠤ ᠵᠢᠷᠭᠤ', style: TextStyle(color:,
    TextSpan(text: 'ᠭ᠎ᠠ ᠨᠠᠢᠮᠠ '),
    TextSpan(text: 'ᠶᠢᠰᠦ ', style: TextStyle(fontSize: 20)),
        text: 'ᠠᠷᠪᠠ',
            TextStyle(fontFamily: 'MenksoftAmuguleng', color: Colors.purple)),

This all assumes you've added one or more Mongolian fonts to your app assets.

Adding a Mongolian font #

The library does not include a Mongolian font. This allows the library to be smaller and also gives developers the freedom to choose any Mongolian font they like.

Since it's likely that some of your users' devices won't have a Mongolian font installed, you should include at least one Mongolian font with your project. Here is what you need to do:

1. Get a font #

You can find a font from the following companies:

2. Add the font to your project #

You can get directions to do that here and here.

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

    - family: MenksoftQagan
        - asset: assets/fonts/MQG8F02.ttf

You can call the family name whatever you want, but this string is what you will use in the next step.

3. Set the default Mongolian font for your app #

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

  title: 'My App',
  theme: ThemeData(fontFamily: 'MenksoftQagan'),
  home: MyHomePage(),

Now you won't have to manually set the font for every Mongolian 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.

You may also consider using mongol_code with a Menksoft font if your users have devices that don't support OpenType Unicode font rendering. mongol_code converts Unicode to Menksoft code, which a Menksoft font can display without any special rendering requirements.

Editing vertical text #

You can use MongolTextField to receive and edit text from the system keyboard. This widget includes most of the functionality of the standard Flutter TextField widget.

Here is it on iOS and Android interacting with a system keyboard:

There are a few known issues with MongolTextField:

  • The cursor shows up on the right side of hint text.
  • The gesture detection region for the left text selection handle does not appear directly on the handle.
  • On web and desktop the arrow keys don't move in the expected direction.

If you discover any other problems please open an issue. And if you have time to find the source of the known issues, that would be very helpful.

Horizontal lists #

You can display horizontally scrolling lists with the standard Listview widget. All you need to do is set the scroll direction to horizontal.

  scrollDirection: Axis.horizontal,
  children: [

For something a little fancier, you can also use the MongolListTile widget just like you would use ListTile. Here is an example from the example project:

  child: MongolListTile(
    leading: FlutterLogo(size: 56.0),
    title: MongolText('ᠨᠢᠭᠡ ᠬᠣᠶᠠᠷ ᠭᠤᠷᠪᠠ'),
    subtitle: MongolText('ᠳᠦᠷᠪᠡ ᠲᠠᠪᠤ ᠵᠢᠷᠭᠤᠭ᠎ᠠ ᠳᠣᠯᠣᠭ᠎ᠠ ᠨᠠᠢᠮᠠ'),
    trailing: Icon(Icons.more_vert),

To add a popup menu with horizontal items, you can use MongolPopupMenuButton. It is customizeable in all the ways that the standard PopupMenuButton is.

  appBar: AppBar(
    title: const Text('MongolPopupMenuButton'),
    actions: [
        itemBuilder: (context) => const [
          MongolPopupMenuItem(child: MongolText('ᠨᠢᠭᠡ'), value: 1),
          MongolPopupMenuItem(child: MongolText('ᠬᠤᠶᠠᠷ'), value: 2),
          MongolPopupMenuItem(child: MongolText('ᠭᠤᠷᠪᠠ'), value: 3),
        tooltip: 'vertical tooltip text',
        onSelected: (value) => print(value),
  body: Container(),

Buttons #

There are Mongol equivalents to all of the Flutter buttons:

  • MongolTextButton
  • MongolOutlinedButton
  • MongolElevatedButton
  • MongolTextButton.icon
  • MongolOutlinedButton.icon
  • MongolElevatedButton.icon
  • MongolIconButton

The reason for the Mongol icon button is to provide a vertical tooltip that will appear for a longpress on mobile and for a mouse hover on desktop and web.

Other widgets #

MongolAlertDialog #

This alert dialog works mostly the same as the Flutter AlertDialog.

Keyboard #

This are not part of mongol library yet, but you can see an example of how to make a custom in-app keyboard in the example app that's included with this library. Here is a screenshot from the demo app:


  • Improve keyboard (this may be better as a separate package)
  • Various other text based widgets
  • Support WidgetSpan.
  • Add missing tests (currently commented out)
  • For MongolTextAlign.bottom don't count final space in line height
  • Fix known issues with MongolTextField
  • Add MongolSelectableText widget
pub points


Flutter widget package for displaying and editing vertical Mongolian text.

Repository (GitHub)
View/report issues


API reference


BSD-3-Clause (LICENSE)


characters, flutter


Packages that depend on mongol