繁体   English   中英

Flutter 气泡聊天在气泡外显示时间戳和刻度

[英]Flutter bubble chat showing time stamp and tick outside the bubble

基本上我正在为 flutter 使用 Bubble 我设法让它工作但无法添加时间戳和刻度我的意思是代码正在工作但如果有人知道如何将时间戳和刻度包含在气泡之外气泡。

: Container(
child: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Bubble(
          margin: BubbleEdges.only(top: 10),
          nipWidth: 13,

          alignment: Alignment.topRight,
          nip: BubbleNip.rightBottom,
          color: Color.fromRGBO(212, 234, 244, 1.0),
          child: Text(documentSnapshot.data['text'], style: TextStyle(fontSize: 18.0)),
        ),


    Row(
    mainAxisAlignment: MainAxisAlignment.end,
    children: <Widget>[
      Text(
        documentSnapshot.data["time"] != null
            ? DateFormat.MMMd()
            .add_jm()
            .format(documentSnapshot
            .data["time"]
            .toDate())
            .toString()
            : "",
    style: TextStyle(
    color: secondryColor,
    fontSize: 13.0,
    fontWeight: FontWeight.w600,
    ),
      ),
      SizedBox(
        width: 5,
      ),
      documentSnapshot.data['isRead'] == false
          ? Icon(
        Icons.done,
        color: secondryColor,
        size: 15,
      )
          : Icon(
        Icons.done_all,
        color: primaryColor,
        size: 15,
    )
    ],
    ),
    ],
    ),
      ),

    ),

          ],
        ),
      ),
    ];
  }

为此,您需要在 Bubble 小部件的子项中添加一列,而不是在容器中

我希望这段代码有帮助:

                Container(
                child: Bubble(
              margin: BubbleEdges.only(top: 10),
              nipWidth: 13,
              alignment: Alignment.topRight,
              nip: BubbleNip.rightBottom,
              color: Color.fromRGBO(212, 234, 244, 1.0),
              child: Column(
                children: [
                  Text(documentSnapshot.data['text'], style: TextStyle(fontSize: 18.0)),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: <Widget>[
                      Text(
                        documentSnapshot.data["time"] != null
                            ? DateFormat.MMMd()
                                .add_jm()
                                .format(documentSnapshot.data["time"].toDate())
                                .toString()
                            : "",
                        style: TextStyle(
                          color: secondryColor,
                          fontSize: 13.0,
                          fontWeight: FontWeight.w600,
                        ),
                      ),
                      SizedBox(
                        width: 5,
                      ),
                      documentSnapshot.data['isRead'] == false
                          ? Icon(
                              Icons.done,
                              color: secondryColor,
                              size: 15,
                            )
                          : Icon(
                              Icons.done_all,
                              color: primaryColor,
                              size: 15,
                            )
                    ],
                  ),
                ],
              ),
            ));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM