/*
 * @Author: XianKaiQun
 * @Date: 2020-04-21 16:43:49
 * @LastEditors  : WuWei
 * @LastEditTime : 2023-10-25 11:07:58
 * @Descripttion:
 */
import 'package:flutter/widgets.dart';
import 'package:wisdom_cli/src/extensions/adapt.dart';

////简单的文本
class WisText extends StatelessWidget {
  const WisText(
    this.data, {
    this.size,
    Key? key,
    this.maxLines,
    this.color,
    this.height,
    this.textAlign,
    this.overflow,
    this.textDirection,
    this.bold = false,
    this.weight,
    this.strutStyle,
    this.decoration,
  }) : super(key: key);

  final String data;
  final double? size;
  final int? maxLines;
  final Color? color;
  final double? height;
  final TextAlign? textAlign;
  final TextOverflow? overflow;
  final TextDirection? textDirection;
  final bool? bold;
  final FontWeight? weight;
  final StrutStyle? strutStyle;
  final TextDecoration? decoration;

  WisText.c000(
    this.data, {
    this.size,
    this.maxLines,
    this.color = const Color(0xff000000),
    this.height,
    this.textAlign,
    this.overflow,
    this.textDirection,
    this.bold = false,
    this.weight,
    this.strutStyle,
    this.decoration,
  });

  WisText.c222(
    this.data, {
    this.size,
    this.maxLines,
    this.color = const Color(0xff222222),
    this.height,
    this.textAlign,
    this.overflow,
    this.textDirection,
    this.bold = false,
    this.weight,
    this.strutStyle,
    this.decoration,
  });

  WisText.c333(
    this.data, {
    this.size,
    this.maxLines,
    this.color = const Color(0xff333333),
    this.height,
    this.textAlign,
    this.overflow,
    this.textDirection,
    this.bold = false,
    this.weight,
    this.strutStyle,
    this.decoration,
  });
  WisText.c666(
    this.data, {
    this.size,
    this.maxLines,
    this.color = const Color(0xff666666),
    this.height,
    this.textAlign,
    this.textDirection,
    this.overflow,
    this.bold = false,
    this.weight,
    this.strutStyle,
    this.decoration,
  });
  WisText.c999(
    this.data, {
    this.size,
    this.maxLines,
    this.color = const Color(0xff999999),
    this.height,
    this.textAlign,
    this.overflow,
    this.textDirection,
    this.bold = false,
    this.weight,
    this.strutStyle,
    this.decoration,
  });
  WisText.white(
    this.data, {
    this.size,
    this.maxLines,
    this.color = const Color(0xffffffff),
    this.height,
    this.textAlign,
    this.overflow,
    this.textDirection,
    this.bold = false,
    this.weight,
    this.strutStyle,
    this.decoration,
  });

  ///[bold]=[true]
  ///
  ///[size]=[18.pt]
  ///
  ///[color]=[Color(0xff000000)]
  ///
  ///卡片标题等
  WisText.title(
    this.data, {
    this.maxLines,
    this.height,
    this.textAlign,
    this.overflow,
    this.textDirection,
    this.weight,
    this.strutStyle,
    this.decoration,
  })  : this.size = 18.pt,
        this.color = const Color(0xff000000),
        this.bold = true;
  @override
  Widget build(BuildContext context) {
    return Text(
      Characters(data).join('\u{200B}'),
      maxLines: maxLines,
      textAlign: textAlign,
      textDirection: textDirection,
      overflow: overflow,
      strutStyle: strutStyle,
      style: TextStyle(
        height: height,
        color: color,
        fontSize: size ?? 14.pt,
        fontWeight: bold! ? FontWeight.w600 : this.weight ?? null,
        decoration: decoration ?? TextDecoration.none,
        /// 下划线默认跟文字颜色一致
        decorationColor: color,
      ),
    );
  }
}
