mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-08 04:59:29 +01:00
Merge branch 'krille/adaptive-switches' into 'main'
design: Adaptive switches See merge request famedly/fluffychat!587
This commit is contained in:
commit
16c7a89666
@ -34,7 +34,7 @@ class NewGroupView extends StatelessWidget {
|
|||||||
hintText: L10n.of(context).enterAGroupName),
|
hintText: L10n.of(context).enterAGroupName),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SwitchListTile(
|
SwitchListTile.adaptive(
|
||||||
title: Text(L10n.of(context).groupIsPublic),
|
title: Text(L10n.of(context).groupIsPublic),
|
||||||
value: controller.publicGroup,
|
value: controller.publicGroup,
|
||||||
onChanged: controller.setPublicGroup,
|
onChanged: controller.setPublicGroup,
|
||||||
|
@ -34,7 +34,7 @@ class NewSpaceView extends StatelessWidget {
|
|||||||
hintText: L10n.of(context).enterASpacepName),
|
hintText: L10n.of(context).enterASpacepName),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SwitchListTile(
|
SwitchListTile.adaptive(
|
||||||
title: Text(L10n.of(context).spaceIsPublic),
|
title: Text(L10n.of(context).spaceIsPublic),
|
||||||
value: controller.publicGroup,
|
value: controller.publicGroup,
|
||||||
onChanged: controller.setPublicGroup,
|
onChanged: controller.setPublicGroup,
|
||||||
|
@ -24,32 +24,32 @@ class SettingsChatView extends StatelessWidget {
|
|||||||
withScrolling: true,
|
withScrolling: true,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile.adaptive(
|
||||||
title: L10n.of(context).renderRichContent,
|
title: L10n.of(context).renderRichContent,
|
||||||
onChanged: (b) => AppConfig.renderHtml = b,
|
onChanged: (b) => AppConfig.renderHtml = b,
|
||||||
storeKey: SettingKeys.renderHtml,
|
storeKey: SettingKeys.renderHtml,
|
||||||
defaultValue: AppConfig.renderHtml,
|
defaultValue: AppConfig.renderHtml,
|
||||||
),
|
),
|
||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile.adaptive(
|
||||||
title: L10n.of(context).hideRedactedEvents,
|
title: L10n.of(context).hideRedactedEvents,
|
||||||
onChanged: (b) => AppConfig.hideRedactedEvents = b,
|
onChanged: (b) => AppConfig.hideRedactedEvents = b,
|
||||||
storeKey: SettingKeys.hideRedactedEvents,
|
storeKey: SettingKeys.hideRedactedEvents,
|
||||||
defaultValue: AppConfig.hideRedactedEvents,
|
defaultValue: AppConfig.hideRedactedEvents,
|
||||||
),
|
),
|
||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile.adaptive(
|
||||||
title: L10n.of(context).hideUnknownEvents,
|
title: L10n.of(context).hideUnknownEvents,
|
||||||
onChanged: (b) => AppConfig.hideUnknownEvents = b,
|
onChanged: (b) => AppConfig.hideUnknownEvents = b,
|
||||||
storeKey: SettingKeys.hideUnknownEvents,
|
storeKey: SettingKeys.hideUnknownEvents,
|
||||||
defaultValue: AppConfig.hideUnknownEvents,
|
defaultValue: AppConfig.hideUnknownEvents,
|
||||||
),
|
),
|
||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile.adaptive(
|
||||||
title: L10n.of(context).autoplayImages,
|
title: L10n.of(context).autoplayImages,
|
||||||
onChanged: (b) => AppConfig.autoplayImages = b,
|
onChanged: (b) => AppConfig.autoplayImages = b,
|
||||||
storeKey: SettingKeys.autoplayImages,
|
storeKey: SettingKeys.autoplayImages,
|
||||||
defaultValue: AppConfig.autoplayImages,
|
defaultValue: AppConfig.autoplayImages,
|
||||||
),
|
),
|
||||||
if (PlatformInfos.isMobile)
|
if (PlatformInfos.isMobile)
|
||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile.adaptive(
|
||||||
title: L10n.of(context).sendOnEnter,
|
title: L10n.of(context).sendOnEnter,
|
||||||
onChanged: (b) => AppConfig.sendOnEnter = b,
|
onChanged: (b) => AppConfig.sendOnEnter = b,
|
||||||
storeKey: SettingKeys.sendOnEnter,
|
storeKey: SettingKeys.sendOnEnter,
|
||||||
|
@ -83,12 +83,10 @@ class EmotesSettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (controller.room != null)
|
if (controller.room != null)
|
||||||
ListTile(
|
SwitchListTile.adaptive(
|
||||||
title: Text(L10n.of(context).enableEmotesGlobally),
|
title: Text(L10n.of(context).enableEmotesGlobally),
|
||||||
trailing: Switch(
|
value: controller.isGloballyActive(client),
|
||||||
value: controller.isGloballyActive(client),
|
onChanged: controller.setIsGloballyActive,
|
||||||
onChanged: controller.setIsGloballyActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
if (!controller.readonly || controller.room != null)
|
if (!controller.readonly || controller.room != null)
|
||||||
Divider(
|
Divider(
|
||||||
|
@ -35,7 +35,7 @@ class SettingsNotificationsView extends StatelessWidget {
|
|||||||
builder: (BuildContext context, _) {
|
builder: (BuildContext context, _) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
SwitchListTile(
|
SwitchListTile.adaptive(
|
||||||
value: !Matrix.of(context).client.allPushNotificationsMuted,
|
value: !Matrix.of(context).client.allPushNotificationsMuted,
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context).notificationsEnabledForThisAccount),
|
L10n.of(context).notificationsEnabledForThisAccount),
|
||||||
@ -72,7 +72,7 @@ class SettingsNotificationsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
for (var item in NotificationSettingsItem.items)
|
for (var item in NotificationSettingsItem.items)
|
||||||
SwitchListTile(
|
SwitchListTile.adaptive(
|
||||||
value: controller.getNotificationSetting(item) ?? true,
|
value: controller.getNotificationSetting(item) ?? true,
|
||||||
title: Text(item.title(context)),
|
title: Text(item.title(context)),
|
||||||
onChanged: (bool enabled) =>
|
onChanged: (bool enabled) =>
|
||||||
|
@ -60,7 +60,7 @@ abstract class PlatformInfos {
|
|||||||
onPressed: () => VRouter.of(context).to('logs'),
|
onPressed: () => VRouter.of(context).to('logs'),
|
||||||
child: const Text('Logs'),
|
child: const Text('Logs'),
|
||||||
),
|
),
|
||||||
SentrySwitchListTile(label: L10n.of(context).sendBugReports),
|
SentrySwitchListTile.adaptive(label: L10n.of(context).sendBugReports),
|
||||||
],
|
],
|
||||||
applicationIcon: Image.asset('assets/logo.png', width: 64, height: 64),
|
applicationIcon: Image.asset('assets/logo.png', width: 64, height: 64),
|
||||||
applicationName: AppConfig.applicationName,
|
applicationName: AppConfig.applicationName,
|
||||||
|
@ -7,7 +7,7 @@ import 'package:fluffychat/utils/sentry_controller.dart';
|
|||||||
class SentrySwitchListTile extends StatefulWidget {
|
class SentrySwitchListTile extends StatefulWidget {
|
||||||
final String label;
|
final String label;
|
||||||
|
|
||||||
const SentrySwitchListTile({Key key, this.label}) : super(key: key);
|
const SentrySwitchListTile.adaptive({Key key, this.label}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_SentrySwitchListTileState createState() => _SentrySwitchListTileState();
|
_SentrySwitchListTileState createState() => _SentrySwitchListTileState();
|
||||||
@ -22,7 +22,7 @@ class _SentrySwitchListTileState extends State<SentrySwitchListTile> {
|
|||||||
future: SentryController.getSentryStatus(),
|
future: SentryController.getSentryStatus(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
_enabled = snapshot.data ?? false;
|
_enabled = snapshot.data ?? false;
|
||||||
return SwitchListTile(
|
return SwitchListTile.adaptive(
|
||||||
title: Text(widget.label ?? L10n.of(context).sendBugReports),
|
title: Text(widget.label ?? L10n.of(context).sendBugReports),
|
||||||
value: _enabled,
|
value: _enabled,
|
||||||
onChanged: (b) =>
|
onChanged: (b) =>
|
||||||
|
@ -8,7 +8,7 @@ class SettingsSwitchListTile extends StatefulWidget {
|
|||||||
final String title;
|
final String title;
|
||||||
final Function(bool) onChanged;
|
final Function(bool) onChanged;
|
||||||
|
|
||||||
const SettingsSwitchListTile({
|
const SettingsSwitchListTile.adaptive({
|
||||||
Key key,
|
Key key,
|
||||||
this.defaultValue = false,
|
this.defaultValue = false,
|
||||||
@required this.storeKey,
|
@required this.storeKey,
|
||||||
@ -27,7 +27,7 @@ class _SettingsSwitchListTileState extends State<SettingsSwitchListTile> {
|
|||||||
future: Matrix.of(context)
|
future: Matrix.of(context)
|
||||||
.store
|
.store
|
||||||
.getItemBool(widget.storeKey, widget.defaultValue),
|
.getItemBool(widget.storeKey, widget.defaultValue),
|
||||||
builder: (context, snapshot) => SwitchListTile(
|
builder: (context, snapshot) => SwitchListTile.adaptive(
|
||||||
value: snapshot.data ?? widget.defaultValue,
|
value: snapshot.data ?? widget.defaultValue,
|
||||||
title: Text(widget.title),
|
title: Text(widget.title),
|
||||||
onChanged: (bool newValue) async {
|
onChanged: (bool newValue) async {
|
||||||
|
Loading…
Reference in New Issue
Block a user