fix: badge improvements

This commit is contained in:
ZavaruKitsu 2023-11-01 18:37:11 +03:00
parent 15ee46dab4
commit b806e714a6

View file

@ -315,7 +315,7 @@ Cover::Cover(
[=] {
return controller->isGifPausedAtLeastFor(
Window::GifPauseReason::Layer);
}))
}, 0, BadgeType::None | BadgeType::AyuGram | BadgeType::Extera))
, _userpic(topic
? nullptr
: object_ptr<Ui::UserpicButton>(
@ -368,6 +368,10 @@ Cover::Cover(
_devBadge->setContent(Info::Profile::Badge::Content{BadgeType::None});
}
_devBadge->updated() | rpl::start_with_next([=] {
refreshNameGeometry(width());
}, _name->lifetime());
initViewers(std::move(title));
setupChildGeometry();
@ -589,6 +593,9 @@ void Cover::refreshNameGeometry(int newWidth) {
if (const auto widget = _badge->widget()) {
nameWidth -= st::infoVerifiedCheckPosition.x() + widget->width();
}
if (const auto widget = _devBadge->widget()) {
nameWidth -= st::infoVerifiedCheckPosition.x() + widget->width();
}
_name->resizeToNaturalWidth(nameWidth);
_name->moveToLeft(_st.nameLeft, _st.nameTop, newWidth);
const auto badgeLeft = _st.nameLeft + _name->width();