Improve small blocklist layout, fix heightMin.

This commit is contained in:
John Preston 2023-08-23 11:23:28 +02:00
parent 610e0e7913
commit 518f0e22cd
3 changed files with 31 additions and 4 deletions

View File

@ -523,10 +523,11 @@ settingsPremiumLock: icon{{ "emoji/premium_lock", windowActiveTextFg, point(0px,
settingsPremiumLockSkip: 3px;
settingsBlockedListSubtitleAddPadding: margins(0px, 1px, 0px, -4px);
settingsBlockedListIconPadding: margins(0px, 34px, 0px, 5px);
settingsBlockedListIconPadding: margins(0px, 24px, 0px, 5px);
settingsBlockedList: PeerList(peerListBox) {
padding: margins(0px, 0px, 0px, membersMarginBottom);
}
settingsBlockedHeightMin: 240px;
settingsNotificationType: SettingsButton(settingsButton) {
height: 40px;

View File

@ -47,7 +47,10 @@ Blocked::Blocked(
tr::lng_contacts_loading(),
st::changePhoneDescription),
std::move(padding)));
Ui::ResizeFitChild(this, _loading.get());
Ui::ResizeFitChild(
this,
_loading.get(),
st::settingsBlockedHeightMin);
}
_controller->session().api().blockedPeers().slice(
@ -201,7 +204,30 @@ void Blocked::setupContent() {
AddSkip(content, st::settingsBlockedListIconPadding.top());
}
Ui::ResizeFitChild(this, _container);
// We want minimal height to be the same no matter if subtitle
// is visible or not, so minimal height isn't a constant here.
// Ui::ResizeFitChild(this, _container, st::settingsBlockedHeightMin);
widthValue(
) | rpl::start_with_next([=](int width) {
_container->resizeToWidth(width);
}, _container->lifetime());
rpl::combine(
_container->heightValue(),
_emptinessChanges.events_starting_with(true)
) | rpl::start_with_next([=](int height, bool empty) {
const auto subtitled = !empty || (_countBlocked.current() > 0);
const auto total = st::settingsBlockedHeightMin;
const auto padding = st::settingsSubsectionTitlePadding
+ st::settingsBlockedListSubtitleAddPadding;
const auto subtitle = st::settingsSectionSkip
+ padding.top()
+ st::settingsSubsectionTitle.style.font->height
+ padding.bottom();
const auto min = total - (subtitled ? subtitle : 0);
resize(width(), std::max(height, min));
}, _container->lifetime());
}
void Blocked::checkTotal(int total) {

@ -1 +1 @@
Subproject commit a3c52c2cfe7ee5c3382ac0579eb96ec6962b7f47
Subproject commit 552db4b24f4542dcb6d19302d7e29ff00349b156