38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
import 'package:cofounderella/themes/theme_provider.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class ChatBubble extends StatelessWidget {
|
|
final String message;
|
|
final bool isCurrentUser;
|
|
|
|
const ChatBubble({
|
|
super.key,
|
|
required this.message,
|
|
required this.isCurrentUser,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// control bubble color according to light or dark mode
|
|
bool isDarkMode =
|
|
Provider.of<ThemeProvider>(context, listen: false).isDarkMode;
|
|
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
// TODO check colors for bubbles and text below
|
|
color: isCurrentUser
|
|
? (isDarkMode ? Colors.green.shade600 : Colors.green.shade500)
|
|
: (isDarkMode ? Colors.grey.shade300 : Colors.grey.shade700),
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
padding: const EdgeInsets.all(16.0),
|
|
margin: const EdgeInsets.symmetric(vertical: 2.5, horizontal: 25),
|
|
child: Text(
|
|
message,
|
|
style: TextStyle(color: isDarkMode ? Colors.white : Colors.black),
|
|
),
|
|
);
|
|
}
|
|
}
|