mirrored_repositories/WhatsApp_UI/lib
import 'package:flutter/material.dart';
import 'package:whatsapp/information.dart';
import 'package:whatsapp/widgets/centermessa.dart';
import 'package:whatsapp/widgets/mymessage.dart';

class Chatlist extends StatelessWidget {
  const Chatlist({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      itemCount: messages.length,
      itemBuilder: (context, index) {
        if (messages[index]['isMe'] == true) {
          return Messagecard(
            message: messages[index]['text'].toString(),
            date: messages[index]['time'].toString(),
          );
        }
        return CenterMessagecard(
          message: messages[index]['text'].toString(),
          date: messages[index]['time'].toString(),
        );
      },
    );
  }
}
