defaultBuilder method

  1. @override
Widget defaultBuilder(
  1. BuildContext context
)
override

Default builder for the widget, which is necessary and must been override.

Implementation

@override
Widget defaultBuilder(BuildContext context) {
  final isDesktop = TencentCloudChatScreenAdapter.deviceScreenType == DeviceScreenType.desktop;
  return TencentCloudChatThemeWidget(
    build: (ctx, colors, fonts) => Padding(
      padding: EdgeInsets.symmetric(
        horizontal: getWidth(isDesktop ? 10 : 8),
      ),
      child: SizedBox(
        width: getSquareSize(isDesktop ? 38 : 40),
        height: getSquareSize(isDesktop ? 38 : 40),
        child: Stack(
          children: [
            Positioned(
              left: 0,
              top: 0,
              child: TencentCloudChatCommonBuilders.getCommonAvatarBuilder(
                imageList: getAvatar(),
                width: getSquareSize(isDesktop ? 38 : 40),
                height: getSquareSize(isDesktop ? 38 : 40),
                borderRadius: getSquareSize(isDesktop ? 19 : 20),
                scene: TencentCloudChatAvatarScene.conversationList,
              ),
            ),
            Positioned(
              bottom: 0,
              right: 0,
              child: SizedBox(
                width: getSquareSize(isDesktop ? 9 : 10),
                height: getSquareSize(isDesktop ? 9 : 10),
                child: Container(
                  decoration: BoxDecoration(
                    color: widget.isOnline ? colors.conversationItemUserStatusBgColor : Colors.transparent,
                    borderRadius: BorderRadius.all(
                      Radius.circular(
                        getSquareSize(5),
                      ),
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    ),
  );
}