word_break_text
text widget with word break support for cjk sentence.
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.
Comments are closed.