закрепление и мьют чатов

This commit is contained in:
Jganenok
2026-05-17 19:49:29 +07:00
parent 80b297f7b3
commit 7fd0206c34
9 changed files with 601 additions and 148 deletions
+81
View File
@@ -0,0 +1,81 @@
import 'package:flutter/widgets.dart';
import '../config/app_bubble_behavior.dart';
import '../config/app_bubble_shape.dart';
const double kBubbleBigRadius = 20;
const double kBubbleSmallRadius = 4;
const Radius _big = Radius.circular(kBubbleBigRadius);
const Radius _small = Radius.circular(kBubbleSmallRadius);
BorderRadius computeBubbleRadius({
required bool isMe,
required bool isTop,
required bool isBottom,
required BubbleStyle style,
required BubbleBehavior behavior,
bool hasPhotoWithCaption = false,
bool hasMultiplePhotosNoCaption = false,
}) {
final isSingle = isTop && isBottom;
if (hasPhotoWithCaption && (isTop || isBottom)) {
return BorderRadius.only(
topLeft: _big,
topRight: _big,
bottomLeft: isMe ? _big : _small,
bottomRight: _small,
);
}
if (hasMultiplePhotosNoCaption && isBottom) {
return BorderRadius.only(
topLeft: isMe ? _big : _small,
topRight: _small,
bottomLeft: isMe ? _big : _small,
bottomRight: isMe ? _small : _big,
);
}
final base = style == BubbleStyle.desktop ? _small : _big;
Radius tl = base, tr = base, bl = base, br = base;
if (behavior == BubbleBehavior.immutable || isSingle) {
return BorderRadius.only(
topLeft: tl,
topRight: tr,
bottomLeft: bl,
bottomRight: br,
);
}
if (isTop) {
if (isMe) {
br = _small;
} else {
bl = _small;
}
} else if (isBottom) {
if (isMe) {
tr = _small;
} else {
tl = _small;
}
} else {
if (isMe) {
tr = _small;
br = _small;
} else {
tl = _small;
bl = _small;
}
}
return BorderRadius.only(
topLeft: tl,
topRight: tr,
bottomLeft: bl,
bottomRight: br,
);
}