chatText static method

Widget chatText(
  1. String chatContent,
  2. String id,
  3. dynamic listMessage,
  4. int index,
  5. bool logUserMsg,
)

Implementation

static Widget chatText(String chatContent, String id, var listMessage,
    int index, bool logUserMsg) {
  return Container(
    child: Linkify(
      onOpen: (link) async {
        if (await canLaunch(link.url)) {
          await launch(link.url);
        } else {
          throw 'Could not launch $link';
        }
      },
      text: chatContent,
      style: TextStyle(color: logUserMsg ? primaryColor : Colors.white),
      linkStyle: TextStyle(color: Colors.blueGrey),
    ),
    padding: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 10.0),
    width: kIsWeb ? 400 : 200.0,
    decoration: BoxDecoration(
        color: logUserMsg ? greyColor2 : primaryColor,
        borderRadius: BorderRadius.circular(8.0)),
    margin: logUserMsg
        ? EdgeInsets.only(
            bottom: ChatData.isLastMessageRight(listMessage, id, index)
                ? 20.0
                : 10.0,
            right: 10.0)
        : EdgeInsets.only(left: 10.0),
  );
}