prefixWidget method

TextSpan prefixWidget()

Implementation

TextSpan prefixWidget() {
  const messageHostColor = Color(0xff9f76ff);

  return TextSpan(children: [
    WidgetSpan(
      child: Transform.translate(
        offset: Offset(0, 0.zR),
        child: ConstrainedBox(
          constraints: BoxConstraints(
            maxWidth: 34.zR + prefix!.length * 12.zR,
            minWidth: 34.zR,
            minHeight: 36.zR,
            maxHeight: 36.zR,
          ),
          child: Container(
            decoration: BoxDecoration(
              color: messageHostColor,
              borderRadius: BorderRadius.all(Radius.circular(20.zR)),
            ),
            child: Padding(
              padding: EdgeInsets.fromLTRB(12.zR, 4.zR, 12.zR, 4.zR),
              child: Center(
                child: Text(
                  prefix!,
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 20.zR,
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
    ),
    WidgetSpan(child: SizedBox(width: 10.zR)),
  ]);
}