word_break_text 0.1.0 copy "word_break_text: ^0.1.0" to clipboard
word_break_text: ^0.1.0 copied to clipboard

A Flutter Text widget support word break for CJK. Based on Wrap with Text widget

word_break_text #

Text widget with word break support for CJK sentence.

Screenshot

Installation #

Add flutter_map to your pubspec:

dependencies:
    word_break_text: any # or the latest version on pub.dev

Usage #

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(
        mainAxisSize: MainAxisSize.max,
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          WordBreakText(
            "헬로월드. 이것은 긴 문장입니다. 작은 화면에서 단어를 기준으로 줄바꿈이 되어야 합니다.",
            spacingByWrap: true,
            spacing: 4,
          ),
          WordBreakText("ハローワールド。 これは長い文章です。 小さな画面で単語に基づいて改行する必要があります。"),
          WordBreakText(
            "你好,世界。 这是一个很长的句子。 在小屏幕上, 它应该按字换行。",
            wrapAlignment: WrapAlignment.start,
          ),
        ],
      ),
    );
  }

Additional information #

This widget is verbose and useless when you are using english sentence. Flutter do not support word break with CJK at this moment. If flutter supports, this widget must be change to only Text widget.

Thanks specially #

I found the comment from flutter repository here. I appreciate to @06153. It is insanely genious solution. but I hope so flutter team support natively word break in CJK sentence. Please.

16
likes
150
pub points
86%
popularity

Publisher

unverified uploader

A Flutter Text widget support word break for CJK. Based on Wrap with Text widget

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on word_break_text