Skip to content

Commit

Permalink
version 3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
suragch committed Jan 5, 2023
1 parent 0bb7035 commit c7fb426
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [3.4.0] - 2023.01.05

- Remove `DefaultMongolTextEditingShortcuts` from `MongolEditableTextState` (#35) (@Satsrag)
- To switch the behavior of left/right and up/down keys in `MongolEditableText`, developers now need to add `MongolTextEditingShortcuts` at the top of the widget tree. See [#33](https://github.com/suragch/mongol/issues/33) for discussion.

## [3.3.1] - 2022.12.31

- Fix: crash when MongolTextField contain a line end with ' \n' (#34) (@Satsrag)
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ Since it's likely that some of your users' devices won't have a Mongolian font i

### 1. Get a font

You can find a font from the following companies:
You can find a font from the following sources:

- [Menksoft](http://www.menksoft.com/site/alias__menkcms/2805/Default.aspx)
- [Delehi](http://www.delehi.com/cn/2693.html)
- [One BolorSoft font](https://www.mngl.net/downloads/fonts/MongolianScript.ttf)
- [Menksoft](https://www.mklai.cn/download-font?productId=a0ec7735b5714334934ff3c094ca0a5e)
- [MongolFont](http://www.mongolfont.com/en/font/index.html)
- [BolorSoft](https://www.mngl.net/#download)
- [Z Mongol Code](https://install.zcodetech.com/)
- [CMs font](https://phabricator.wikimedia.org/T130502)

### 2. Add the font to your project

Expand All @@ -109,9 +111,8 @@ In your `main.dart` file, set the `fontFamily` for the app theme.

```dart
MaterialApp(
title: 'My App',
theme: ThemeData(fontFamily: 'MenksoftQagan'),
home: MyHomePage(),
// ...
);
```

Expand Down Expand Up @@ -142,6 +143,15 @@ MongolTextField(
),
```

In order to correctly handle right/left and up/down keys on the web and desktop (or for physical keyboards connected to a mobile app), you need to return the `MongolTextEditingShortcuts` widget from the `builder` method of your `MaterialApp` (or `CupertinoApp` or `WidgetsApp`) at the top of your widget tree:

```dart
MaterialApp(
builder: (context, child) => MongolTextEditingShortcuts(child: child),
// ...
)
```

## 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.
Expand Down Expand Up @@ -227,6 +237,6 @@ This alert dialog works mostly the same as the Flutter `AlertDialog`.
- Improve keyboard (this may be better as a separate package)
- Various other text based widgets
- Support `WidgetSpan`.
- Add missing tests (currently commented out)
- Add more tests
- For `MongolTextAlign.bottom` don't count final space in line height
- Add `MongolSelectableText` widget
6 changes: 2 additions & 4 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ class DemoApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
builder: (context, child) {
return MongolTextEditingShortcuts(child: child);
},
builder: (context, child) => MongolTextEditingShortcuts(child: child),
title: 'mongol',
theme: ThemeData(
fontFamily: 'MenksoftQagan',
),
home: Scaffold(
appBar: AppBar(title: const Text('Flutter mongol package 3.3.1')),
appBar: AppBar(title: const Text('Flutter mongol package 3.4.0')),
body: const HomeScreen(),
),
);
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.3.1"
version: "3.4.0"
path:
dependency: transitive
description:
Expand Down
13 changes: 11 additions & 2 deletions lib/src/editing/mongol_text_editing_shortcuts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@ import 'package:flutter/widgets.dart';
import 'mongol_text_editing_intents.dart';

/// Switch up/down arrow keys and left/right arrow keys
///
/// Insert this widget just below the MaterialApp (or WidgetsApp or
/// CupertinoApp) in order to cause the arrow keys to behave as expected
/// in a `MongolTextField`.
///
/// ```
/// MaterialApp(
/// builder: (context, child) => MongolTextEditingShortcuts(child: child),
/// ```
class MongolTextEditingShortcuts extends StatelessWidget {
const MongolTextEditingShortcuts({Key? key, required this.child})
: super(key: key);

final Widget? child;

// These are shortcuts are shared between most platforms except macOS for it
// uses different modifier keys as the line/word modifier.
// These shortcuts are shared between most platforms except macOS, which
// uses different modifier keys for the line/word modifier.
static final Map<ShortcutActivator, Intent> _commonShortcuts =
<ShortcutActivator, Intent>{
// Arrow: Move Selection.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: mongol
description: Flutter widget package for displaying and editing vertical Mongolian text.
# When updating version, also update CHANGELOG.md and example/lib/main.dart
version: 3.3.1
version: 3.4.0
homepage: https://github.com/suragch/mongol

environment:
Expand Down

0 comments on commit c7fb426

Please sign in to comment.