buildText method

Widget buildText()

Implementation

Widget buildText() {
  final TextStyle styleBase = TextStyle(
    fontSize: ScreenUtil().setSp(
        ScreenUtil().screenWidth > ModernFormUtils.webBreakdown ? 16 : 18),
    color: dataModel.textColor,
    fontWeight: dataModel.fontWeight,
  );

  return ConstrainedBox(
    constraints: BoxConstraints(maxWidth: ScreenUtil().screenWidth * .8),
    child: Wrap(
      alignment: WrapAlignment.start,
      children: [
        dataModel.multStyles.isNotNullAndNotEmpty
            ? Text.rich(
                TextSpan(
                  text: dataModel.text,
                  style: styleBase,
                  children: dataModel.multStyles!
                      .map(
                        (e) => TextSpan(
                          text: e.text,
                          style: styleBase.copyWith(
                            color: e.textColor,
                            fontWeight: e.fontWeight,
                          ),
                        ),
                      )
                      .toList(),
                ),
              )
            : Text(
                dataModel.text,
                style: styleBase,
              ),
      ],
    ),
  );
}