54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../../theming/app_theme.dart';
|
|
import '../widgets/bubble.dart';
|
|
|
|
extension ColorExtensions on Color {
|
|
Color invert() {
|
|
final invertedR = 1.0 - r;
|
|
final invertedG = 1.0 - g;
|
|
final invertedB = 1.0 - b;
|
|
return Color.from(alpha: a, red: invertedR, green: invertedG, blue: invertedB);
|
|
}
|
|
|
|
Color withWhite(int whiteValue) {
|
|
final value = whiteValue / 255.0;
|
|
return Color.from(alpha: a, red: value, green: value, blue: value);
|
|
}
|
|
}
|
|
|
|
class ChatBubbleStyles {
|
|
final BuildContext context;
|
|
|
|
ChatBubbleStyles(this.context);
|
|
|
|
BubbleStyle getSystemStyle() => BubbleStyle(
|
|
color: AppTheme.isDarkMode(context) ? const Color(0xff182229) : Colors.white,
|
|
elevation: 2,
|
|
margin: const BubbleEdges.only(bottom: 20, top: 10),
|
|
alignment: Alignment.center,
|
|
);
|
|
|
|
BubbleStyle getRemoteStyle(bool seamless) {
|
|
var color = AppTheme.isDarkMode(context) ? const Color(0xff202c33) : Colors.white;
|
|
return BubbleStyle(
|
|
nip: BubbleNip.leftTop,
|
|
color: seamless ? Colors.transparent : color,
|
|
elevation: seamless ? 0 : 1,
|
|
margin: const BubbleEdges.only(bottom: 10, left: 10, right: 50),
|
|
alignment: Alignment.topLeft,
|
|
);
|
|
}
|
|
|
|
BubbleStyle getSelfStyle(bool seamless) {
|
|
var color = AppTheme.isDarkMode(context) ? const Color(0xff005c4b) : const Color(0xffd3d3d3);
|
|
return BubbleStyle(
|
|
nip: BubbleNip.rightBottom,
|
|
color: seamless ? Colors.transparent : color,
|
|
elevation: seamless ? 0 : 1,
|
|
margin: const BubbleEdges.only(bottom: 10, right: 10, left: 50),
|
|
alignment: Alignment.topRight,
|
|
);
|
|
}
|
|
}
|