import 'package:chat/configs/app_colors.dart';
import 'package:chat/utils/im_tools.dart';
import 'package:flutter/material.dart';
import 'package:tencent_im_sdk_plugin/models/v2_tim_message.dart';

class MessagePreviewWidget extends StatelessWidget {
  final V2TimMessage? message;
  const MessagePreviewWidget(this.message, {Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    if (message == null) {
      return const Text('');
    }

    return Text(
      ImTools.parseMessage(message),
      maxLines: 1,
      overflow: TextOverflow.ellipsis,
      style: const TextStyle(
        color: AppColors.unactive,
        fontSize: 14,
      ),
    );
  }
}
