forked from eatvio/eatvio_app
38 lines
1007 B
Dart
38 lines
1007 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ChatBubbleWidget extends StatelessWidget {
|
|
const ChatBubbleWidget({
|
|
super.key,
|
|
required this.text,
|
|
required this.isCurrentUser,
|
|
});
|
|
|
|
final String text;
|
|
final bool isCurrentUser;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.fromLTRB(isCurrentUser ? 64 : 16, 4, isCurrentUser ? 16 : 64, 4),
|
|
child: Align(
|
|
alignment: isCurrentUser ? Alignment.centerRight : Alignment.centerLeft,
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
color: isCurrentUser ? Colors.blue : Colors.grey[300],
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12),
|
|
child: Text(
|
|
text,
|
|
style: TextStyle(
|
|
color: isCurrentUser ? Colors.white : Colors.black87,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|