2021-11-13 21:21:13 +01:00
|
|
|
import 'package:flutter/cupertino.dart';
|
2021-10-26 18:50:34 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
import 'package:vrouter/vrouter.dart';
|
|
|
|
|
2021-06-23 11:26:12 +02:00
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
|
import 'package:fluffychat/config/setting_keys.dart';
|
2021-08-24 20:43:21 +02:00
|
|
|
import 'package:fluffychat/utils/platform_infos.dart';
|
2021-06-23 11:26:12 +02:00
|
|
|
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
|
|
|
import 'package:fluffychat/widgets/settings_switch_list_tile.dart';
|
2021-11-09 21:32:16 +01:00
|
|
|
import 'settings_chat.dart';
|
2021-06-23 11:26:12 +02:00
|
|
|
|
|
|
|
class SettingsChatView extends StatelessWidget {
|
|
|
|
final SettingsChatController controller;
|
|
|
|
const SettingsChatView(this.controller, {Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(title: Text(L10n.of(context).chat)),
|
|
|
|
body: MaxWidthBody(
|
|
|
|
withScrolling: true,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
SettingsSwitchListTile(
|
|
|
|
title: L10n.of(context).renderRichContent,
|
|
|
|
onChanged: (b) => AppConfig.renderHtml = b,
|
|
|
|
storeKey: SettingKeys.renderHtml,
|
|
|
|
defaultValue: AppConfig.renderHtml,
|
|
|
|
),
|
|
|
|
SettingsSwitchListTile(
|
|
|
|
title: L10n.of(context).hideRedactedEvents,
|
|
|
|
onChanged: (b) => AppConfig.hideRedactedEvents = b,
|
|
|
|
storeKey: SettingKeys.hideRedactedEvents,
|
|
|
|
defaultValue: AppConfig.hideRedactedEvents,
|
|
|
|
),
|
|
|
|
SettingsSwitchListTile(
|
|
|
|
title: L10n.of(context).hideUnknownEvents,
|
|
|
|
onChanged: (b) => AppConfig.hideUnknownEvents = b,
|
|
|
|
storeKey: SettingKeys.hideUnknownEvents,
|
|
|
|
defaultValue: AppConfig.hideUnknownEvents,
|
|
|
|
),
|
2021-08-07 19:36:42 +02:00
|
|
|
SettingsSwitchListTile(
|
|
|
|
title: L10n.of(context).autoplayImages,
|
|
|
|
onChanged: (b) => AppConfig.autoplayImages = b,
|
|
|
|
storeKey: SettingKeys.autoplayImages,
|
|
|
|
defaultValue: AppConfig.autoplayImages,
|
|
|
|
),
|
2021-08-24 20:43:21 +02:00
|
|
|
if (PlatformInfos.isMobile)
|
|
|
|
SettingsSwitchListTile(
|
|
|
|
title: L10n.of(context).sendOnEnter,
|
|
|
|
onChanged: (b) => AppConfig.sendOnEnter = b,
|
|
|
|
storeKey: SettingKeys.sendOnEnter,
|
|
|
|
defaultValue: AppConfig.sendOnEnter,
|
|
|
|
),
|
2021-11-13 21:21:13 +01:00
|
|
|
const Divider(height: 1),
|
|
|
|
ListTile(
|
|
|
|
title: Text(L10n.of(context).emoteSettings),
|
|
|
|
onTap: () => VRouter.of(context).to('emotes'),
|
|
|
|
trailing: const Padding(
|
|
|
|
padding: EdgeInsets.all(16.0),
|
|
|
|
child: Icon(Icons.insert_emoticon_outlined),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
trailing: const Padding(
|
|
|
|
padding: EdgeInsets.all(16.0),
|
|
|
|
child: Icon(CupertinoIcons.phone),
|
|
|
|
),
|
|
|
|
title: Text(L10n.of(context).editJitsiInstance),
|
|
|
|
subtitle: Text(AppConfig.jitsiInstance),
|
|
|
|
onTap: controller.setJitsiInstanceAction,
|
|
|
|
),
|
2021-06-23 11:26:12 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|