2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Added close button to custom top bar in premium settings.

This commit is contained in:
23rd
2022-05-23 03:00:13 +03:00
parent 4e173c8e61
commit a284fa3273
2 changed files with 26 additions and 2 deletions

View File

@@ -67,6 +67,7 @@ private:
const not_null<Window::SessionController*> _controller;
base::unique_qptr<Ui::FadeWrap<Ui::IconButton>> _back;
base::unique_qptr<Ui::IconButton> _close;
rpl::variable<bool> _backToggles;
rpl::variable<Info::Wrap> _wrap;
@@ -304,11 +305,12 @@ QPointer<Ui::RpWidget> Premium::createPinnedToTop(
_wrap.value(
) | rpl::start_with_next([=](Info::Wrap wrap) {
const auto isLayer = (wrap == Info::Wrap::Layer);
_back = base::make_unique_q<Ui::FadeWrap<Ui::IconButton>>(
content,
object_ptr<Ui::IconButton>(
content,
(wrap == Info::Wrap::Layer)
isLayer
? st::settingsPremiumLayerTopBarBack
: st::settingsPremiumTopBarBack),
st::infoTopBarScale);
@@ -317,6 +319,22 @@ QPointer<Ui::RpWidget> Premium::createPinnedToTop(
_back->entity()->addClickHandler([=] {
_showBack.fire({});
});
if (!isLayer) {
_close = nullptr;
} else {
_close = base::make_unique_q<Ui::IconButton>(
content,
st::settingsPremiumTopBarClose);
_close->addClickHandler([=] {
_controller->parentController()->hideLayer();
_controller->parentController()->hideSpecialLayer();
});
content->widthValue(
) | rpl::start_with_next([=] {
_close->moveToRight(0, 0);
}, _close->lifetime());
}
}, container->lifetime());
return Ui::MakeWeak(not_null<Ui::RpWidget*>{ container });