design: Adaptive switches

This commit is contained in:
Krille Fear 2021-11-27 10:10:29 +01:00
commit 956ee5bfc6
8 changed files with 17 additions and 19 deletions

View file

@ -34,7 +34,7 @@ class NewGroupView extends StatelessWidget {
hintText: L10n.of(context).enterAGroupName),
),
),
SwitchListTile(
SwitchListTile.adaptive(
title: Text(L10n.of(context).groupIsPublic),
value: controller.publicGroup,
onChanged: controller.setPublicGroup,

View file

@ -34,7 +34,7 @@ class NewSpaceView extends StatelessWidget {
hintText: L10n.of(context).enterASpacepName),
),
),
SwitchListTile(
SwitchListTile.adaptive(
title: Text(L10n.of(context).spaceIsPublic),
value: controller.publicGroup,
onChanged: controller.setPublicGroup,

View file

@ -24,32 +24,32 @@ class SettingsChatView extends StatelessWidget {
withScrolling: true,
child: Column(
children: [
SettingsSwitchListTile(
SettingsSwitchListTile.adaptive(
title: L10n.of(context).renderRichContent,
onChanged: (b) => AppConfig.renderHtml = b,
storeKey: SettingKeys.renderHtml,
defaultValue: AppConfig.renderHtml,
),
SettingsSwitchListTile(
SettingsSwitchListTile.adaptive(
title: L10n.of(context).hideRedactedEvents,
onChanged: (b) => AppConfig.hideRedactedEvents = b,
storeKey: SettingKeys.hideRedactedEvents,
defaultValue: AppConfig.hideRedactedEvents,
),
SettingsSwitchListTile(
SettingsSwitchListTile.adaptive(
title: L10n.of(context).hideUnknownEvents,
onChanged: (b) => AppConfig.hideUnknownEvents = b,
storeKey: SettingKeys.hideUnknownEvents,
defaultValue: AppConfig.hideUnknownEvents,
),
SettingsSwitchListTile(
SettingsSwitchListTile.adaptive(
title: L10n.of(context).autoplayImages,
onChanged: (b) => AppConfig.autoplayImages = b,
storeKey: SettingKeys.autoplayImages,
defaultValue: AppConfig.autoplayImages,
),
if (PlatformInfos.isMobile)
SettingsSwitchListTile(
SettingsSwitchListTile.adaptive(
title: L10n.of(context).sendOnEnter,
onChanged: (b) => AppConfig.sendOnEnter = b,
storeKey: SettingKeys.sendOnEnter,

View file

@ -83,12 +83,10 @@ class EmotesSettingsView extends StatelessWidget {
),
),
if (controller.room != null)
ListTile(
SwitchListTile.adaptive(
title: Text(L10n.of(context).enableEmotesGlobally),
trailing: Switch(
value: controller.isGloballyActive(client),
onChanged: controller.setIsGloballyActive,
),
value: controller.isGloballyActive(client),
onChanged: controller.setIsGloballyActive,
),
if (!controller.readonly || controller.room != null)
Divider(

View file

@ -35,7 +35,7 @@ class SettingsNotificationsView extends StatelessWidget {
builder: (BuildContext context, _) {
return Column(
children: [
SwitchListTile(
SwitchListTile.adaptive(
value: !Matrix.of(context).client.allPushNotificationsMuted,
title: Text(
L10n.of(context).notificationsEnabledForThisAccount),
@ -72,7 +72,7 @@ class SettingsNotificationsView extends StatelessWidget {
),
),
for (var item in NotificationSettingsItem.items)
SwitchListTile(
SwitchListTile.adaptive(
value: controller.getNotificationSetting(item) ?? true,
title: Text(item.title(context)),
onChanged: (bool enabled) =>