refactor: Migrate to null safety

This commit is contained in:
Krille Fear 2022-01-29 12:35:03 +01:00 committed by Christian Pauly
commit 55f0300f9f
163 changed files with 1759 additions and 1903 deletions

View file

@ -9,7 +9,7 @@ import 'package:fluffychat/widgets/matrix.dart';
import 'settings_chat_view.dart';
class SettingsChat extends StatefulWidget {
const SettingsChat({Key key}) : super(key: key);
const SettingsChat({Key? key}) : super(key: key);
@override
SettingsChatController createState() => SettingsChatController();
@ -21,9 +21,9 @@ class SettingsChatController extends State<SettingsChat> {
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).editJitsiInstance,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
title: L10n.of(context)!.editJitsiInstance,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
textFields: [
DialogTextField(
initialText: AppConfig.jitsiInstance.replaceFirst(prefix, ''),

View file

@ -12,52 +12,52 @@ import 'settings_chat.dart';
class SettingsChatView extends StatelessWidget {
final SettingsChatController controller;
const SettingsChatView(this.controller, {Key key}) : super(key: key);
const SettingsChatView(this.controller, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(L10n.of(context).chat)),
appBar: AppBar(title: Text(L10n.of(context)!.chat)),
body: ListTileTheme(
iconColor: Theme.of(context).textTheme.bodyText1.color,
iconColor: Theme.of(context).textTheme.bodyText1!.color,
child: MaxWidthBody(
withScrolling: true,
child: Column(
children: [
SettingsSwitchListTile.adaptive(
title: L10n.of(context).renderRichContent,
title: L10n.of(context)!.renderRichContent,
onChanged: (b) => AppConfig.renderHtml = b,
storeKey: SettingKeys.renderHtml,
defaultValue: AppConfig.renderHtml,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context).hideRedactedEvents,
title: L10n.of(context)!.hideRedactedEvents,
onChanged: (b) => AppConfig.hideRedactedEvents = b,
storeKey: SettingKeys.hideRedactedEvents,
defaultValue: AppConfig.hideRedactedEvents,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context).hideUnknownEvents,
title: L10n.of(context)!.hideUnknownEvents,
onChanged: (b) => AppConfig.hideUnknownEvents = b,
storeKey: SettingKeys.hideUnknownEvents,
defaultValue: AppConfig.hideUnknownEvents,
),
SettingsSwitchListTile.adaptive(
title: L10n.of(context).autoplayImages,
title: L10n.of(context)!.autoplayImages,
onChanged: (b) => AppConfig.autoplayImages = b,
storeKey: SettingKeys.autoplayImages,
defaultValue: AppConfig.autoplayImages,
),
if (PlatformInfos.isMobile)
SettingsSwitchListTile.adaptive(
title: L10n.of(context).sendOnEnter,
title: L10n.of(context)!.sendOnEnter,
onChanged: (b) => AppConfig.sendOnEnter = b,
storeKey: SettingKeys.sendOnEnter,
defaultValue: AppConfig.sendOnEnter,
),
const Divider(height: 1),
ListTile(
title: Text(L10n.of(context).emoteSettings),
title: Text(L10n.of(context)!.emoteSettings),
onTap: () => VRouter.of(context).to('emotes'),
trailing: const Padding(
padding: EdgeInsets.all(16.0),
@ -69,7 +69,7 @@ class SettingsChatView extends StatelessWidget {
padding: EdgeInsets.all(16.0),
child: Icon(Icons.phone_outlined),
),
title: Text(L10n.of(context).editJitsiInstance),
title: Text(L10n.of(context)!.editJitsiInstance),
subtitle: Text(AppConfig.jitsiInstance),
onTap: controller.setJitsiInstanceAction,
),