WowText constructor

WowText(
  1. String? data, {
  2. String? messageDefault,
  3. Key? key,
  4. int? maxLines = 1,
  5. TextStyle? style,
  6. TextAlign? textAlign = TextAlign.start,
  7. TextDirection? textDirection = TextDirection.ltr,
  8. bool? softWrap = true,
})

Widget Hiển thị văn bản

mặc định tối đa 1 dòng, trái sang phải, dư hiển thị ...

data có thể là văn bản hoặc id văn bản trên server

Kiểu mã văn bản: chữ cái in hoa, số, dấu gạch dưới

'HELLO_WORLD' // => đúng
'LANGUAGE_1' // => đúng
'LANGUAGE_1_VN' // => đúng
'HELLO_' // => sai
'_HELLO' // => sai
'1_HELLO' // => sai
'HELLOWORLD' // => sai
'Home_Title' // => sai

Ví dụ

WowText('Hello World'); // => 'Hello world'
WowText('HELLO_WORLD'); // => 'Hello world' với văn bản lưu trên server

Implementation

factory WowText(
  String? data, {
  String? messageDefault,
  Key? key,
  int? maxLines = 1,
  TextStyle? style,
  TextAlign? textAlign = TextAlign.start,
  TextDirection? textDirection = TextDirection.ltr,
  bool? softWrap = true,
}) {
  String text = data ?? '';
  if (data != null && checkMessageId.hasMatch(data)) {
    text = Message.getMessage(data, messageDefault: messageDefault);
  }
  return WowText._(
    text,
    key: key,
    maxLines: maxLines,
    style: style,
    textAlign: textAlign,
    textDirection: textDirection,
    softWrap: softWrap,
  );
}