import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../models/dialogue_models.dart'; /// 對話氣泡組件 class DialogueBubble extends StatelessWidget { final DialogueMessage dialogue; final bool isUserReply; const DialogueBubble({ super.key, required this.dialogue, required this.isUserReply, }); @override Widget build(BuildContext context) { return Align( alignment: isUserReply ? Alignment.centerRight : Alignment.centerLeft, child: Container( constraints: BoxConstraints( maxWidth: MediaQuery.of(context).size.width * 0.75, ), margin: EdgeInsets.symmetric(vertical: 8.h), padding: EdgeInsets.all(16.w), decoration: BoxDecoration( color: isUserReply ? Theme.of(context).primaryColor : Colors.white.withOpacity(0.9), borderRadius: BorderRadius.circular(20.r), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.1), blurRadius: 8, offset: Offset(0, 2), ), ], ), child: Text( dialogue.content, style: TextStyle( color: isUserReply ? Colors.white : Colors.black87, fontSize: 16.sp, height: 1.4, ), ), ), ); } }