Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Krille
4471411dab
refactor: Move l10n to lib and make l10n not nullable 2024-05-22 08:51:01 +02:00
Krille
a454555776
build: Update to flutter 3.22.0 2024-05-22 08:10:35 +02:00
129 changed files with 1062 additions and 1064 deletions

View file

@ -21,6 +21,7 @@ jobs:
run: dart run import_sorter:main --no-comments --exit-if-changed run: dart run import_sorter:main --no-comments --exit-if-changed
- name: Check license compliance - name: Check license compliance
run: dart run license_checker check-licenses -c licenses.yaml --problematic run: dart run license_checker check-licenses -c licenses.yaml --problematic
- run: flutter gen-l10n
- run: flutter analyze - run: flutter analyze
- name: Apply google services patch - name: Apply google services patch
run: git apply ./scripts/enable-android-google-services.patch run: git apply ./scripts/enable-android-google-services.patch

View file

@ -1,2 +1,2 @@
FLUTTER_VERSION=3.19.6 FLUTTER_VERSION=3.22.0
JAVA_VERSION=17 JAVA_VERSION=17

2
.gitignore vendored
View file

@ -15,6 +15,8 @@ prime
# libolm package # libolm package
/assets/js/package /assets/js/package
/lib/l10n
# IntelliJ related # IntelliJ related
*.iml *.iml
*.ipr *.ipr

View file

@ -3,3 +3,7 @@ template-arb-file: intl_en.arb
output-localization-file: l10n.dart output-localization-file: l10n.dart
output-class: L10n output-class: L10n
preferred-supported-locales: ["en"] preferred-supported-locales: ["en"]
# Workaround from https://github.com/flutter/flutter/issues/148333#issuecomment-2122333090
synthetic-package: false
output-dir: lib/l10n
nullable-getter: false

View file

@ -89,7 +89,7 @@ abstract class FluffyThemes {
), ),
), ),
textSelectionTheme: TextSelectionThemeData( textSelectionTheme: TextSelectionThemeData(
selectionColor: colorScheme.onBackground.withAlpha(128), selectionColor: colorScheme.onSurface.withAlpha(128),
selectionHandleColor: colorScheme.secondary, selectionHandleColor: colorScheme.secondary,
), ),
inputDecorationTheme: InputDecorationTheme( inputDecorationTheme: InputDecorationTheme(
@ -106,13 +106,13 @@ abstract class FluffyThemes {
? Colors.grey.withAlpha(64) ? Colors.grey.withAlpha(64)
: null, : null,
surfaceTintColor: surfaceTintColor:
FluffyThemes.isColumnMode(context) ? colorScheme.background : null, FluffyThemes.isColumnMode(context) ? colorScheme.surface : null,
systemOverlayStyle: SystemUiOverlayStyle( systemOverlayStyle: SystemUiOverlayStyle(
statusBarColor: Colors.transparent, statusBarColor: Colors.transparent,
statusBarIconBrightness: brightness.reversed, statusBarIconBrightness: brightness.reversed,
statusBarBrightness: brightness, statusBarBrightness: brightness,
systemNavigationBarIconBrightness: brightness.reversed, systemNavigationBarIconBrightness: brightness.reversed,
systemNavigationBarColor: colorScheme.background, systemNavigationBarColor: colorScheme.surface,
), ),
), ),
textButtonTheme: TextButtonThemeData( textButtonTheme: TextButtonThemeData(

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/archive/archive_view.dart'; import 'package:fluffychat/pages/archive/archive_view.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -42,10 +42,10 @@ class ArchiveController extends State<Archive> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
message: L10n.of(context)!.clearArchive, message: L10n.of(context).clearArchive,
) != ) !=
OkCancelResult.ok) { OkCancelResult.ok) {
return; return;

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/archive/archive.dart'; import 'package:fluffychat/pages/archive/archive.dart';
import 'package:fluffychat/pages/chat_list/chat_list_item.dart'; import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
@ -20,14 +20,14 @@ class ArchiveView extends StatelessWidget {
builder: (BuildContext context, snapshot) => Scaffold( builder: (BuildContext context, snapshot) => Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.archive), title: Text(L10n.of(context).archive),
actions: [ actions: [
if (snapshot.data?.isNotEmpty ?? false) if (snapshot.data?.isNotEmpty ?? false)
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextButton.icon( child: TextButton.icon(
onPressed: controller.forgetAllAction, onPressed: controller.forgetAllAction,
label: Text(L10n.of(context)!.clearArchive), label: Text(L10n.of(context).clearArchive),
icon: const Icon(Icons.cleaning_services_outlined), icon: const Icon(Icons.cleaning_services_outlined),
), ),
), ),
@ -40,7 +40,7 @@ class ArchiveView extends StatelessWidget {
if (snapshot.hasError) { if (snapshot.hasError) {
return Center( return Center(
child: Text( child: Text(
L10n.of(context)!.oopsSomethingWentWrong, L10n.of(context).oopsSomethingWentWrong,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
); );

View file

@ -1,13 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/encryption.dart'; import 'package:matrix/encryption.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/error_reporter.dart'; import 'package:fluffychat/utils/error_reporter.dart';
import 'package:fluffychat/utils/fluffy_share.dart'; import 'package:fluffychat/utils/fluffy_share.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
@ -61,12 +61,12 @@ class BootstrapDialogState extends State<BootstrapDialog> {
String _getSecureStorageLocalizedName() { String _getSecureStorageLocalizedName() {
if (PlatformInfos.isAndroid) { if (PlatformInfos.isAndroid) {
return L10n.of(context)!.storeInAndroidKeystore; return L10n.of(context).storeInAndroidKeystore;
} }
if (PlatformInfos.isIOS || PlatformInfos.isMacOS) { if (PlatformInfos.isIOS || PlatformInfos.isMacOS) {
return L10n.of(context)!.storeInAppleKeyChain; return L10n.of(context).storeInAppleKeyChain;
} }
return L10n.of(context)!.storeSecurlyOnThisDevice; return L10n.of(context).storeSecurlyOnThisDevice;
} }
@override @override
@ -91,12 +91,12 @@ class BootstrapDialogState extends State<BootstrapDialog> {
_wipe ??= widget.wipe; _wipe ??= widget.wipe;
final buttons = <Widget>[]; final buttons = <Widget>[];
Widget body = const CircularProgressIndicator.adaptive(); Widget body = const CircularProgressIndicator.adaptive();
titleText = L10n.of(context)!.loadingPleaseWait; titleText = L10n.of(context).loadingPleaseWait;
if (bootstrap.newSsssKey?.recoveryKey != null && if (bootstrap.newSsssKey?.recoveryKey != null &&
_recoveryKeyStored == false) { _recoveryKeyStored == false) {
final key = bootstrap.newSsssKey!.recoveryKey; final key = bootstrap.newSsssKey!.recoveryKey;
titleText = L10n.of(context)!.recoveryKey; titleText = L10n.of(context).recoveryKey;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
@ -104,7 +104,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop, onPressed: Navigator.of(context).pop,
), ),
title: Text(L10n.of(context)!.recoveryKey), title: Text(L10n.of(context).recoveryKey),
), ),
body: Center( body: Center(
child: ConstrainedBox( child: ConstrainedBox(
@ -122,7 +122,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
), ),
subtitle: Text(L10n.of(context)!.chatBackupDescription), subtitle: Text(L10n.of(context).chatBackupDescription),
), ),
const Divider( const Divider(
height: 32, height: 32,
@ -152,7 +152,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
}, },
title: Text(_getSecureStorageLocalizedName()), title: Text(_getSecureStorageLocalizedName()),
subtitle: subtitle:
Text(L10n.of(context)!.storeInSecureStorageDescription), Text(L10n.of(context).storeInSecureStorageDescription),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
CheckboxListTile.adaptive( CheckboxListTile.adaptive(
@ -163,13 +163,13 @@ class BootstrapDialogState extends State<BootstrapDialog> {
FluffyShare.share(key!, context); FluffyShare.share(key!, context);
setState(() => _recoveryKeyCopied = true); setState(() => _recoveryKeyCopied = true);
}, },
title: Text(L10n.of(context)!.copyToClipboard), title: Text(L10n.of(context).copyToClipboard),
subtitle: Text(L10n.of(context)!.saveKeyManuallyDescription), subtitle: Text(L10n.of(context).saveKeyManuallyDescription),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
ElevatedButton.icon( ElevatedButton.icon(
icon: const Icon(Icons.check_outlined), icon: const Icon(Icons.check_outlined),
label: Text(L10n.of(context)!.next), label: Text(L10n.of(context).next),
onPressed: onPressed:
(_recoveryKeyCopied || _storeInSecureStorage == true) (_recoveryKeyCopied || _storeInSecureStorage == true)
? () { ? () {
@ -226,7 +226,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop, onPressed: Navigator.of(context).pop,
), ),
title: Text(L10n.of(context)!.chatBackup), title: Text(L10n.of(context).chatBackup),
), ),
body: Center( body: Center(
child: ConstrainedBox( child: ConstrainedBox(
@ -244,7 +244,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.pleaseEnterRecoveryKeyDescription, L10n.of(context).pleaseEnterRecoveryKeyDescription,
), ),
), ),
const Divider(height: 32), const Divider(height: 32),
@ -264,7 +264,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
fontFamily: fontFamily:
Theme.of(context).textTheme.bodyLarge?.fontFamily, Theme.of(context).textTheme.bodyLarge?.fontFamily,
), ),
hintText: L10n.of(context)!.recoveryKey, hintText: L10n.of(context).recoveryKey,
errorText: _recoveryKeyInputError, errorText: _recoveryKeyInputError,
errorMaxLines: 2, errorMaxLines: 2,
), ),
@ -279,7 +279,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
icon: _recoveryKeyInputLoading icon: _recoveryKeyInputLoading
? const CircularProgressIndicator.adaptive() ? const CircularProgressIndicator.adaptive()
: const Icon(Icons.lock_open_outlined), : const Icon(Icons.lock_open_outlined),
label: Text(L10n.of(context)!.unlockOldMessages), label: Text(L10n.of(context).unlockOldMessages),
onPressed: _recoveryKeyInputLoading onPressed: _recoveryKeyInputLoading
? null ? null
: () async { : () async {
@ -322,7 +322,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
} on FormatException catch (_) { } on FormatException catch (_) {
setState( setState(
() => _recoveryKeyInputError = () => _recoveryKeyInputError =
L10n.of(context)!.wrongRecoveryKey, L10n.of(context).wrongRecoveryKey,
); );
} catch (e, s) { } catch (e, s) {
ErrorReporter( ErrorReporter(
@ -346,7 +346,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
const Expanded(child: Divider()), const Expanded(child: Divider()),
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Text(L10n.of(context)!.or), child: Text(L10n.of(context).or),
), ),
const Expanded(child: Divider()), const Expanded(child: Divider()),
], ],
@ -354,17 +354,17 @@ class BootstrapDialogState extends State<BootstrapDialog> {
const SizedBox(height: 16), const SizedBox(height: 16),
ElevatedButton.icon( ElevatedButton.icon(
icon: const Icon(Icons.cast_connected_outlined), icon: const Icon(Icons.cast_connected_outlined),
label: Text(L10n.of(context)!.transferFromAnotherDevice), label: Text(L10n.of(context).transferFromAnotherDevice),
onPressed: _recoveryKeyInputLoading onPressed: _recoveryKeyInputLoading
? null ? null
: () async { : () async {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.verifyOtherDevice, title: L10n.of(context).verifyOtherDevice,
message: L10n.of(context)! message: L10n.of(context)
.verifyOtherDeviceDescription, .verifyOtherDeviceDescription,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;
@ -392,7 +392,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
Theme.of(context).colorScheme.onErrorContainer, Theme.of(context).colorScheme.onErrorContainer,
), ),
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
label: Text(L10n.of(context)!.recoveryKeyLost), label: Text(L10n.of(context).recoveryKeyLost),
onPressed: _recoveryKeyInputLoading onPressed: _recoveryKeyInputLoading
? null ? null
: () async { : () async {
@ -400,10 +400,10 @@ class BootstrapDialogState extends State<BootstrapDialog> {
await showOkCancelAlertDialog( await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.recoveryKeyLost, title: L10n.of(context).recoveryKeyLost,
message: L10n.of(context)!.wipeChatBackup, message: L10n.of(context).wipeChatBackup,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
isDestructiveAction: true, isDestructiveAction: true,
)) { )) {
setState(() => _createBootstrap(true)); setState(() => _createBootstrap(true));
@ -441,18 +441,18 @@ class BootstrapDialogState extends State<BootstrapDialog> {
); );
break; break;
case BootstrapState.error: case BootstrapState.error:
titleText = L10n.of(context)!.oopsSomethingWentWrong; titleText = L10n.of(context).oopsSomethingWentWrong;
body = const Icon(Icons.error_outline, color: Colors.red, size: 80); body = const Icon(Icons.error_outline, color: Colors.red, size: 80);
buttons.add( buttons.add(
OutlinedButton( OutlinedButton(
onPressed: () => onPressed: () =>
Navigator.of(context, rootNavigator: false).pop<bool>(false), Navigator.of(context, rootNavigator: false).pop<bool>(false),
child: Text(L10n.of(context)!.close), child: Text(L10n.of(context).close),
), ),
); );
break; break;
case BootstrapState.done: case BootstrapState.done:
titleText = L10n.of(context)!.everythingReady; titleText = L10n.of(context).everythingReady;
body = Column( body = Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -463,7 +463,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
L10n.of(context)!.yourChatBackupHasBeenSetUp, L10n.of(context).yourChatBackupHasBeenSetUp,
style: const TextStyle(fontSize: 20), style: const TextStyle(fontSize: 20),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -473,7 +473,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
OutlinedButton( OutlinedButton(
onPressed: () => onPressed: () =>
Navigator.of(context, rootNavigator: false).pop<bool>(false), Navigator.of(context, rootNavigator: false).pop<bool>(false),
child: Text(L10n.of(context)!.close), child: Text(L10n.of(context).close),
), ),
); );
break; break;
@ -488,7 +488,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
Navigator.of(context, rootNavigator: false).pop<bool>(true), Navigator.of(context, rootNavigator: false).pop<bool>(true),
), ),
), ),
title: Text(titleText ?? L10n.of(context)!.loadingPleaseWait), title: Text(titleText ?? L10n.of(context).loadingPleaseWait),
), ),
body: Center( body: Center(
child: Column( child: Column(

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/add_widget_tile_view.dart'; import 'package:fluffychat/pages/chat/add_widget_tile_view.dart';
class AddWidgetTile extends StatefulWidget { class AddWidgetTile extends StatefulWidget {
@ -43,14 +43,14 @@ class AddWidgetTileState extends State<AddWidgetTile> {
if (name.length < 3) { if (name.length < 3) {
setState(() { setState(() {
nameError = L10n.of(context)!.widgetNameError; nameError = L10n.of(context).widgetNameError;
}); });
return; return;
} }
if (uri == null || uri.scheme != 'https') { if (uri == null || uri.scheme != 'https') {
setState(() { setState(() {
urlError = L10n.of(context)!.widgetUrlError; urlError = L10n.of(context).widgetUrlError;
}); });
return; return;
} }
@ -75,7 +75,7 @@ class AddWidgetTileState extends State<AddWidgetTile> {
Navigator.of(context).pop(); Navigator.of(context).pop();
} catch (e) { } catch (e) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.errorAddingWidget)), SnackBar(content: Text(L10n.of(context).errorAddingWidget)),
); );
} }
} }

View file

@ -1,8 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/add_widget_tile.dart'; import 'package:fluffychat/pages/chat/add_widget_tile.dart';
class AddWidgetTileView extends StatelessWidget { class AddWidgetTileView extends StatelessWidget {
@ -13,7 +12,7 @@ class AddWidgetTileView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ExpansionTile( return ExpansionTile(
title: Text(L10n.of(context)!.addWidget), title: Text(L10n.of(context).addWidget),
leading: const Icon(Icons.add), leading: const Icon(Icons.add),
initiallyExpanded: controller.initiallyExpanded, initiallyExpanded: controller.initiallyExpanded,
children: [ children: [
@ -21,10 +20,10 @@ class AddWidgetTileView extends StatelessWidget {
groupValue: controller.widgetType, groupValue: controller.widgetType,
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
children: { children: {
'm.etherpad': Text(L10n.of(context)!.widgetEtherpad), 'm.etherpad': Text(L10n.of(context).widgetEtherpad),
'm.jitsi': Text(L10n.of(context)!.widgetJitsi), 'm.jitsi': Text(L10n.of(context).widgetJitsi),
'm.video': Text(L10n.of(context)!.widgetVideo), 'm.video': Text(L10n.of(context).widgetVideo),
'm.custom': Text(L10n.of(context)!.widgetCustom), 'm.custom': Text(L10n.of(context).widgetCustom),
}.map( }.map(
(key, value) => MapEntry( (key, value) => MapEntry(
key, key,
@ -43,7 +42,7 @@ class AddWidgetTileView extends StatelessWidget {
autofocus: true, autofocus: true,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.label), prefixIcon: const Icon(Icons.label),
label: Text(L10n.of(context)!.widgetName), label: Text(L10n.of(context).widgetName),
errorText: controller.nameError, errorText: controller.nameError,
), ),
), ),
@ -54,7 +53,7 @@ class AddWidgetTileView extends StatelessWidget {
controller: controller.urlController, controller: controller.urlController,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.add_link), prefixIcon: const Icon(Icons.add_link),
label: Text(L10n.of(context)!.link), label: Text(L10n.of(context).link),
errorText: controller.urlError, errorText: controller.urlError,
), ),
), ),
@ -63,7 +62,7 @@ class AddWidgetTileView extends StatelessWidget {
children: [ children: [
TextButton( TextButton(
onPressed: controller.addWidget, onPressed: controller.addWidget,
child: Text(L10n.of(context)!.addWidget), child: Text(L10n.of(context).addWidget),
), ),
], ],
), ),

View file

@ -10,7 +10,6 @@ import 'package:desktop_drop/desktop_drop.dart';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart'; import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
@ -23,6 +22,7 @@ import 'package:universal_html/html.dart' as html;
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/setting_keys.dart'; import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/chat_view.dart'; import 'package:fluffychat/pages/chat/chat_view.dart';
import 'package:fluffychat/pages/chat/event_info_dialog.dart'; import 'package:fluffychat/pages/chat/event_info_dialog.dart';
import 'package:fluffychat/pages/chat/recording_dialog.dart'; import 'package:fluffychat/pages/chat/recording_dialog.dart';
@ -56,12 +56,11 @@ class ChatPage extends StatelessWidget {
final room = Matrix.of(context).client.getRoomById(roomId); final room = Matrix.of(context).client.getRoomById(roomId);
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.oopsSomethingWentWrong)), appBar: AppBar(title: Text(L10n.of(context).oopsSomethingWentWrong)),
body: Center( body: Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat),
), ),
), ),
); );
@ -454,7 +453,7 @@ class ChatController extends State<ChatPageWithRoom>
final commandMatch = RegExp(r'^\/(\w+)').firstMatch(sendController.text); final commandMatch = RegExp(r'^\/(\w+)').firstMatch(sendController.text);
if (commandMatch != null && if (commandMatch != null &&
!sendingClient.commands.keys.contains(commandMatch[1]!.toLowerCase())) { !sendingClient.commands.keys.contains(commandMatch[1]!.toLowerCase())) {
final l10n = L10n.of(context)!; final l10n = L10n.of(context);
final dialogResult = await showOkCancelAlertDialog( final dialogResult = await showOkCancelAlertDialog(
context: context, context: context,
title: l10n.commandInvalid, title: l10n.commandInvalid,
@ -602,9 +601,9 @@ class ChatController extends State<ChatPageWithRoom>
if (info.version.sdkInt < 19) { if (info.version.sdkInt < 19) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.unsupportedAndroidVersion, title: L10n.of(context).unsupportedAndroidVersion,
message: L10n.of(context)!.unsupportedAndroidVersionLong, message: L10n.of(context).unsupportedAndroidVersionLong,
okLabel: L10n.of(context)!.close, okLabel: L10n.of(context).close,
); );
return; return;
} }
@ -684,12 +683,12 @@ class ChatController extends State<ChatPageWithRoom>
if (selectedEvents.length == 1) { if (selectedEvents.length == 1) {
return selectedEvents.first return selectedEvents.first
.getDisplayEvent(timeline!) .getDisplayEvent(timeline!)
.calcLocalizedBodyFallback(MatrixLocals(L10n.of(context)!)); .calcLocalizedBodyFallback(MatrixLocals(L10n.of(context)));
} }
for (final event in selectedEvents) { for (final event in selectedEvents) {
if (copyString.isNotEmpty) copyString += '\n\n'; if (copyString.isNotEmpty) copyString += '\n\n';
copyString += event.getDisplayEvent(timeline!).calcLocalizedBodyFallback( copyString += event.getDisplayEvent(timeline!).calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: true, withSenderNamePrefix: true,
); );
} }
@ -708,32 +707,32 @@ class ChatController extends State<ChatPageWithRoom>
final event = selectedEvents.single; final event = selectedEvents.single;
final score = await showConfirmationDialog<int>( final score = await showConfirmationDialog<int>(
context: context, context: context,
title: L10n.of(context)!.reportMessage, title: L10n.of(context).reportMessage,
message: L10n.of(context)!.howOffensiveIsThisContent, message: L10n.of(context).howOffensiveIsThisContent,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
actions: [ actions: [
AlertDialogAction( AlertDialogAction(
key: -100, key: -100,
label: L10n.of(context)!.extremeOffensive, label: L10n.of(context).extremeOffensive,
), ),
AlertDialogAction( AlertDialogAction(
key: -50, key: -50,
label: L10n.of(context)!.offensive, label: L10n.of(context).offensive,
), ),
AlertDialogAction( AlertDialogAction(
key: 0, key: 0,
label: L10n.of(context)!.inoffensive, label: L10n.of(context).inoffensive,
), ),
], ],
); );
if (score == null) return; if (score == null) return;
final reason = await showTextInputDialog( final reason = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.whyDoYouWantToReportThis, title: L10n.of(context).whyDoYouWantToReportThis,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)], textFields: [DialogTextField(hintText: L10n.of(context).reason)],
); );
if (reason == null || reason.single.isEmpty) return; if (reason == null || reason.single.isEmpty) return;
final result = await showFutureLoadingDialog( final result = await showFutureLoadingDialog(
@ -751,7 +750,7 @@ class ChatController extends State<ChatPageWithRoom>
selectedEvents.clear(); selectedEvents.clear();
}); });
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.contentHasBeenReported)), SnackBar(content: Text(L10n.of(context).contentHasBeenReported)),
); );
} }
@ -778,16 +777,16 @@ class ChatController extends State<ChatPageWithRoom>
final reasonInput = selectedEvents.any((event) => event.status.isSent) final reasonInput = selectedEvents.any((event) => event.status.isSent)
? await showTextInputDialog( ? await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.redactMessage, title: L10n.of(context).redactMessage,
message: L10n.of(context)!.redactMessageDescription, message: L10n.of(context).redactMessageDescription,
isDestructiveAction: true, isDestructiveAction: true,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.optionalRedactReason, hintText: L10n.of(context).optionalRedactReason,
), ),
], ],
okLabel: L10n.of(context)!.remove, okLabel: L10n.of(context).remove,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
) )
: <String>[]; : <String>[];
if (reasonInput == null) return; if (reasonInput == null) return;
@ -1038,7 +1037,7 @@ class ChatController extends State<ChatPageWithRoom>
editEvent = selectedEvents.first; editEvent = selectedEvents.first;
sendController.text = sendController.text =
editEvent!.getDisplayEvent(timeline!).calcLocalizedBodyFallback( editEvent!.getDisplayEvent(timeline!).calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: false, withSenderNamePrefix: false,
hideReply: true, hideReply: true,
); );
@ -1051,13 +1050,13 @@ class ChatController extends State<ChatPageWithRoom>
if (OkCancelResult.ok != if (OkCancelResult.ok !=
await showOkCancelAlertDialog( await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.goToTheNewRoom, title: L10n.of(context).goToTheNewRoom,
message: room message: room
.getState(EventTypes.RoomTombstone)! .getState(EventTypes.RoomTombstone)!
.parsedTombstoneContent .parsedTombstoneContent
.body, .body,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
)) { )) {
return; return;
} }
@ -1140,10 +1139,10 @@ class ChatController extends State<ChatPageWithRoom>
unpinEvent(String eventId) async { unpinEvent(String eventId) async {
final response = await showOkCancelAlertDialog( final response = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.unpin, title: L10n.of(context).unpin,
message: L10n.of(context)!.confirmEventUnpin, message: L10n.of(context).confirmEventUnpin,
okLabel: L10n.of(context)!.unpin, okLabel: L10n.of(context).unpin,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (response == OkCancelResult.ok) { if (response == OkCancelResult.ok) {
final events = room.pinnedEventIds final events = room.pinnedEventIds
@ -1237,26 +1236,26 @@ class ChatController extends State<ChatPageWithRoom>
Navigator.pop(context); Navigator.pop(context);
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.unsupportedAndroidVersion, title: L10n.of(context).unsupportedAndroidVersion,
message: L10n.of(context)!.unsupportedAndroidVersionLong, message: L10n.of(context).unsupportedAndroidVersionLong,
okLabel: L10n.of(context)!.close, okLabel: L10n.of(context).close,
); );
} }
}); });
} }
final callType = await showModalActionSheet<CallType>( final callType = await showModalActionSheet<CallType>(
context: context, context: context,
title: L10n.of(context)!.warning, title: L10n.of(context).warning,
message: L10n.of(context)!.videoCallsBetaWarning, message: L10n.of(context).videoCallsBetaWarning,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
actions: [ actions: [
SheetAction( SheetAction(
label: L10n.of(context)!.voiceCall, label: L10n.of(context).voiceCall,
icon: Icons.phone_outlined, icon: Icons.phone_outlined,
key: CallType.kVoice, key: CallType.kVoice,
), ),
SheetAction( SheetAction(
label: L10n.of(context)!.videoCall, label: L10n.of(context).videoCall,
icon: Icons.video_call_outlined, icon: Icons.video_call_outlined,
key: CallType.kVideo, key: CallType.kVideo,
), ),

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/chat.dart'; import 'package:fluffychat/pages/chat/chat.dart';
import 'package:fluffychat/utils/date_time_extension.dart'; import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
@ -36,7 +36,7 @@ class ChatAppBarTitle extends StatelessWidget {
child: Avatar( child: Avatar(
mxContent: room.avatar, mxContent: room.avatar,
name: room.getLocalizedDisplayname( name: room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
size: 32, size: 32,
), ),
@ -47,7 +47,7 @@ class ChatAppBarTitle extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
@ -63,13 +63,13 @@ class ChatAppBarTitle extends StatelessWidget {
final style = Theme.of(context).textTheme.bodySmall; final style = Theme.of(context).textTheme.bodySmall;
if (presence?.currentlyActive == true) { if (presence?.currentlyActive == true) {
return Text( return Text(
L10n.of(context)!.currentlyActive, L10n.of(context).currentlyActive,
style: style, style: style,
); );
} }
if (lastActiveTimestamp != null) { if (lastActiveTimestamp != null) {
return Text( return Text(
L10n.of(context)!.lastActiveAgo( L10n.of(context).lastActiveAgo(
lastActiveTimestamp.localizedTimeShort(context), lastActiveTimestamp.localizedTimeShort(context),
), ),
style: style, style: style,

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart'; import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/sticker_picker_dialog.dart'; import 'package:fluffychat/pages/chat/sticker_picker_dialog.dart';
import 'chat.dart'; import 'chat.dart';
@ -30,8 +30,8 @@ class ChatEmojiPicker extends StatelessWidget {
children: [ children: [
TabBar( TabBar(
tabs: [ tabs: [
Tab(text: L10n.of(context)!.emojis), Tab(text: L10n.of(context).emojis),
Tab(text: L10n.of(context)!.stickers), Tab(text: L10n.of(context).stickers),
], ],
), ),
Expanded( Expanded(
@ -59,11 +59,11 @@ class ChatEmojiPicker extends StatelessWidget {
), ),
skinToneConfig: SkinToneConfig( skinToneConfig: SkinToneConfig(
dialogBackgroundColor: Color.lerp( dialogBackgroundColor: Color.lerp(
theme.colorScheme.background, theme.colorScheme.surface,
theme.colorScheme.primaryContainer, theme.colorScheme.primaryContainer,
0.75, 0.75,
)!, )!,
indicatorColor: theme.colorScheme.onBackground, indicatorColor: theme.colorScheme.onSurface,
), ),
), ),
), ),
@ -98,7 +98,7 @@ class NoRecent extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Text( return Text(
L10n.of(context)!.emoteKeyboardNoRecents, L10n.of(context).emoteKeyboardNoRecents,
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge,
); );
} }

View file

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:animations/animations.dart'; import 'package:animations/animations.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart'; import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -43,7 +43,7 @@ class ChatInputRow extends StatelessWidget {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
const Icon(Icons.delete), const Icon(Icons.delete),
Text(L10n.of(context)!.delete), Text(L10n.of(context).delete),
], ],
), ),
), ),
@ -56,7 +56,7 @@ class ChatInputRow extends StatelessWidget {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
const Icon(Icons.keyboard_arrow_left_outlined), const Icon(Icons.keyboard_arrow_left_outlined),
Text(L10n.of(context)!.forward), Text(L10n.of(context).forward),
], ],
), ),
), ),
@ -72,7 +72,7 @@ class ChatInputRow extends StatelessWidget {
onPressed: controller.replyAction, onPressed: controller.replyAction,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text(L10n.of(context)!.reply), Text(L10n.of(context).reply),
const Icon(Icons.keyboard_arrow_right), const Icon(Icons.keyboard_arrow_right),
], ],
), ),
@ -84,7 +84,7 @@ class ChatInputRow extends StatelessWidget {
onPressed: controller.sendAgainAction, onPressed: controller.sendAgainAction,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text(L10n.of(context)!.tryToSendAgain), Text(L10n.of(context).tryToSendAgain),
const SizedBox(width: 4), const SizedBox(width: 4),
const Icon(Icons.send_outlined, size: 16), const Icon(Icons.send_outlined, size: 16),
], ],
@ -102,7 +102,7 @@ class ChatInputRow extends StatelessWidget {
}, },
onKeysPressed: () => onKeysPressed: () =>
controller.onAddPopupMenuButtonSelected('file'), controller.onAddPopupMenuButtonSelected('file'),
helpLabel: L10n.of(context)!.sendFile, helpLabel: L10n.of(context).sendFile,
child: AnimatedContainer( child: AnimatedContainer(
duration: FluffyThemes.animationDuration, duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve, curve: FluffyThemes.animationCurve,
@ -124,7 +124,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.attachment_outlined), child: Icon(Icons.attachment_outlined),
), ),
title: Text(L10n.of(context)!.sendFile), title: Text(L10n.of(context).sendFile),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -136,7 +136,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.image_outlined), child: Icon(Icons.image_outlined),
), ),
title: Text(L10n.of(context)!.sendImage), title: Text(L10n.of(context).sendImage),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -149,7 +149,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.camera_alt_outlined), child: Icon(Icons.camera_alt_outlined),
), ),
title: Text(L10n.of(context)!.openCamera), title: Text(L10n.of(context).openCamera),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -162,7 +162,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.videocam_outlined), child: Icon(Icons.videocam_outlined),
), ),
title: Text(L10n.of(context)!.openVideoCamera), title: Text(L10n.of(context).openVideoCamera),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -175,7 +175,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.gps_fixed_outlined), child: Icon(Icons.gps_fixed_outlined),
), ),
title: Text(L10n.of(context)!.shareLocation), title: Text(L10n.of(context).shareLocation),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -193,9 +193,9 @@ class ChatInputRow extends StatelessWidget {
LogicalKeyboardKey.keyE, LogicalKeyboardKey.keyE,
}, },
onKeysPressed: controller.emojiPickerAction, onKeysPressed: controller.emojiPickerAction,
helpLabel: L10n.of(context)!.emojis, helpLabel: L10n.of(context).emojis,
child: IconButton( child: IconButton(
tooltip: L10n.of(context)!.emojis, tooltip: L10n.of(context).emojis,
icon: PageTransitionSwitcher( icon: PageTransitionSwitcher(
transitionBuilder: ( transitionBuilder: (
Widget child, Widget child,
@ -254,7 +254,7 @@ class ChatInputRow extends StatelessWidget {
bottom: 6.0, bottom: 6.0,
top: 3.0, top: 3.0,
), ),
hintText: L10n.of(context)!.writeAMessage, hintText: L10n.of(context).writeAMessage,
hintMaxLines: 1, hintMaxLines: 1,
border: InputBorder.none, border: InputBorder.none,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
@ -271,7 +271,7 @@ class ChatInputRow extends StatelessWidget {
child: PlatformInfos.platformCanRecord && child: PlatformInfos.platformCanRecord &&
controller.sendController.text.isEmpty controller.sendController.text.isEmpty
? FloatingActionButton.small( ? FloatingActionButton.small(
tooltip: L10n.of(context)!.voiceMessage, tooltip: L10n.of(context).voiceMessage,
onPressed: controller.voiceMessageAction, onPressed: controller.voiceMessageAction,
elevation: 0, elevation: 0,
heroTag: null, heroTag: null,
@ -284,7 +284,7 @@ class ChatInputRow extends StatelessWidget {
child: const Icon(Icons.mic_none_outlined), child: const Icon(Icons.mic_none_outlined),
) )
: FloatingActionButton.small( : FloatingActionButton.small(
tooltip: L10n.of(context)!.send, tooltip: L10n.of(context).send,
onPressed: controller.send, onPressed: controller.send,
elevation: 0, elevation: 0,
heroTag: null, heroTag: null,

View file

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
import 'package:badges/badges.dart'; import 'package:badges/badges.dart';
import 'package:desktop_drop/desktop_drop.dart'; import 'package:desktop_drop/desktop_drop.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/chat.dart'; import 'package:fluffychat/pages/chat/chat.dart';
import 'package:fluffychat/pages/chat/chat_app_bar_list_tile.dart'; import 'package:fluffychat/pages/chat/chat_app_bar_list_tile.dart';
import 'package:fluffychat/pages/chat/chat_app_bar_title.dart'; import 'package:fluffychat/pages/chat/chat_app_bar_title.dart';
@ -38,12 +38,12 @@ class ChatView extends StatelessWidget {
if (controller.canEditSelectedEvents) if (controller.canEditSelectedEvents)
IconButton( IconButton(
icon: const Icon(Icons.edit_outlined), icon: const Icon(Icons.edit_outlined),
tooltip: L10n.of(context)!.edit, tooltip: L10n.of(context).edit,
onPressed: controller.editSelectedEventAction, onPressed: controller.editSelectedEventAction,
), ),
IconButton( IconButton(
icon: const Icon(Icons.copy_outlined), icon: const Icon(Icons.copy_outlined),
tooltip: L10n.of(context)!.copy, tooltip: L10n.of(context).copy,
onPressed: controller.copyEventsAction, onPressed: controller.copyEventsAction,
), ),
if (controller.canSaveSelectedEvent) if (controller.canSaveSelectedEvent)
@ -51,7 +51,7 @@ class ChatView extends StatelessWidget {
Builder( Builder(
builder: (context) => IconButton( builder: (context) => IconButton(
icon: Icon(Icons.adaptive.share), icon: Icon(Icons.adaptive.share),
tooltip: L10n.of(context)!.share, tooltip: L10n.of(context).share,
onPressed: () => controller.saveSelectedEvent(context), onPressed: () => controller.saveSelectedEvent(context),
), ),
), ),
@ -59,12 +59,12 @@ class ChatView extends StatelessWidget {
IconButton( IconButton(
icon: const Icon(Icons.push_pin_outlined), icon: const Icon(Icons.push_pin_outlined),
onPressed: controller.pinEvent, onPressed: controller.pinEvent,
tooltip: L10n.of(context)!.pinMessage, tooltip: L10n.of(context).pinMessage,
), ),
if (controller.canRedactSelectedEvents) if (controller.canRedactSelectedEvents)
IconButton( IconButton(
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
tooltip: L10n.of(context)!.redactMessage, tooltip: L10n.of(context).redactMessage,
onPressed: controller.redactEventsAction, onPressed: controller.redactEventsAction,
), ),
if (controller.selectedEvents.length == 1) if (controller.selectedEvents.length == 1)
@ -88,7 +88,7 @@ class ChatView extends StatelessWidget {
children: [ children: [
const Icon(Icons.info_outlined), const Icon(Icons.info_outlined),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.messageInfo), Text(L10n.of(context).messageInfo),
], ],
), ),
), ),
@ -103,7 +103,7 @@ class ChatView extends StatelessWidget {
color: Colors.red, color: Colors.red,
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.reportMessage), Text(L10n.of(context).reportMessage),
], ],
), ),
), ),
@ -117,7 +117,7 @@ class ChatView extends StatelessWidget {
IconButton( IconButton(
onPressed: controller.onPhoneButtonTap, onPressed: controller.onPhoneButtonTap,
icon: const Icon(Icons.call_outlined), icon: const Icon(Icons.call_outlined),
tooltip: L10n.of(context)!.placeCall, tooltip: L10n.of(context).placeCall,
), ),
EncryptionButton(controller.room), EncryptionButton(controller.room),
ChatSettingsPopupMenu(controller.room, true), ChatSettingsPopupMenu(controller.room, true),
@ -179,7 +179,7 @@ class ChatView extends StatelessWidget {
? IconButton( ? IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: controller.clearSelectedEvents, onPressed: controller.clearSelectedEvents,
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
) )
: UnreadRoomsBadge( : UnreadRoomsBadge(
@ -205,7 +205,7 @@ class ChatView extends StatelessWidget {
), ),
trailing: TextButton( trailing: TextButton(
onPressed: controller.goToNewRoomAction, onPressed: controller.goToNewRoomAction,
child: Text(L10n.of(context)!.goToTheNewRoom), child: Text(L10n.of(context).goToTheNewRoom),
), ),
), ),
if (scrollUpBannerEventId != null) if (scrollUpBannerEventId != null)
@ -214,13 +214,13 @@ class ChatView extends StatelessWidget {
color: color:
Theme.of(context).colorScheme.onSurfaceVariant, Theme.of(context).colorScheme.onSurfaceVariant,
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
onPressed: () { onPressed: () {
controller.discardScrollUpBannerEventId(); controller.discardScrollUpBannerEventId();
controller.setReadMarker(); controller.setReadMarker();
}, },
), ),
title: L10n.of(context)!.jumpToLastReadMessage, title: L10n.of(context).jumpToLastReadMessage,
trailing: TextButton( trailing: TextButton(
onPressed: () { onPressed: () {
controller.scrollToEventId( controller.scrollToEventId(
@ -228,7 +228,7 @@ class ChatView extends StatelessWidget {
); );
controller.discardScrollUpBannerEventId(); controller.discardScrollUpBannerEventId();
}, },
child: Text(L10n.of(context)!.jump), child: Text(L10n.of(context).jump),
), ),
), ),
], ],
@ -303,7 +303,7 @@ class ChatView extends StatelessWidget {
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.surfaceVariant, .surfaceContainerHighest,
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(
Radius.circular(24), Radius.circular(24),
), ),
@ -326,7 +326,7 @@ class ChatView extends StatelessWidget {
), ),
onPressed: controller.leaveChat, onPressed: controller.leaveChat,
label: Text( label: Text(
L10n.of(context)!.leave, L10n.of(context).leave,
), ),
), ),
TextButton.icon( TextButton.icon(
@ -340,7 +340,7 @@ class ChatView extends StatelessWidget {
), ),
onPressed: controller.recreateChat, onPressed: controller.recreateChat,
label: Text( label: Text(
L10n.of(context)!.reopenChat, L10n.of(context).reopenChat,
), ),
), ),
], ],

View file

@ -1,6 +1,6 @@
// This file is auto-generated using scripts/generate_command_hints_glue.sh. // This file is auto-generated using scripts/generate_command_hints_glue.sh.
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:fluffychat/l10n/l10n.dart';
String commandExample(String command) { String commandExample(String command) {
switch (command) { switch (command) {

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
class EncryptionButton extends StatelessWidget { class EncryptionButton extends StatelessWidget {
@ -25,8 +25,8 @@ class EncryptionButton extends StatelessWidget {
: Future.value(EncryptionHealthState.allVerified), : Future.value(EncryptionHealthState.allVerified),
builder: (BuildContext context, snapshot) => IconButton( builder: (BuildContext context, snapshot) => IconButton(
tooltip: room.encrypted tooltip: room.encrypted
? L10n.of(context)!.encrypted ? L10n.of(context).encrypted
: L10n.of(context)!.encryptionNotEnabled, : L10n.of(context).encryptionNotEnabled,
icon: Icon( icon: Icon(
room.encrypted ? Icons.lock_outlined : Icons.lock_open_outlined, room.encrypted ? Icons.lock_outlined : Icons.lock_open_outlined,
size: 20, size: 20,

View file

@ -2,10 +2,10 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart'; import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
import 'package:fluffychat/utils/date_time_extension.dart'; import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
@ -14,7 +14,7 @@ extension EventInfoDialogExtension on Event {
void showInfoDialog(BuildContext context) => showAdaptiveBottomSheet( void showInfoDialog(BuildContext context) => showAdaptiveBottomSheet(
context: context, context: context,
builder: (context) => builder: (context) =>
EventInfoDialog(l10n: L10n.of(context)!, event: this), EventInfoDialog(l10n: L10n.of(context), event: this),
); );
} }
@ -38,11 +38,11 @@ class EventInfoDialog extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.messageInfo), title: Text(L10n.of(context).messageInfo),
leading: IconButton( leading: IconButton(
icon: const Icon(Icons.arrow_downward_outlined), icon: const Icon(Icons.arrow_downward_outlined),
onPressed: Navigator.of(context, rootNavigator: false).pop, onPressed: Navigator.of(context, rootNavigator: false).pop,
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
), ),
), ),
body: ListView( body: ListView(
@ -54,20 +54,20 @@ class EventInfoDialog extends StatelessWidget {
client: event.room.client, client: event.room.client,
presenceUserId: event.senderId, presenceUserId: event.senderId,
), ),
title: Text(L10n.of(context)!.sender), title: Text(L10n.of(context).sender),
subtitle: Text( subtitle: Text(
'${event.senderFromMemoryOrFallback.calcDisplayname()} [${event.senderId}]', '${event.senderFromMemoryOrFallback.calcDisplayname()} [${event.senderId}]',
), ),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.time), title: Text(L10n.of(context).time),
subtitle: Text(event.originServerTs.localizedTime(context)), subtitle: Text(event.originServerTs.localizedTime(context)),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.messageType), title: Text(L10n.of(context).messageType),
subtitle: Text(event.humanreadableType), subtitle: Text(event.humanreadableType),
), ),
ListTile(title: Text('${L10n.of(context)!.sourceCode}:')), ListTile(title: Text('${L10n.of(context).sourceCode}:')),
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Material( child: Material(

View file

@ -2,10 +2,10 @@ import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
class CuteContent extends StatefulWidget { class CuteContent extends StatefulWidget {
final Event event; final Event event;
@ -72,19 +72,19 @@ class _CuteContentState extends State<CuteContent> {
generateLabel(User? user) { generateLabel(User? user) {
switch (widget.event.content['cute_type']) { switch (widget.event.content['cute_type']) {
case 'googly_eyes': case 'googly_eyes':
return L10n.of(context)?.googlyEyesContent( return L10n.of(context).googlyEyesContent(
user?.displayName ?? user?.displayName ??
widget.event.senderFromMemoryOrFallback.displayName ?? widget.event.senderFromMemoryOrFallback.displayName ??
'', '',
); );
case 'cuddle': case 'cuddle':
return L10n.of(context)?.cuddleContent( return L10n.of(context).cuddleContent(
user?.displayName ?? user?.displayName ??
widget.event.senderFromMemoryOrFallback.displayName ?? widget.event.senderFromMemoryOrFallback.displayName ??
'', '',
); );
case 'hug': case 'hug':
return L10n.of(context)?.hugContent( return L10n.of(context).hugContent(
user?.displayName ?? user?.displayName ??
widget.event.senderFromMemoryOrFallback.displayName ?? widget.event.senderFromMemoryOrFallback.displayName ??
'', '',

View file

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:swipe_to_action/swipe_to_action.dart'; import 'package:swipe_to_action/swipe_to_action.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/date_time_extension.dart'; import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/utils/string_color.dart'; import 'package:fluffychat/utils/string_color.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
@ -77,7 +77,7 @@ class Message extends StatelessWidget {
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
final ownMessage = event.senderId == client.userID; final ownMessage = event.senderId == client.userID;
final alignment = ownMessage ? Alignment.topRight : Alignment.topLeft; final alignment = ownMessage ? Alignment.topRight : Alignment.topLeft;
var color = Theme.of(context).colorScheme.surfaceVariant; var color = Theme.of(context).colorScheme.surfaceContainerHighest;
final displayTime = event.type == EventTypes.RoomCreate || final displayTime = event.type == EventTypes.RoomCreate ||
nextEvent == null || nextEvent == null ||
!event.originServerTs.sameEnvironment(nextEvent!.originServerTs); !event.originServerTs.sameEnvironment(nextEvent!.originServerTs);
@ -101,7 +101,7 @@ class Message extends StatelessWidget {
final textColor = ownMessage final textColor = ownMessage
? Theme.of(context).colorScheme.onPrimary ? Theme.of(context).colorScheme.onPrimary
: Theme.of(context).colorScheme.onBackground; : Theme.of(context).colorScheme.onSurface;
final rowMainAxisAlignment = final rowMainAxisAlignment =
ownMessage ? MainAxisAlignment.end : MainAxisAlignment.start; ownMessage ? MainAxisAlignment.end : MainAxisAlignment.start;
@ -236,7 +236,9 @@ class Message extends StatelessWidget {
if (!nextEventSameSender) if (!nextEventSameSender)
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 8.0, bottom: 4), left: 8.0,
bottom: 4,
),
child: ownMessage || event.room.isDirectChat child: ownMessage || event.room.isDirectChat
? const SizedBox(height: 12) ? const SizedBox(height: 12)
: FutureBuilder<User?>( : FutureBuilder<User?>(
@ -315,8 +317,10 @@ class Message extends StatelessWidget {
FutureBuilder<Event?>( FutureBuilder<Event?>(
future: event future: event
.getReplyEvent(timeline), .getReplyEvent(timeline),
builder: (BuildContext context, builder: (
snapshot) { BuildContext context,
snapshot,
) {
final replyEvent = snapshot final replyEvent = snapshot
.hasData .hasData
? snapshot.data! ? snapshot.data!
@ -430,11 +434,8 @@ class Message extends StatelessWidget {
child: Center( child: Center(
child: Material( child: Material(
color: displayTime color: displayTime
? Theme.of(context).colorScheme.background ? Theme.of(context).colorScheme.surface
: Theme.of(context) : Theme.of(context).colorScheme.surface.withOpacity(0.33),
.colorScheme
.background
.withOpacity(0.33),
borderRadius: borderRadius:
BorderRadius.circular(AppConfig.borderRadius / 2), BorderRadius.circular(AppConfig.borderRadius / 2),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
@ -486,7 +487,7 @@ class Message extends StatelessWidget {
horizontal: 8, horizontal: 8,
), ),
child: Text( child: Text(
L10n.of(context)!.readUpToHere, L10n.of(context).readUpToHere,
style: style:
TextStyle(color: Theme.of(context).colorScheme.primary), TextStyle(color: Theme.of(context).colorScheme.primary),
), ),

View file

@ -2,10 +2,10 @@ import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_linkify/flutter_linkify.dart'; import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/events/video_player.dart'; import 'package:fluffychat/pages/chat/events/video_player.dart';
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart'; import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
import 'package:fluffychat/utils/date_time_extension.dart'; import 'package:fluffychat/utils/date_time_extension.dart';
@ -38,7 +38,7 @@ class MessageContent extends StatelessWidget {
}); });
void _verifyOrRequestKey(BuildContext context) async { void _verifyOrRequestKey(BuildContext context) async {
final l10n = L10n.of(context)!; final l10n = L10n.of(context);
if (event.content['can_request_session'] != true) { if (event.content['can_request_session'] != true) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
@ -183,7 +183,7 @@ class MessageContent extends StatelessWidget {
textColor: buttonTextColor, textColor: buttonTextColor,
onPressed: () => _verifyOrRequestKey(context), onPressed: () => _verifyOrRequestKey(context),
icon: '🔒', icon: '🔒',
label: L10n.of(context)!.encrypted, label: L10n.of(context).encrypted,
fontSize: fontSize, fontSize: fontSize,
); );
case MessageTypes.Location: case MessageTypes.Location:
@ -212,7 +212,7 @@ class MessageContent extends StatelessWidget {
onPressed: onPressed:
UrlLauncher(context, geoUri.toString()).launchUrl, UrlLauncher(context, geoUri.toString()).launchUrl,
label: Text( label: Text(
L10n.of(context)!.openInMaps, L10n.of(context).openInMaps,
style: TextStyle(color: textColor), style: TextStyle(color: textColor),
), ),
), ),
@ -232,11 +232,11 @@ class MessageContent extends StatelessWidget {
event.redactedBecause?.content.tryGet<String>('reason'); event.redactedBecause?.content.tryGet<String>('reason');
final redactedBy = snapshot.data?.calcDisplayname() ?? final redactedBy = snapshot.data?.calcDisplayname() ??
event.redactedBecause?.senderId.localpart ?? event.redactedBecause?.senderId.localpart ??
L10n.of(context)!.user; L10n.of(context).user;
return _ButtonContent( return _ButtonContent(
label: reason == null label: reason == null
? L10n.of(context)!.redactedBy(redactedBy) ? L10n.of(context).redactedBy(redactedBy)
: L10n.of(context)!.redactedByBecause( : L10n.of(context).redactedByBecause(
redactedBy, redactedBy,
reason, reason,
), ),
@ -253,7 +253,7 @@ class MessageContent extends StatelessWidget {
event.numberEmotes <= 10; event.numberEmotes <= 10;
return Linkify( return Linkify(
text: event.calcLocalizedBodyFallback( text: event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
hideReply: true, hideReply: true,
), ),
style: TextStyle( style: TextStyle(
@ -276,7 +276,7 @@ class MessageContent extends StatelessWidget {
future: event.fetchSenderUser(), future: event.fetchSenderUser(),
builder: (context, snapshot) { builder: (context, snapshot) {
return _ButtonContent( return _ButtonContent(
label: L10n.of(context)!.startedACall( label: L10n.of(context).startedACall(
snapshot.data?.calcDisplayname() ?? snapshot.data?.calcDisplayname() ??
event.senderFromMemoryOrFallback.calcDisplayname(), event.senderFromMemoryOrFallback.calcDisplayname(),
), ),
@ -292,7 +292,7 @@ class MessageContent extends StatelessWidget {
future: event.fetchSenderUser(), future: event.fetchSenderUser(),
builder: (context, snapshot) { builder: (context, snapshot) {
return _ButtonContent( return _ButtonContent(
label: L10n.of(context)!.userSentUnknownEvent( label: L10n.of(context).userSentUnknownEvent(
snapshot.data?.calcDisplayname() ?? snapshot.data?.calcDisplayname() ??
event.senderFromMemoryOrFallback.calcDisplayname(), event.senderFromMemoryOrFallback.calcDisplayname(),
event.type, event.type,

View file

@ -111,7 +111,7 @@ class _Reaction extends StatelessWidget {
final textColor = Theme.of(context).brightness == Brightness.dark final textColor = Theme.of(context).brightness == Brightness.dark
? Colors.white ? Colors.white
: Colors.black; : Colors.black;
final color = Theme.of(context).colorScheme.background; final color = Theme.of(context).colorScheme.surface;
Widget content; Widget content;
if (reactionKey.startsWith('mxc://')) { if (reactionKey.startsWith('mxc://')) {
content = Row( content = Row(

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import '../../../config/app_config.dart'; import '../../../config/app_config.dart';
@ -39,7 +39,7 @@ class ReplyContent extends StatelessWidget {
color: backgroundColor ?? color: backgroundColor ??
Theme.of(context) Theme.of(context)
.colorScheme .colorScheme
.background .surface
.withOpacity(ownMessage ? 0.2 : 0.33), .withOpacity(ownMessage ? 0.2 : 0.33),
borderRadius: borderRadius, borderRadius: borderRadius,
child: Row( child: Row(
@ -73,7 +73,7 @@ class ReplyContent extends StatelessWidget {
), ),
Text( Text(
displayEvent.calcLocalizedBodyFallback( displayEvent.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: false, withSenderNamePrefix: false,
hideReply: true, hideReply: true,
), ),
@ -82,7 +82,7 @@ class ReplyContent extends StatelessWidget {
style: TextStyle( style: TextStyle(
color: ownMessage color: ownMessage
? Theme.of(context).colorScheme.onPrimary ? Theme.of(context).colorScheme.onPrimary
: Theme.of(context).colorScheme.onBackground, : Theme.of(context).colorScheme.onSurface,
fontSize: fontSize, fontSize: fontSize,
), ),
), ),

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import '../../../config/app_config.dart'; import '../../../config/app_config.dart';
@ -18,12 +18,12 @@ class StateMessage extends StatelessWidget {
child: Container( child: Container(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2), borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
), ),
child: Text( child: Text(
event.calcLocalizedBodyFallback( event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import '../../../config/app_config.dart'; import '../../../config/app_config.dart';
class VerificationRequestContent extends StatelessWidget { class VerificationRequestContent extends StatelessWidget {
@ -39,7 +39,7 @@ class VerificationRequestContent extends StatelessWidget {
color: Theme.of(context).dividerColor, color: Theme.of(context).dividerColor,
), ),
borderRadius: BorderRadius.circular(AppConfig.borderRadius), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.surface,
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -56,10 +56,10 @@ class VerificationRequestContent extends StatelessWidget {
canceled canceled
? 'Error ${cancel.first.content.tryGet<String>('code')}: ${cancel.first.content.tryGet<String>('reason')}' ? 'Error ${cancel.first.content.tryGet<String>('code')}: ${cancel.first.content.tryGet<String>('reason')}'
: (fullyDone : (fullyDone
? L10n.of(context)!.verifySuccess ? L10n.of(context).verifySuccess
: (started : (started
? L10n.of(context)!.loadingPleaseWait ? L10n.of(context).loadingPleaseWait
: L10n.of(context)!.newVerificationRequest)), : L10n.of(context).newVerificationRequest)),
), ),
], ],
), ),

View file

@ -4,13 +4,13 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:chewie/chewie.dart'; import 'package:chewie/chewie.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:universal_html/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'package:video_player/video_player.dart'; import 'package:video_player/video_player.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/events/image_bubble.dart'; import 'package:fluffychat/pages/chat/events/image_bubble.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
@ -123,8 +123,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
Center( Center(
child: IconButton( child: IconButton(
style: IconButton.styleFrom( style: IconButton.styleFrom(
backgroundColor: backgroundColor: Theme.of(context).colorScheme.surface,
Theme.of(context).colorScheme.background,
), ),
icon: _isDownloading icon: _isDownloading
? const SizedBox( ? const SizedBox(
@ -136,8 +135,8 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
) )
: const Icon(Icons.play_circle_outlined), : const Icon(Icons.play_circle_outlined),
tooltip: _isDownloading tooltip: _isDownloading
? L10n.of(context)!.loadingPleaseWait ? L10n.of(context).loadingPleaseWait
: L10n.of(context)!.videoWithSize( : L10n.of(context).videoWithSize(
widget.event.sizeString ?? '?MB', widget.event.sizeString ?? '?MB',
), ),
onPressed: _isDownloading ? null : _downloadAction, onPressed: _isDownloading ? null : _downloadAction,

View file

@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:emojis/emoji.dart'; import 'package:emojis/emoji.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart'; import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:pasteboard/pasteboard.dart'; import 'package:pasteboard/pasteboard.dart';
import 'package:slugify/slugify.dart'; import 'package:slugify/slugify.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/mxc_image.dart'; import 'package:fluffychat/widgets/mxc_image.dart';
@ -226,7 +226,7 @@ class InputBar extends StatelessWidget {
const padding = EdgeInsets.all(4.0); const padding = EdgeInsets.all(4.0);
if (suggestion['type'] == 'command') { if (suggestion['type'] == 'command') {
final command = suggestion['name']!; final command = suggestion['name']!;
final hint = commandHint(L10n.of(context)!, command); final hint = commandHint(L10n.of(context), command);
return Tooltip( return Tooltip(
message: hint, message: hint,
waitDuration: const Duration(days: 1), // don't show on hover waitDuration: const Duration(days: 1), // don't show on hover

View file

@ -3,10 +3,10 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/chat.dart'; import 'package:fluffychat/pages/chat/chat.dart';
import 'package:fluffychat/pages/chat/chat_app_bar_list_tile.dart'; import 'package:fluffychat/pages/chat/chat_app_bar_list_tile.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
@ -32,13 +32,13 @@ class PinnedEvents extends StatelessWidget {
? events.single?.eventId ? events.single?.eventId
: await showConfirmationDialog<String>( : await showConfirmationDialog<String>(
context: context, context: context,
title: L10n.of(context)!.pinMessage, title: L10n.of(context).pinMessage,
actions: events actions: events
.map( .map(
(event) => AlertDialogAction( (event) => AlertDialogAction(
key: event?.eventId ?? '', key: event?.eventId ?? '',
label: event?.calcLocalizedBodyFallback( label: event?.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: true, withSenderNamePrefix: true,
hideReply: true, hideReply: true,
) ?? ) ??
@ -65,17 +65,17 @@ class PinnedEvents extends StatelessWidget {
final event = snapshot.data; final event = snapshot.data;
return ChatAppBarListTile( return ChatAppBarListTile(
title: event?.calcLocalizedBodyFallback( title: event?.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: true, withSenderNamePrefix: true,
hideReply: true, hideReply: true,
) ?? ) ??
L10n.of(context)!.loadingPleaseWait, L10n.of(context).loadingPleaseWait,
leading: IconButton( leading: IconButton(
splashRadius: 20, splashRadius: 20,
iconSize: 20, iconSize: 20,
color: Theme.of(context).colorScheme.onSurfaceVariant, color: Theme.of(context).colorScheme.onSurfaceVariant,
icon: const Icon(Icons.push_pin), icon: const Icon(Icons.push_pin),
tooltip: L10n.of(context)!.unpin, tooltip: L10n.of(context).unpin,
onPressed: controller.room.canSendEvent(EventTypes.RoomPinnedEvents) onPressed: controller.room.canSendEvent(EventTypes.RoomPinnedEvents)
? () => controller.unpinEvent(event!.eventId) ? () => controller.unpinEvent(event!.eventId)
: null, : null,

View file

@ -3,12 +3,12 @@ import 'dart:async';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:record/record.dart'; import 'package:record/record.dart';
import 'package:wakelock_plus/wakelock_plus.dart'; import 'package:wakelock_plus/wakelock_plus.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'events/audio_player.dart'; import 'events/audio_player.dart';
@ -117,7 +117,7 @@ class RecordingDialogState extends State<RecordingDialog> {
final time = final time =
'${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}'; '${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}';
final content = error final content = error
? Text(L10n.of(context)!.oopsSomethingWentWrong) ? Text(L10n.of(context).oopsSomethingWentWrong)
: Row( : Row(
children: [ children: [
Container( Container(
@ -165,7 +165,7 @@ class RecordingDialogState extends State<RecordingDialog> {
CupertinoDialogAction( CupertinoDialogAction(
onPressed: () => Navigator.of(context, rootNavigator: false).pop(), onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
child: Text( child: Text(
L10n.of(context)!.cancel.toUpperCase(), L10n.of(context).cancel.toUpperCase(),
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: Theme.of(context)
.textTheme .textTheme
@ -178,7 +178,7 @@ class RecordingDialogState extends State<RecordingDialog> {
if (error != true) if (error != true)
CupertinoDialogAction( CupertinoDialogAction(
onPressed: _stopAndSend, onPressed: _stopAndSend,
child: Text(L10n.of(context)!.send.toUpperCase()), child: Text(L10n.of(context).send.toUpperCase()),
), ),
], ],
); );
@ -189,7 +189,7 @@ class RecordingDialogState extends State<RecordingDialog> {
TextButton( TextButton(
onPressed: () => Navigator.of(context, rootNavigator: false).pop(), onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
child: Text( child: Text(
L10n.of(context)!.cancel.toUpperCase(), L10n.of(context).cancel.toUpperCase(),
style: TextStyle( style: TextStyle(
color: color:
Theme.of(context).textTheme.bodyMedium?.color?.withAlpha(150), Theme.of(context).textTheme.bodyMedium?.color?.withAlpha(150),
@ -202,7 +202,7 @@ class RecordingDialogState extends State<RecordingDialog> {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Text(L10n.of(context)!.send.toUpperCase()), Text(L10n.of(context).send.toUpperCase()),
const SizedBox(width: 4), const SizedBox(width: 4),
const Icon(Icons.send_outlined, size: 15), const Icon(Icons.send_outlined, size: 15),
], ],

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import '../../config/themes.dart'; import '../../config/themes.dart';
import 'chat.dart'; import 'chat.dart';
@ -27,7 +27,7 @@ class ReplyDisplay extends StatelessWidget {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
IconButton( IconButton(
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: controller.cancelReplyEventAction, onPressed: controller.cancelReplyEventAction,
), ),
@ -68,7 +68,7 @@ class _EditContent extends StatelessWidget {
Container(width: 15.0), Container(width: 15.0),
Text( Text(
event.calcLocalizedBodyFallback( event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: false, withSenderNamePrefix: false,
hideReply: true, hideReply: true,
), ),

View file

@ -50,7 +50,7 @@ class SeenByRow extends StatelessWidget {
width: 16, width: 16,
height: 16, height: 16,
child: Material( child: Material(
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
child: Center( child: Center(
child: Text( child: Text(

View file

@ -1,11 +1,11 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/utils/size_string.dart'; import 'package:fluffychat/utils/size_string.dart';
import '../../utils/resize_image.dart'; import '../../utils/resize_image.dart';
@ -63,7 +63,7 @@ class SendFileDialogState extends State<SendFileDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var sendStr = L10n.of(context)!.sendFile; var sendStr = L10n.of(context).sendFile;
final bool allFilesAreImages = final bool allFilesAreImages =
widget.files.every((file) => file is MatrixImageFile); widget.files.every((file) => file is MatrixImageFile);
final sizeString = widget.files final sizeString = widget.files
@ -71,14 +71,14 @@ class SendFileDialogState extends State<SendFileDialog> {
.sizeString; .sizeString;
final fileName = widget.files.length == 1 final fileName = widget.files.length == 1
? widget.files.single.name ? widget.files.single.name
: L10n.of(context)!.countFiles(widget.files.length.toString()); : L10n.of(context).countFiles(widget.files.length.toString());
if (allFilesAreImages) { if (allFilesAreImages) {
sendStr = L10n.of(context)!.sendImage; sendStr = L10n.of(context).sendImage;
} else if (widget.files.every((file) => file is MatrixAudioFile)) { } else if (widget.files.every((file) => file is MatrixAudioFile)) {
sendStr = L10n.of(context)!.sendAudio; sendStr = L10n.of(context).sendAudio;
} else if (widget.files.every((file) => file is MatrixVideoFile)) { } else if (widget.files.every((file) => file is MatrixVideoFile)) {
sendStr = L10n.of(context)!.sendVideo; sendStr = L10n.of(context).sendVideo;
} }
Widget contentWidget; Widget contentWidget;
if (allFilesAreImages) { if (allFilesAreImages) {
@ -115,7 +115,7 @@ class SendFileDialogState extends State<SendFileDialog> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
L10n.of(context)!.sendOriginal, L10n.of(context).sendOriginal,
style: const TextStyle(fontWeight: FontWeight.bold), style: const TextStyle(fontWeight: FontWeight.bold),
), ),
Text(sizeString), Text(sizeString),
@ -147,7 +147,7 @@ class SendFileDialogState extends State<SendFileDialog> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
L10n.of(context)!.sendOriginal, L10n.of(context).sendOriginal,
style: const TextStyle(fontWeight: FontWeight.bold), style: const TextStyle(fontWeight: FontWeight.bold),
), ),
Text(sizeString), Text(sizeString),
@ -170,11 +170,11 @@ class SendFileDialogState extends State<SendFileDialog> {
// just close the dialog // just close the dialog
Navigator.of(context, rootNavigator: false).pop(); Navigator.of(context, rootNavigator: false).pop();
}, },
child: Text(L10n.of(context)!.cancel), child: Text(L10n.of(context).cancel),
), ),
TextButton( TextButton(
onPressed: _send, onPressed: _send,
child: Text(L10n.of(context)!.send), child: Text(L10n.of(context).send),
), ),
], ],
); );

View file

@ -3,11 +3,11 @@ import 'dart:async';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/events/map_bubble.dart'; import 'package:fluffychat/pages/chat/events/map_bubble.dart';
class SendLocationDialog extends StatefulWidget { class SendLocationDialog extends StatefulWidget {
@ -93,12 +93,12 @@ class SendLocationDialogState extends State<SendLocationDialog> {
longitude: position!.longitude, longitude: position!.longitude,
); );
} else if (disabled) { } else if (disabled) {
contentWidget = Text(L10n.of(context)!.locationDisabledNotice); contentWidget = Text(L10n.of(context).locationDisabledNotice);
} else if (denied) { } else if (denied) {
contentWidget = Text(L10n.of(context)!.locationPermissionDeniedNotice); contentWidget = Text(L10n.of(context).locationPermissionDeniedNotice);
} else if (error != null) { } else if (error != null) {
contentWidget = contentWidget =
Text(L10n.of(context)!.errorObtainingLocation(error.toString())); Text(L10n.of(context).errorObtainingLocation(error.toString()));
} else { } else {
contentWidget = Row( contentWidget = Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -106,22 +106,22 @@ class SendLocationDialogState extends State<SendLocationDialog> {
children: [ children: [
const CupertinoActivityIndicator(), const CupertinoActivityIndicator(),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.obtainingLocation), Text(L10n.of(context).obtainingLocation),
], ],
); );
} }
return AlertDialog.adaptive( return AlertDialog.adaptive(
title: Text(L10n.of(context)!.shareLocation), title: Text(L10n.of(context).shareLocation),
content: contentWidget, content: contentWidget,
actions: [ actions: [
TextButton( TextButton(
onPressed: Navigator.of(context, rootNavigator: false).pop, onPressed: Navigator.of(context, rootNavigator: false).pop,
child: Text(L10n.of(context)!.cancel), child: Text(L10n.of(context).cancel),
), ),
if (position != null) if (position != null)
TextButton( TextButton(
onPressed: isSending ? null : sendAction, onPressed: isSending ? null : sendAction,
child: Text(L10n.of(context)!.send), child: Text(L10n.of(context).send),
), ),
], ],
); );

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/url_launcher.dart'; import 'package:fluffychat/utils/url_launcher.dart';
import 'package:fluffychat/widgets/mxc_image.dart'; import 'package:fluffychat/widgets/mxc_image.dart';
import '../../widgets/avatar.dart'; import '../../widgets/avatar.dart';
@ -115,7 +115,7 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
child: TextField( child: TextField(
autofocus: false, autofocus: false,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.search, hintText: L10n.of(context).search,
prefixIcon: const Icon(Icons.search_outlined), prefixIcon: const Icon(Icons.search_outlined),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
), ),
@ -129,7 +129,7 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text(L10n.of(context)!.noEmotesFound), Text(L10n.of(context).noEmotesFound),
const SizedBox(height: 12), const SizedBox(height: 12),
OutlinedButton.icon( OutlinedButton.icon(
onPressed: () => UrlLauncher( onPressed: () => UrlLauncher(
@ -137,7 +137,7 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
'https://matrix.to/#/#fluffychat-stickers:janian.de', 'https://matrix.to/#/#fluffychat-stickers:janian.de',
).launchUrl(), ).launchUrl(),
icon: const Icon(Icons.explore_outlined), icon: const Icon(Icons.explore_outlined),
label: Text(L10n.of(context)!.discover), label: Text(L10n.of(context).discover),
), ),
], ],
), ),

View file

@ -72,7 +72,7 @@ class TypingIndicators extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.only(top: topPadding), padding: const EdgeInsets.only(top: topPadding),
child: Material( child: Material(
color: Theme.of(context).colorScheme.surfaceVariant, color: Theme.of(context).colorScheme.surfaceContainerHighest,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(2), topLeft: Radius.circular(2),
topRight: Radius.circular(AppConfig.borderRadius), topRight: Radius.circular(AppConfig.borderRadius),

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart' hide Visibility; import 'package:flutter/material.dart' hide Visibility;
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_access_settings/chat_access_settings_page.dart'; import 'package:fluffychat/pages/chat_access_settings/chat_access_settings_page.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -121,7 +121,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
if (capabilities == null) return; if (capabilities == null) return;
final newVersion = await showConfirmationDialog<String>( final newVersion = await showConfirmationDialog<String>(
context: context, context: context,
title: L10n.of(context)!.replaceRoomWithNewerVersion, title: L10n.of(context).replaceRoomWithNewerVersion,
actions: capabilities.mRoomVersions!.available.entries actions: capabilities.mRoomVersions!.available.entries
.where((r) => r.key != roomVersion) .where((r) => r.key != roomVersion)
.map( .map(
@ -138,10 +138,10 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
await showOkCancelAlertDialog( await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
message: L10n.of(context)!.roomUpgradeDescription, message: L10n.of(context).roomUpgradeDescription,
isDestructiveAction: true, isDestructiveAction: true,
)) { )) {
return; return;
@ -160,12 +160,12 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.editRoomAliases, title: L10n.of(context).editRoomAliases,
textFields: [ textFields: [
DialogTextField( DialogTextField(
prefixText: '#', prefixText: '#',
suffixText: domain, suffixText: domain,
hintText: L10n.of(context)!.alias, hintText: L10n.of(context).alias,
), ),
], ],
); );
@ -184,10 +184,10 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
final canonicalAliasConsent = await showOkCancelAlertDialog( final canonicalAliasConsent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.setAsCanonicalAlias, title: L10n.of(context).setAsCanonicalAlias,
message: alias, message: alias,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
); );
final altAliases = room final altAliases = room

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart' hide Visibility; import 'package:flutter/material.dart' hide Visibility;
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_access_settings/chat_access_settings_controller.dart'; import 'package:fluffychat/pages/chat_access_settings/chat_access_settings_controller.dart';
import 'package:fluffychat/utils/fluffy_share.dart'; import 'package:fluffychat/utils/fluffy_share.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
@ -18,7 +18,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.accessAndVisibility), title: Text(L10n.of(context).accessAndVisibility),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: StreamBuilder<Object>( child: StreamBuilder<Object>(
@ -36,7 +36,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
children: [ children: [
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.visibilityOfTheChatHistory, L10n.of(context).visibilityOfTheChatHistory,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -47,7 +47,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
RadioListTile<HistoryVisibility>.adaptive( RadioListTile<HistoryVisibility>.adaptive(
title: Text( title: Text(
historyVisibility historyVisibility
.getLocalizedString(MatrixLocals(L10n.of(context)!)), .getLocalizedString(MatrixLocals(L10n.of(context))),
), ),
value: historyVisibility, value: historyVisibility,
groupValue: room.historyVisibility, groupValue: room.historyVisibility,
@ -59,7 +59,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
Divider(color: Theme.of(context).dividerColor), Divider(color: Theme.of(context).dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.whoIsAllowedToJoinThisGroup, L10n.of(context).whoIsAllowedToJoinThisGroup,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -70,7 +70,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
if (joinRule != JoinRules.private) if (joinRule != JoinRules.private)
RadioListTile<JoinRules>.adaptive( RadioListTile<JoinRules>.adaptive(
title: Text( title: Text(
joinRule.localizedString(L10n.of(context)!), joinRule.localizedString(L10n.of(context)),
), ),
value: joinRule, value: joinRule,
groupValue: room.joinRules, groupValue: room.joinRules,
@ -84,7 +84,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
.contains(room.joinRules)) ...[ .contains(room.joinRules)) ...[
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.areGuestsAllowedToJoin, L10n.of(context).areGuestsAllowedToJoin,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -95,7 +95,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
RadioListTile<GuestAccess>.adaptive( RadioListTile<GuestAccess>.adaptive(
title: Text( title: Text(
guestAccess.getLocalizedString( guestAccess.getLocalizedString(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
value: guestAccess, value: guestAccess,
@ -108,7 +108,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
Divider(color: Theme.of(context).dividerColor), Divider(color: Theme.of(context).dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.publicChatAddresses, L10n.of(context).publicChatAddresses,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -116,7 +116,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
), ),
trailing: IconButton( trailing: IconButton(
icon: const Icon(Icons.add_outlined), icon: const Icon(Icons.add_outlined),
tooltip: L10n.of(context)!.createNewAddress, tooltip: L10n.of(context).createNewAddress,
onPressed: controller.addAlias, onPressed: controller.addAlias,
), ),
), ),
@ -169,7 +169,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
builder: (context, snapshot) => SwitchListTile.adaptive( builder: (context, snapshot) => SwitchListTile.adaptive(
value: snapshot.data == Visibility.public, value: snapshot.data == Visibility.public,
title: Text( title: Text(
L10n.of(context)!.chatCanBeDiscoveredViaSearchOnServer( L10n.of(context).chatCanBeDiscoveredViaSearchOnServer(
room.client.userID!.domain!, room.client.userID!.domain!,
), ),
), ),
@ -178,7 +178,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
), ),
], ],
ListTile( ListTile(
title: Text(L10n.of(context)!.globalChatId), title: Text(L10n.of(context).globalChatId),
subtitle: SelectableText(room.id), subtitle: SelectableText(room.id),
trailing: IconButton( trailing: IconButton(
icon: const Icon(Icons.copy_outlined), icon: const Icon(Icons.copy_outlined),
@ -186,7 +186,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
), ),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.roomVersion), title: Text(L10n.of(context).roomVersion),
subtitle: SelectableText( subtitle: SelectableText(
room room
.getState(EventTypes.RoomCreate)! .getState(EventTypes.RoomCreate)!

View file

@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_details/chat_details_view.dart'; import 'package:fluffychat/pages/chat_details/chat_details_view.dart';
import 'package:fluffychat/pages/settings/settings.dart'; import 'package:fluffychat/pages/settings/settings.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
@ -44,14 +44,14 @@ class ChatDetailsController extends State<ChatDetails> {
final room = Matrix.of(context).client.getRoomById(roomId!)!; final room = Matrix.of(context).client.getRoomById(roomId!)!;
final input = await showTextInputDialog( final input = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.changeTheNameOfTheGroup, title: L10n.of(context).changeTheNameOfTheGroup,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
initialText: room.getLocalizedDisplayname( initialText: room.getLocalizedDisplayname(
MatrixLocals( MatrixLocals(
L10n.of(context)!, L10n.of(context),
), ),
), ),
), ),
@ -64,7 +64,7 @@ class ChatDetailsController extends State<ChatDetails> {
); );
if (success.error == null) { if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.displaynameHasBeenChanged)), SnackBar(content: Text(L10n.of(context).displaynameHasBeenChanged)),
); );
} }
} }
@ -73,12 +73,12 @@ class ChatDetailsController extends State<ChatDetails> {
final room = Matrix.of(context).client.getRoomById(roomId!)!; final room = Matrix.of(context).client.getRoomById(roomId!)!;
final input = await showTextInputDialog( final input = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.setChatDescription, title: L10n.of(context).setChatDescription,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.noChatDescriptionYet, hintText: L10n.of(context).noChatDescriptionYet,
initialText: room.topic, initialText: room.topic,
minLines: 4, minLines: 4,
maxLines: 8, maxLines: 8,
@ -93,7 +93,7 @@ class ChatDetailsController extends State<ChatDetails> {
if (success.error == null) { if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(L10n.of(context)!.chatDescriptionHasBeenChanged), content: Text(L10n.of(context).chatDescriptionHasBeenChanged),
), ),
); );
} }
@ -119,19 +119,19 @@ class ChatDetailsController extends State<ChatDetails> {
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
SheetAction( SheetAction(
key: AvatarAction.camera, key: AvatarAction.camera,
label: L10n.of(context)!.openCamera, label: L10n.of(context).openCamera,
isDefaultAction: true, isDefaultAction: true,
icon: Icons.camera_alt_outlined, icon: Icons.camera_alt_outlined,
), ),
SheetAction( SheetAction(
key: AvatarAction.file, key: AvatarAction.file,
label: L10n.of(context)!.openGallery, label: L10n.of(context).openGallery,
icon: Icons.photo_outlined, icon: Icons.photo_outlined,
), ),
if (room?.avatar != null) if (room?.avatar != null)
SheetAction( SheetAction(
key: AvatarAction.remove, key: AvatarAction.remove,
label: L10n.of(context)!.delete, label: L10n.of(context).delete,
isDestructiveAction: true, isDestructiveAction: true,
icon: Icons.delete_outlined, icon: Icons.delete_outlined,
), ),
@ -140,7 +140,7 @@ class ChatDetailsController extends State<ChatDetails> {
? actions.single.key ? actions.single.key
: await showModalActionSheet<AvatarAction>( : await showModalActionSheet<AvatarAction>(
context: context, context: context,
title: L10n.of(context)!.editRoomAvatar, title: L10n.of(context).editRoomAvatar,
actions: actions, actions: actions,
); );
if (action == null) return; if (action == null) return;

View file

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_linkify/flutter_linkify.dart'; import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_details/chat_details.dart'; import 'package:fluffychat/pages/chat_details/chat_details.dart';
import 'package:fluffychat/pages/chat_details/participant_list_item.dart'; import 'package:fluffychat/pages/chat_details/participant_list_item.dart';
import 'package:fluffychat/utils/fluffy_share.dart'; import 'package:fluffychat/utils/fluffy_share.dart';
@ -27,10 +27,10 @@ class ChatDetailsView extends StatelessWidget {
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.oopsSomethingWentWrong), title: Text(L10n.of(context).oopsSomethingWentWrong),
), ),
body: Center( body: Center(
child: Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat), child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
), ),
); );
} }
@ -47,7 +47,7 @@ class ChatDetailsView extends StatelessWidget {
final canRequestMoreMembers = members.length < actualMembersCount; final canRequestMoreMembers = members.length < actualMembersCount;
final iconColor = Theme.of(context).textTheme.bodyLarge!.color; final iconColor = Theme.of(context).textTheme.bodyLarge!.color;
final displayname = room.getLocalizedDisplayname( final displayname = room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
); );
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@ -57,7 +57,7 @@ class ChatDetailsView extends StatelessWidget {
actions: <Widget>[ actions: <Widget>[
if (room.canonicalAlias.isNotEmpty) if (room.canonicalAlias.isNotEmpty)
IconButton( IconButton(
tooltip: L10n.of(context)!.share, tooltip: L10n.of(context).share,
icon: Icon(Icons.adaptive.share_outlined), icon: Icon(Icons.adaptive.share_outlined),
onPressed: () => FluffyShare.share( onPressed: () => FluffyShare.share(
AppConfig.inviteLinkPrefix + room.canonicalAlias, AppConfig.inviteLinkPrefix + room.canonicalAlias,
@ -67,7 +67,7 @@ class ChatDetailsView extends StatelessWidget {
if (controller.widget.embeddedCloseButton == null) if (controller.widget.embeddedCloseButton == null)
ChatSettingsPopupMenu(room, false), ChatSettingsPopupMenu(room, false),
], ],
title: Text(L10n.of(context)!.chatDetails), title: Text(L10n.of(context).chatDetails),
backgroundColor: Theme.of(context).appBarTheme.backgroundColor, backgroundColor: Theme.of(context).appBarTheme.backgroundColor,
), ),
body: MaxWidthBody( body: MaxWidthBody(
@ -163,11 +163,11 @@ class ChatDetailsView extends StatelessWidget {
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Theme.of(context) foregroundColor: Theme.of(context)
.colorScheme .colorScheme
.onBackground, .onSurface,
), ),
label: Text( label: Text(
room.isDirectChat room.isDirectChat
? L10n.of(context)!.directChat ? L10n.of(context).directChat
: displayname, : displayname,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -190,7 +190,7 @@ class ChatDetailsView extends StatelessWidget {
.secondary, .secondary,
), ),
label: Text( label: Text(
L10n.of(context)!.countParticipants( L10n.of(context).countParticipants(
actualMembersCount, actualMembersCount,
), ),
maxLines: 1, maxLines: 1,
@ -210,7 +210,7 @@ class ChatDetailsView extends StatelessWidget {
if (!room.canChangeStateEvent(EventTypes.RoomTopic)) if (!room.canChangeStateEvent(EventTypes.RoomTopic))
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.chatDescription, L10n.of(context).chatDescription,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -222,7 +222,7 @@ class ChatDetailsView extends StatelessWidget {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: TextButton.icon( child: TextButton.icon(
onPressed: controller.setTopicAction, onPressed: controller.setTopicAction,
label: Text(L10n.of(context)!.setChatDescription), label: Text(L10n.of(context).setChatDescription),
icon: const Icon(Icons.edit_outlined), icon: const Icon(Icons.edit_outlined),
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
@ -240,7 +240,7 @@ class ChatDetailsView extends StatelessWidget {
), ),
child: SelectableLinkify( child: SelectableLinkify(
text: room.topic.isEmpty text: room.topic.isEmpty
? L10n.of(context)!.noChatDescriptionYet ? L10n.of(context).noChatDescriptionYet
: room.topic, : room.topic,
options: const LinkifyOptions(humanize: false), options: const LinkifyOptions(humanize: false),
linkStyle: const TextStyle( linkStyle: const TextStyle(
@ -275,9 +275,8 @@ class ChatDetailsView extends StatelessWidget {
Icons.insert_emoticon_outlined, Icons.insert_emoticon_outlined,
), ),
), ),
title: title: Text(L10n.of(context).customEmojisAndStickers),
Text(L10n.of(context)!.customEmojisAndStickers), subtitle: Text(L10n.of(context).setCustomEmotes),
subtitle: Text(L10n.of(context)!.setCustomEmotes),
onTap: controller.goToEmoteSettings, onTap: controller.goToEmoteSettings,
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
), ),
@ -290,10 +289,10 @@ class ChatDetailsView extends StatelessWidget {
child: const Icon(Icons.shield_outlined), child: const Icon(Icons.shield_outlined),
), ),
title: Text( title: Text(
L10n.of(context)!.accessAndVisibility, L10n.of(context).accessAndVisibility,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.accessAndVisibilityDescription, L10n.of(context).accessAndVisibilityDescription,
), ),
onTap: () => context onTap: () => context
.push('/rooms/${room.id}/details/access'), .push('/rooms/${room.id}/details/access'),
@ -301,9 +300,9 @@ class ChatDetailsView extends StatelessWidget {
), ),
if (!room.isDirectChat) if (!room.isDirectChat)
ListTile( ListTile(
title: Text(L10n.of(context)!.chatPermissions), title: Text(L10n.of(context).chatPermissions),
subtitle: Text( subtitle: Text(
L10n.of(context)!.whoCanPerformWhichAction, L10n.of(context).whoCanPerformWhichAction,
), ),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor:
@ -323,7 +322,7 @@ class ChatDetailsView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.countParticipants( L10n.of(context).countParticipants(
actualMembersCount.toString(), actualMembersCount.toString(),
), ),
style: TextStyle( style: TextStyle(
@ -334,7 +333,7 @@ class ChatDetailsView extends StatelessWidget {
), ),
if (!room.isDirectChat && room.canInvite) if (!room.isDirectChat && room.canInvite)
ListTile( ListTile(
title: Text(L10n.of(context)!.inviteContact), title: Text(L10n.of(context).inviteContact),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
@ -354,7 +353,7 @@ class ChatDetailsView extends StatelessWidget {
? ParticipantListItem(members[i - 1]) ? ParticipantListItem(members[i - 1])
: ListTile( : ListTile(
title: Text( title: Text(
L10n.of(context)!.loadCountMoreParticipants( L10n.of(context).loadCountMoreParticipants(
(actualMembersCount - members.length).toString(), (actualMembersCount - members.length).toString(),
), ),
), ),

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart'; import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
import '../../widgets/avatar.dart'; import '../../widgets/avatar.dart';
import '../user_bottom_sheet/user_bottom_sheet.dart'; import '../user_bottom_sheet/user_bottom_sheet.dart';
@ -15,17 +15,17 @@ class ParticipantListItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final membershipBatch = switch (user.membership) { final membershipBatch = switch (user.membership) {
Membership.ban => L10n.of(context)!.banned, Membership.ban => L10n.of(context).banned,
Membership.invite => L10n.of(context)!.invited, Membership.invite => L10n.of(context).invited,
Membership.join => null, Membership.join => null,
Membership.knock => L10n.of(context)!.knocking, Membership.knock => L10n.of(context).knocking,
Membership.leave => L10n.of(context)!.leftTheChat, Membership.leave => L10n.of(context).leftTheChat,
}; };
final permissionBatch = user.powerLevel == 100 final permissionBatch = user.powerLevel == 100
? L10n.of(context)!.admin ? L10n.of(context).admin
: user.powerLevel >= 50 : user.powerLevel >= 50
? L10n.of(context)!.moderator ? L10n.of(context).moderator
: ''; : '';
return Opacity( return Opacity(

View file

@ -1,12 +1,12 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/encryption.dart'; import 'package:matrix/encryption.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings_view.dart'; import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings_view.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import '../key_verification/key_verification_dialog.dart'; import '../key_verification/key_verification_dialog.dart';
@ -34,33 +34,33 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
if (room.encrypted) { if (room.encrypted) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.sorryThatsNotPossible, title: L10n.of(context).sorryThatsNotPossible,
message: L10n.of(context)!.disableEncryptionWarning, message: L10n.of(context).disableEncryptionWarning,
); );
return; return;
} }
if (room.joinRules == JoinRules.public) { if (room.joinRules == JoinRules.public) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.sorryThatsNotPossible, title: L10n.of(context).sorryThatsNotPossible,
message: L10n.of(context)!.noEncryptionForPublicRooms, message: L10n.of(context).noEncryptionForPublicRooms,
); );
return; return;
} }
if (!room.canChangeStateEvent(EventTypes.Encryption)) { if (!room.canChangeStateEvent(EventTypes.Encryption)) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.sorryThatsNotPossible, title: L10n.of(context).sorryThatsNotPossible,
message: L10n.of(context)!.noPermission, message: L10n.of(context).noPermission,
); );
return; return;
} }
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
message: L10n.of(context)!.enableEncryptionWarning, message: L10n.of(context).enableEncryptionWarning,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -72,10 +72,10 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
void startVerification() async { void startVerification() async {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.verifyOtherUser, title: L10n.of(context).verifyOtherUser,
message: L10n.of(context)!.verifyOtherUserDescription, message: L10n.of(context).verifyOtherUserDescription,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;

View file

@ -1,12 +1,12 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings.dart'; import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings.dart';
import 'package:fluffychat/utils/beautify_string_extension.dart'; import 'package:fluffychat/utils/beautify_string_extension.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
@ -29,11 +29,11 @@ class ChatEncryptionSettingsView extends StatelessWidget {
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: () => context.go('/rooms/${controller.roomId!}'), onPressed: () => context.go('/rooms/${controller.roomId!}'),
), ),
title: Text(L10n.of(context)!.encryption), title: Text(L10n.of(context).encryption),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => launchUrlString(AppConfig.encryptionTutorial), onPressed: () => launchUrlString(AppConfig.encryptionTutorial),
child: Text(L10n.of(context)!.help), child: Text(L10n.of(context).help),
), ),
], ],
), ),
@ -49,7 +49,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
Theme.of(context).colorScheme.primaryContainer, Theme.of(context).colorScheme.primaryContainer,
child: const Icon(Icons.lock_outlined), child: const Icon(Icons.lock_outlined),
), ),
title: Text(L10n.of(context)!.encryptThisChat), title: Text(L10n.of(context).encryptThisChat),
value: room.encrypted, value: room.encrypted,
onChanged: controller.enableEncryption, onChanged: controller.enableEncryption,
), ),
@ -67,7 +67,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
child: ElevatedButton.icon( child: ElevatedButton.icon(
onPressed: controller.startVerification, onPressed: controller.startVerification,
icon: const Icon(Icons.verified_outlined), icon: const Icon(Icons.verified_outlined),
label: Text(L10n.of(context)!.verifyStart), label: Text(L10n.of(context).verifyStart),
), ),
), ),
), ),
@ -75,7 +75,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
const SizedBox(height: 16), const SizedBox(height: 16),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.deviceKeys, L10n.of(context).deviceKeys,
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -91,7 +91,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
if (snapshot.hasError) { if (snapshot.hasError) {
return Center( return Center(
child: Text( child: Text(
'${L10n.of(context)!.oopsSomethingWentWrong}: ${snapshot.error}', '${L10n.of(context).oopsSomethingWentWrong}: ${snapshot.error}',
), ),
); );
} }
@ -133,7 +133,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
const SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(
deviceKeys[i].deviceId ?? deviceKeys[i].deviceId ??
L10n.of(context)!.unknownDevice, L10n.of(context).unknownDevice,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Flexible( Flexible(
@ -172,7 +172,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
), ),
subtitle: Text( subtitle: Text(
deviceKeys[i].ed25519Key?.beautified ?? deviceKeys[i].ed25519Key?.beautified ??
L10n.of(context)!.unknownEncryptionAlgorithm, L10n.of(context).unknownEncryptionAlgorithm,
style: TextStyle( style: TextStyle(
fontFamily: 'RobotoMono', fontFamily: 'RobotoMono',
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
@ -188,7 +188,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Center( child: Center(
child: Text( child: Text(
L10n.of(context)!.encryptionNotEnabled, L10n.of(context).encryptionNotEnabled,
style: const TextStyle( style: const TextStyle(
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
), ),

View file

@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_shortcuts/flutter_shortcuts.dart'; import 'package:flutter_shortcuts/flutter_shortcuts.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
@ -16,6 +15,7 @@ import 'package:uni_links/uni_links.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_list/chat_list_view.dart'; import 'package:fluffychat/pages/chat_list/chat_list_view.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
@ -178,10 +178,10 @@ class ChatListController extends State<ChatList>
void setServer() async { void setServer() async {
final newServer = await showTextInputDialog( final newServer = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
title: L10n.of(context)!.changeTheHomeserver, title: L10n.of(context).changeTheHomeserver,
context: context, context: context,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
prefixText: 'https://', prefixText: 'https://',
@ -191,7 +191,7 @@ class ChatListController extends State<ChatList>
autocorrect: false, autocorrect: false,
validator: (server) => server?.contains('.') == true validator: (server) => server?.contains('.') == true
? null ? null
: L10n.of(context)!.invalidServerName, : L10n.of(context).invalidServerName,
), ),
], ],
); );
@ -510,10 +510,10 @@ class ChatListController extends State<ChatList>
final confirmed = await showOkCancelAlertDialog( final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
message: L10n.of(context)!.archiveRoomDescription, message: L10n.of(context).archiveRoomDescription,
) == ) ==
OkCancelResult.ok; OkCancelResult.ok;
if (!confirmed) return; if (!confirmed) return;
@ -526,7 +526,7 @@ class ChatListController extends State<ChatList>
void dismissStatusList() async { void dismissStatusList() async {
final result = await showOkCancelAlertDialog( final result = await showOkCancelAlertDialog(
title: L10n.of(context)!.hidePresences, title: L10n.of(context).hidePresences,
context: context, context: context,
); );
if (result == OkCancelResult.ok) { if (result == OkCancelResult.ok) {
@ -542,13 +542,13 @@ class ChatListController extends State<ChatList>
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.setStatus, title: L10n.of(context).setStatus,
message: L10n.of(context)!.leaveEmptyToClearStatus, message: L10n.of(context).leaveEmptyToClearStatus,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.statusExampleMessage, hintText: L10n.of(context).statusExampleMessage,
maxLines: 6, maxLines: 6,
minLines: 1, minLines: 1,
maxLength: 255, maxLength: 255,
@ -583,8 +583,8 @@ class ChatListController extends State<ChatList>
Future<void> addToSpace() async { Future<void> addToSpace() async {
final selectedSpace = await showConfirmationDialog<String>( final selectedSpace = await showConfirmationDialog<String>(
context: context, context: context,
title: L10n.of(context)!.addToSpace, title: L10n.of(context).addToSpace,
message: L10n.of(context)!.addToSpaceDescription, message: L10n.of(context).addToSpaceDescription,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
actions: Matrix.of(context) actions: Matrix.of(context)
.client .client
@ -593,8 +593,8 @@ class ChatListController extends State<ChatList>
.map( .map(
(space) => AlertDialogAction( (space) => AlertDialogAction(
key: space.id, key: space.id,
label: space label:
.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), space.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
), ),
) )
.toList(), .toList(),
@ -615,7 +615,7 @@ class ChatListController extends State<ChatList>
if (!mounted) return; if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(L10n.of(context)!.chatHasBeenAddedToThisSpace), content: Text(L10n.of(context).chatHasBeenAddedToThisSpace),
), ),
); );
} }
@ -699,22 +699,22 @@ class ChatListController extends State<ChatList>
} }
void editBundlesForAccount(String? userId, String? activeBundle) async { void editBundlesForAccount(String? userId, String? activeBundle) async {
final l10n = L10n.of(context)!; final l10n = L10n.of(context);
final client = Matrix.of(context) final client = Matrix.of(context)
.widget .widget
.clients[Matrix.of(context).getClientIndexByMatrixId(userId!)]; .clients[Matrix.of(context).getClientIndexByMatrixId(userId!)];
final action = await showConfirmationDialog<EditBundleAction>( final action = await showConfirmationDialog<EditBundleAction>(
context: context, context: context,
title: L10n.of(context)!.editBundlesForAccount, title: L10n.of(context).editBundlesForAccount,
actions: [ actions: [
AlertDialogAction( AlertDialogAction(
key: EditBundleAction.addToBundle, key: EditBundleAction.addToBundle,
label: L10n.of(context)!.addToBundle, label: L10n.of(context).addToBundle,
), ),
if (activeBundle != client.userID) if (activeBundle != client.userID)
AlertDialogAction( AlertDialogAction(
key: EditBundleAction.removeFromBundle, key: EditBundleAction.removeFromBundle,
label: L10n.of(context)!.removeFromBundle, label: L10n.of(context).removeFromBundle,
), ),
], ],
); );

View file

@ -2,10 +2,10 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:animations/animations.dart'; import 'package:animations/animations.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_list/chat_list.dart'; import 'package:fluffychat/pages/chat_list/chat_list.dart';
import 'package:fluffychat/pages/chat_list/chat_list_item.dart'; import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
import 'package:fluffychat/pages/chat_list/search_title.dart'; import 'package:fluffychat/pages/chat_list/search_title.dart';
@ -85,17 +85,17 @@ class ChatListViewBody extends StatelessWidget {
[ [
if (controller.isSearchMode) ...[ if (controller.isSearchMode) ...[
SearchTitle( SearchTitle(
title: L10n.of(context)!.publicRooms, title: L10n.of(context).publicRooms,
icon: const Icon(Icons.explore_outlined), icon: const Icon(Icons.explore_outlined),
), ),
PublicRoomsHorizontalList(publicRooms: publicRooms), PublicRoomsHorizontalList(publicRooms: publicRooms),
SearchTitle( SearchTitle(
title: L10n.of(context)!.publicSpaces, title: L10n.of(context).publicSpaces,
icon: const Icon(Icons.workspaces_outlined), icon: const Icon(Icons.workspaces_outlined),
), ),
PublicRoomsHorizontalList(publicRooms: publicSpaces), PublicRoomsHorizontalList(publicRooms: publicSpaces),
SearchTitle( SearchTitle(
title: L10n.of(context)!.users, title: L10n.of(context).users,
icon: const Icon(Icons.group_outlined), icon: const Icon(Icons.group_outlined),
), ),
AnimatedContainer( AnimatedContainer(
@ -117,7 +117,7 @@ class ChatListViewBody extends StatelessWidget {
.results[i].displayName ?? .results[i].displayName ??
userSearchResult userSearchResult
.results[i].userId.localpart ?? .results[i].userId.localpart ??
L10n.of(context)!.unknownDevice, L10n.of(context).unknownDevice,
avatar: avatar:
userSearchResult.results[i].avatarUrl, userSearchResult.results[i].avatarUrl,
onPressed: () => showAdaptiveBottomSheet( onPressed: () => showAdaptiveBottomSheet(
@ -151,8 +151,8 @@ class ChatListViewBody extends StatelessWidget {
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.surface,
child: ListTile( child: ListTile(
leading: const Icon(Icons.vpn_key), leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.dehydrateTor), title: Text(L10n.of(context).dehydrateTor),
subtitle: Text(L10n.of(context)!.dehydrateTorLong), subtitle: Text(L10n.of(context).dehydrateTorLong),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
onTap: controller.dehydrate, onTap: controller.dehydrate,
), ),
@ -160,7 +160,7 @@ class ChatListViewBody extends StatelessWidget {
), ),
if (controller.isSearchMode) if (controller.isSearchMode)
SearchTitle( SearchTitle(
title: L10n.of(context)!.chats, title: L10n.of(context).chats,
icon: const Icon(Icons.forum_outlined), icon: const Icon(Icons.forum_outlined),
), ),
if (client.prevBatch != null && if (client.prevBatch != null &&
@ -290,7 +290,7 @@ class PublicRoomsHorizontalList extends StatelessWidget {
itemBuilder: (context, i) => _SearchItem( itemBuilder: (context, i) => _SearchItem(
title: publicRooms[i].name ?? title: publicRooms[i].name ??
publicRooms[i].canonicalAlias?.localpart ?? publicRooms[i].canonicalAlias?.localpart ??
L10n.of(context)!.group, L10n.of(context).group,
avatar: publicRooms[i].avatarUrl, avatar: publicRooms[i].avatarUrl,
onPressed: () => showAdaptiveBottomSheet( onPressed: () => showAdaptiveBottomSheet(
context: context, context: context,

View file

@ -1,8 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_list/chat_list.dart'; import 'package:fluffychat/pages/chat_list/chat_list.dart';
import 'package:fluffychat/pages/chat_list/client_chooser_button.dart'; import 'package:fluffychat/pages/chat_list/client_chooser_button.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
@ -33,14 +32,14 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
leading: selectMode == SelectMode.normal leading: selectMode == SelectMode.normal
? null ? null
: IconButton( : IconButton(
tooltip: L10n.of(context)!.cancel, tooltip: L10n.of(context).cancel,
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: controller.cancelAction, onPressed: controller.cancelAction,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
title: selectMode == SelectMode.share title: selectMode == SelectMode.share
? Text( ? Text(
L10n.of(context)!.share, L10n.of(context).share,
key: const ValueKey(SelectMode.share), key: const ValueKey(SelectMode.share),
) )
: selectMode == SelectMode.select : selectMode == SelectMode.select
@ -63,7 +62,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
hintText: L10n.of(context)!.searchChatsRooms, hintText: L10n.of(context).searchChatsRooms,
hintStyle: TextStyle( hintStyle: TextStyle(
color: Theme.of(context).colorScheme.onPrimaryContainer, color: Theme.of(context).colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -71,7 +70,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
floatingLabelBehavior: FloatingLabelBehavior.never, floatingLabelBehavior: FloatingLabelBehavior.never,
prefixIcon: controller.isSearchMode prefixIcon: controller.isSearchMode
? IconButton( ? IconButton(
tooltip: L10n.of(context)!.cancel, tooltip: L10n.of(context).cancel,
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: controller.cancelSearch, onPressed: controller.cancelSearch,
color: Theme.of(context) color: Theme.of(context)
@ -139,12 +138,12 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
? [ ? [
if (controller.spaces.isNotEmpty) if (controller.spaces.isNotEmpty)
IconButton( IconButton(
tooltip: L10n.of(context)!.addToSpace, tooltip: L10n.of(context).addToSpace,
icon: const Icon(Icons.workspaces_outlined), icon: const Icon(Icons.workspaces_outlined),
onPressed: controller.addToSpace, onPressed: controller.addToSpace,
), ),
IconButton( IconButton(
tooltip: L10n.of(context)!.toggleUnread, tooltip: L10n.of(context).toggleUnread,
icon: Icon( icon: Icon(
controller.anySelectedRoomNotMarkedUnread controller.anySelectedRoomNotMarkedUnread
? Icons.mark_chat_unread_outlined ? Icons.mark_chat_unread_outlined
@ -153,7 +152,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
onPressed: controller.toggleUnread, onPressed: controller.toggleUnread,
), ),
IconButton( IconButton(
tooltip: L10n.of(context)!.toggleFavorite, tooltip: L10n.of(context).toggleFavorite,
icon: Icon( icon: Icon(
controller.anySelectedRoomNotFavorite controller.anySelectedRoomNotFavorite
? Icons.push_pin ? Icons.push_pin
@ -167,12 +166,12 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
? Icons.notifications_off_outlined ? Icons.notifications_off_outlined
: Icons.notifications_outlined, : Icons.notifications_outlined,
), ),
tooltip: L10n.of(context)!.toggleMuted, tooltip: L10n.of(context).toggleMuted,
onPressed: controller.toggleMuted, onPressed: controller.toggleMuted,
), ),
IconButton( IconButton(
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
tooltip: L10n.of(context)!.archive, tooltip: L10n.of(context).archive,
onPressed: controller.archiveAction, onPressed: controller.archiveAction,
), ),
] ]

View file

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/utils/room_status_extension.dart'; import 'package:fluffychat/utils/room_status_extension.dart';
import 'package:fluffychat/widgets/hover_builder.dart'; import 'package:fluffychat/widgets/hover_builder.dart';
@ -47,10 +47,10 @@ class ChatListItem extends StatelessWidget {
final confirmed = await showOkCancelAlertDialog( final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.archiveRoomDescription, message: L10n.of(context).archiveRoomDescription,
); );
if (confirmed == OkCancelResult.cancel) return; if (confirmed == OkCancelResult.cancel) return;
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -83,7 +83,7 @@ class ChatListItem extends StatelessWidget {
? theme.colorScheme.secondaryContainer ? theme.colorScheme.secondaryContainer
: null; : null;
final displayname = room.getLocalizedDisplayname( final displayname = room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
); );
final filter = this.filter; final filter = this.filter;
if (filter != null && !displayname.toLowerCase().contains(filter)) { if (filter != null && !displayname.toLowerCase().contains(filter)) {
@ -229,10 +229,10 @@ class ChatListItem extends StatelessWidget {
: Text( : Text(
room.membership == Membership.invite room.membership == Membership.invite
? isDirectChat ? isDirectChat
? L10n.of(context)!.invitePrivateChat ? L10n.of(context).invitePrivateChat
: L10n.of(context)!.inviteGroupChat : L10n.of(context).inviteGroupChat
: room.lastEvent?.calcLocalizedBodyFallback( : room.lastEvent?.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
hideReply: true, hideReply: true,
hideEdit: true, hideEdit: true,
plaintextBody: true, plaintextBody: true,
@ -241,7 +241,7 @@ class ChatListItem extends StatelessWidget {
directChatMatrixId != directChatMatrixId !=
room.lastEvent?.senderId, room.lastEvent?.senderId,
) ?? ) ??
L10n.of(context)!.emptyChat, L10n.of(context).emptyChat,
softWrap: false, softWrap: false,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

View file

@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:badges/badges.dart'; import 'package:badges/badges.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart'; import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_list/chat_list.dart'; import 'package:fluffychat/pages/chat_list/chat_list.dart';
import 'package:fluffychat/pages/chat_list/navi_rail_item.dart'; import 'package:fluffychat/pages/chat_list/navi_rail_item.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
@ -39,7 +39,7 @@ class ChatListView extends StatelessWidget {
controller.getRoomFilterByActiveFilter(ActiveFilter.messages), controller.getRoomFilterByActiveFilter(ActiveFilter.messages),
child: const Icon(Icons.chat), child: const Icon(Icons.chat),
), ),
label: L10n.of(context)!.messages, label: L10n.of(context).messages,
), ),
NavigationDestination( NavigationDestination(
icon: UnreadRoomsBadge( icon: UnreadRoomsBadge(
@ -52,7 +52,7 @@ class ChatListView extends StatelessWidget {
filter: controller.getRoomFilterByActiveFilter(ActiveFilter.groups), filter: controller.getRoomFilterByActiveFilter(ActiveFilter.groups),
child: const Icon(Icons.group), child: const Icon(Icons.group),
), ),
label: L10n.of(context)!.groups, label: L10n.of(context).groups,
), ),
] else ] else
NavigationDestination( NavigationDestination(
@ -68,7 +68,7 @@ class ChatListView extends StatelessWidget {
controller.getRoomFilterByActiveFilter(ActiveFilter.allChats), controller.getRoomFilterByActiveFilter(ActiveFilter.allChats),
child: const Icon(Icons.chat), child: const Icon(Icons.chat),
), ),
label: L10n.of(context)!.chats, label: L10n.of(context).chats,
), ),
if (controller.spaces.isNotEmpty) if (controller.spaces.isNotEmpty)
const NavigationDestination( const NavigationDestination(
@ -152,7 +152,7 @@ class ChatListView extends StatelessWidget {
rootSpaces[i].id == controller.activeSpaceId; rootSpaces[i].id == controller.activeSpaceId;
return NaviRailItem( return NaviRailItem(
toolTip: rootSpaces[i].getLocalizedDisplayname( toolTip: rootSpaces[i].getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
isSelected: isSelected, isSelected: isSelected,
onTap: () => onTap: () =>
@ -160,7 +160,7 @@ class ChatListView extends StatelessWidget {
icon: Avatar( icon: Avatar(
mxContent: rootSpaces[i].avatar, mxContent: rootSpaces[i].avatar,
name: rootSpaces[i].getLocalizedDisplayname( name: rootSpaces[i].getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
size: 32, size: 32,
fontSize: 12, fontSize: 12,
@ -189,9 +189,9 @@ class ChatListView extends StatelessWidget {
labelBehavior: labelBehavior:
NavigationDestinationLabelBehavior.alwaysShow, NavigationDestinationLabelBehavior.alwaysShow,
shadowColor: shadowColor:
Theme.of(context).colorScheme.onBackground, Theme.of(context).colorScheme.onSurface,
surfaceTintColor: surfaceTintColor:
Theme.of(context).colorScheme.background, Theme.of(context).colorScheme.surface,
selectedIndex: controller.selectedIndex, selectedIndex: controller.selectedIndex,
onDestinationSelected: onDestinationSelected:
controller.onDestinationSelected, controller.onDestinationSelected,
@ -204,7 +204,7 @@ class ChatListView extends StatelessWidget {
LogicalKeyboardKey.keyN, LogicalKeyboardKey.keyN,
}, },
onKeysPressed: () => context.go('/rooms/newprivatechat'), onKeysPressed: () => context.go('/rooms/newprivatechat'),
helpLabel: L10n.of(context)!.newChat, helpLabel: L10n.of(context).newChat,
child: selectMode == SelectMode.normal && child: selectMode == SelectMode.normal &&
!controller.isSearchMode !controller.isSearchMode
? StartChatFloatingActionButton( ? StartChatFloatingActionButton(

View file

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart'; import 'package:keyboard_shortcuts/keyboard_shortcuts.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import '../../utils/fluffy_share.dart'; import '../../utils/fluffy_share.dart';
@ -34,7 +34,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.group_add_outlined), const Icon(Icons.group_add_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.createGroup), Text(L10n.of(context).createGroup),
], ],
), ),
), ),
@ -44,7 +44,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.workspaces_outlined), const Icon(Icons.workspaces_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.createNewSpace), Text(L10n.of(context).createNewSpace),
], ],
), ),
), ),
@ -54,7 +54,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.edit_outlined), const Icon(Icons.edit_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.setStatus), Text(L10n.of(context).setStatus),
], ],
), ),
), ),
@ -64,7 +64,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
Icon(Icons.adaptive.share_outlined), Icon(Icons.adaptive.share_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.inviteContact), Text(L10n.of(context).inviteContact),
], ],
), ),
), ),
@ -74,7 +74,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.archive_outlined), const Icon(Icons.archive_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.archive), Text(L10n.of(context).archive),
], ],
), ),
), ),
@ -84,7 +84,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.settings_outlined), const Icon(Icons.settings_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.settings), Text(L10n.of(context).settings),
], ],
), ),
), ),
@ -155,7 +155,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.person_add_outlined), const Icon(Icons.person_add_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.addAccount), Text(L10n.of(context).addAccount),
], ],
), ),
), ),
@ -177,7 +177,7 @@ class ClientChooserButton extends StatelessWidget {
clientCount, clientCount,
(index) => KeyBoardShortcuts( (index) => KeyBoardShortcuts(
keysToPress: _buildKeyboardShortcut(index + 1), keysToPress: _buildKeyboardShortcut(index + 1),
helpLabel: L10n.of(context)!.switchToAccount(index + 1), helpLabel: L10n.of(context).switchToAccount(index + 1),
onKeysPressed: () => _handleKeyboardShortcut( onKeysPressed: () => _handleKeyboardShortcut(
matrix, matrix,
index, index,
@ -191,7 +191,7 @@ class ClientChooserButton extends StatelessWidget {
LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.controlLeft,
LogicalKeyboardKey.tab, LogicalKeyboardKey.tab,
}, },
helpLabel: L10n.of(context)!.nextAccount, helpLabel: L10n.of(context).nextAccount,
onKeysPressed: () => _nextAccount(matrix, context), onKeysPressed: () => _nextAccount(matrix, context),
child: const SizedBox.shrink(), child: const SizedBox.shrink(),
), ),
@ -201,7 +201,7 @@ class ClientChooserButton extends StatelessWidget {
LogicalKeyboardKey.shiftLeft, LogicalKeyboardKey.shiftLeft,
LogicalKeyboardKey.tab, LogicalKeyboardKey.tab,
}, },
helpLabel: L10n.of(context)!.previousAccount, helpLabel: L10n.of(context).previousAccount,
onKeysPressed: () => _previousAccount(matrix, context), onKeysPressed: () => _previousAccount(matrix, context),
child: const SizedBox.shrink(), child: const SizedBox.shrink(),
), ),
@ -249,10 +249,10 @@ class ClientChooserButton extends StatelessWidget {
case SettingsAction.addAccount: case SettingsAction.addAccount:
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.addAccount, title: L10n.of(context).addAccount,
message: L10n.of(context)!.enableMultiAccounts, message: L10n.of(context).enableMultiAccounts,
okLabel: L10n.of(context)!.next, okLabel: L10n.of(context).next,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;
context.go('/rooms/settings/addaccount'); context.go('/rooms/settings/addaccount');

View file

@ -67,7 +67,7 @@ class _NaviRailItemState extends State<NaviRailItem> {
borderRadius: borderRadius, borderRadius: borderRadius,
color: widget.isSelected color: widget.isSelected
? Theme.of(context).colorScheme.primaryContainer ? Theme.of(context).colorScheme.primaryContainer
: Theme.of(context).colorScheme.background, : Theme.of(context).colorScheme.surface,
child: Tooltip( child: Tooltip(
message: widget.toolTip, message: widget.toolTip,
child: InkWell( child: InkWell(

View file

@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart' as sdk; import 'package:matrix/matrix.dart' as sdk;
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_list/chat_list.dart'; import 'package:fluffychat/pages/chat_list/chat_list.dart';
import 'package:fluffychat/pages/chat_list/chat_list_item.dart'; import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
import 'package:fluffychat/pages/chat_list/search_title.dart'; import 'package:fluffychat/pages/chat_list/search_title.dart';
@ -135,27 +135,27 @@ class _SpaceViewState extends State<SpaceView> {
context: context, context: context,
title: spaceChild?.name ?? title: spaceChild?.name ??
room?.getLocalizedDisplayname( room?.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
message: spaceChild?.topic ?? room?.topic, message: spaceChild?.topic ?? room?.topic,
actions: [ actions: [
if (room == null) if (room == null)
SheetAction( SheetAction(
key: SpaceChildContextAction.join, key: SpaceChildContextAction.join,
label: L10n.of(context)!.joinRoom, label: L10n.of(context).joinRoom,
icon: Icons.send_outlined, icon: Icons.send_outlined,
), ),
if (spaceChild != null && if (spaceChild != null &&
(activeSpace?.canChangeStateEvent(EventTypes.SpaceChild) ?? false)) (activeSpace?.canChangeStateEvent(EventTypes.SpaceChild) ?? false))
SheetAction( SheetAction(
key: SpaceChildContextAction.removeFromSpace, key: SpaceChildContextAction.removeFromSpace,
label: L10n.of(context)!.removeFromSpace, label: L10n.of(context).removeFromSpace,
icon: Icons.delete_sweep_outlined, icon: Icons.delete_sweep_outlined,
), ),
if (room != null) if (room != null)
SheetAction( SheetAction(
key: SpaceChildContextAction.leave, key: SpaceChildContextAction.leave,
label: L10n.of(context)!.leave, label: L10n.of(context).leave,
icon: Icons.delete_outlined, icon: Icons.delete_outlined,
isDestructiveAction: true, isDestructiveAction: true,
), ),
@ -185,15 +185,15 @@ class _SpaceViewState extends State<SpaceView> {
void _addChatOrSubSpace() async { void _addChatOrSubSpace() async {
final roomType = await showConfirmationDialog( final roomType = await showConfirmationDialog(
context: context, context: context,
title: L10n.of(context)!.addChatOrSubSpace, title: L10n.of(context).addChatOrSubSpace,
actions: [ actions: [
AlertDialogAction( AlertDialogAction(
key: AddRoomType.subspace, key: AddRoomType.subspace,
label: L10n.of(context)!.createNewSpace, label: L10n.of(context).createNewSpace,
), ),
AlertDialogAction( AlertDialogAction(
key: AddRoomType.chat, key: AddRoomType.chat,
label: L10n.of(context)!.createGroup, label: L10n.of(context).createGroup,
), ),
], ],
); );
@ -202,32 +202,32 @@ class _SpaceViewState extends State<SpaceView> {
final names = await showTextInputDialog( final names = await showTextInputDialog(
context: context, context: context,
title: roomType == AddRoomType.subspace title: roomType == AddRoomType.subspace
? L10n.of(context)!.createNewSpace ? L10n.of(context).createNewSpace
: L10n.of(context)!.createGroup, : L10n.of(context).createGroup,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: roomType == AddRoomType.subspace hintText: roomType == AddRoomType.subspace
? L10n.of(context)!.spaceName ? L10n.of(context).spaceName
: L10n.of(context)!.groupName, : L10n.of(context).groupName,
minLines: 1, minLines: 1,
maxLines: 1, maxLines: 1,
maxLength: 64, maxLength: 64,
validator: (text) { validator: (text) {
if (text == null || text.isEmpty) { if (text == null || text.isEmpty) {
return L10n.of(context)!.pleaseChoose; return L10n.of(context).pleaseChoose;
} }
return null; return null;
}, },
), ),
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.chatDescription, hintText: L10n.of(context).chatDescription,
minLines: 4, minLines: 4,
maxLines: 8, maxLines: 8,
maxLength: 255, maxLength: 255,
), ),
], ],
okLabel: L10n.of(context)!.create, okLabel: L10n.of(context).create,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (names == null) return; if (names == null) return;
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
@ -286,7 +286,7 @@ class _SpaceViewState extends State<SpaceView> {
.any((child) => child.roomId == space.id), .any((child) => child.roomId == space.id),
) && ) &&
space space
.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)) .getLocalizedDisplayname(MatrixLocals(L10n.of(context)))
.toLowerCase() .toLowerCase()
.contains( .contains(
widget.controller.searchController.text.toLowerCase(), widget.controller.searchController.text.toLowerCase(),
@ -304,10 +304,10 @@ class _SpaceViewState extends State<SpaceView> {
(context, i) { (context, i) {
final rootSpace = rootSpaces[i]; final rootSpace = rootSpaces[i];
final displayname = rootSpace.getLocalizedDisplayname( final displayname = rootSpace.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
); );
return Material( return Material(
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.surface,
child: ListTile( child: ListTile(
leading: Avatar( leading: Avatar(
mxContent: rootSpace.avatar, mxContent: rootSpace.avatar,
@ -319,7 +319,7 @@ class _SpaceViewState extends State<SpaceView> {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.numChats( L10n.of(context).numChats(
rootSpace.spaceChildren.length.toString(), rootSpace.spaceChildren.length.toString(),
), ),
), ),
@ -367,9 +367,9 @@ class _SpaceViewState extends State<SpaceView> {
), ),
title: Text( title: Text(
parentSpace == null parentSpace == null
? L10n.of(context)!.allSpaces ? L10n.of(context).allSpaces
: parentSpace.getLocalizedDisplayname( : parentSpace.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
trailing: IconButton( trailing: IconButton(
@ -405,7 +405,7 @@ class _SpaceViewState extends State<SpaceView> {
if (response == null) { if (response == null) {
return SliverFillRemaining( return SliverFillRemaining(
child: Center( child: Center(
child: Text(L10n.of(context)!.loadingPleaseWait), child: Text(L10n.of(context).loadingPleaseWait),
), ),
); );
} }
@ -420,7 +420,7 @@ class _SpaceViewState extends State<SpaceView> {
child: OutlinedButton.icon( child: OutlinedButton.icon(
label: loading label: loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Text(L10n.of(context)!.loadMore), : Text(L10n.of(context).loadMore),
icon: const Icon(Icons.chevron_right_outlined), icon: const Icon(Icons.chevron_right_outlined),
onPressed: loading onPressed: loading
? null ? null
@ -484,7 +484,7 @@ class _SpaceViewState extends State<SpaceView> {
child: Icon(Icons.group_add_outlined), child: Icon(Icons.group_add_outlined),
), ),
title: title:
Text(L10n.of(context)!.addChatOrSubSpace), Text(L10n.of(context).addChatOrSubSpace),
trailing: trailing:
const Icon(Icons.chevron_right_outlined), const Icon(Icons.chevron_right_outlined),
onTap: _addChatOrSubSpace, onTap: _addChatOrSubSpace,
@ -495,7 +495,7 @@ class _SpaceViewState extends State<SpaceView> {
} }
final name = spaceChild.name ?? final name = spaceChild.name ??
spaceChild.canonicalAlias ?? spaceChild.canonicalAlias ??
L10n.of(context)!.chat; L10n.of(context).chat;
if (widget.controller.isSearchMode && if (widget.controller.isSearchMode &&
!name.toLowerCase().contains( !name.toLowerCase().contains(
widget.controller.searchController.text widget.controller.searchController.text
@ -541,11 +541,11 @@ class _SpaceViewState extends State<SpaceView> {
subtitle: Text( subtitle: Text(
topic ?? topic ??
(isSpace (isSpace
? L10n.of(context)!.enterSpace ? L10n.of(context).enterSpace
: L10n.of(context)!.enterRoom), : L10n.of(context).enterRoom),
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.onBackground, color: Theme.of(context).colorScheme.onSurface,
), ),
), ),
trailing: isSpace trailing: isSpace

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:fluffychat/l10n/l10n.dart';
import '../../config/themes.dart'; import '../../config/themes.dart';
import 'chat_list.dart'; import 'chat_list.dart';
@ -52,12 +52,12 @@ class StartChatFloatingActionButton extends StatelessWidget {
case ActiveFilter.allChats: case ActiveFilter.allChats:
case ActiveFilter.messages: case ActiveFilter.messages:
return roomsIsEmpty return roomsIsEmpty
? L10n.of(context)!.startFirstChat ? L10n.of(context).startFirstChat
: L10n.of(context)!.newChat; : L10n.of(context).newChat;
case ActiveFilter.groups: case ActiveFilter.groups:
return L10n.of(context)!.newGroup; return L10n.of(context).newGroup;
case ActiveFilter.spaces: case ActiveFilter.spaces:
return L10n.of(context)!.newSpace; return L10n.of(context).newSpace;
} }
} }

View file

@ -125,7 +125,7 @@ class PresenceAvatar extends StatelessWidget {
final statusMsgBubbleElevation = final statusMsgBubbleElevation =
Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4; Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4;
final statusMsgBubbleShadowColor = final statusMsgBubbleShadowColor =
Theme.of(context).colorScheme.onBackground; Theme.of(context).colorScheme.onSurface;
final statusMsgBubbleColor = Colors.white.withAlpha(245); final statusMsgBubbleColor = Colors.white.withAlpha(245);
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),

View file

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/send_file_dialog.dart'; import 'package:fluffychat/pages/chat/send_file_dialog.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -17,25 +17,25 @@ void onChatTap(Room room, BuildContext context) async {
final inviteAction = await showModalActionSheet<InviteActions>( final inviteAction = await showModalActionSheet<InviteActions>(
context: context, context: context,
message: room.isDirectChat message: room.isDirectChat
? L10n.of(context)!.invitePrivateChat ? L10n.of(context).invitePrivateChat
: L10n.of(context)!.inviteGroupChat, : L10n.of(context).inviteGroupChat,
title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
actions: [ actions: [
SheetAction( SheetAction(
key: InviteActions.accept, key: InviteActions.accept,
label: L10n.of(context)!.accept, label: L10n.of(context).accept,
icon: Icons.check_outlined, icon: Icons.check_outlined,
isDefaultAction: true, isDefaultAction: true,
), ),
SheetAction( SheetAction(
key: InviteActions.decline, key: InviteActions.decline,
label: L10n.of(context)!.decline, label: L10n.of(context).decline,
icon: Icons.close_outlined, icon: Icons.close_outlined,
isDestructiveAction: true, isDestructiveAction: true,
), ),
SheetAction( SheetAction(
key: InviteActions.block, key: InviteActions.block,
label: L10n.of(context)!.block, label: L10n.of(context).block,
icon: Icons.block_outlined, icon: Icons.block_outlined,
isDestructiveAction: true, isDestructiveAction: true,
), ),
@ -70,7 +70,7 @@ void onChatTap(Room room, BuildContext context) async {
if (room.membership == Membership.ban) { if (room.membership == Membership.ban) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(L10n.of(context)!.youHaveBeenBannedFromThisChat), content: Text(L10n.of(context).youHaveBeenBannedFromThisChat),
), ),
); );
return; return;
@ -99,12 +99,12 @@ void onChatTap(Room room, BuildContext context) async {
} else { } else {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.forward, title: L10n.of(context).forward,
message: L10n.of(context)!.forwardMessageTo( message: L10n.of(context).forwardMessageTo(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
), ),
okLabel: L10n.of(context)!.forward, okLabel: L10n.of(context).forward,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (consent == OkCancelResult.cancel) { if (consent == OkCancelResult.cancel) {
Matrix.of(context).shareContent = null; Matrix.of(context).shareContent = null;

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import '../../widgets/layouts/max_width_body.dart'; import '../../widgets/layouts/max_width_body.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
@ -20,10 +20,10 @@ class ChatMembersView extends StatelessWidget {
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.oopsSomethingWentWrong), title: Text(L10n.of(context).oopsSomethingWentWrong),
), ),
body: Center( body: Center(
child: Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat), child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
), ),
); );
} }
@ -39,7 +39,7 @@ class ChatMembersView extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text( title: Text(
L10n.of(context)!.countParticipants(roomCount), L10n.of(context).countParticipants(roomCount),
), ),
actions: [ actions: [
if (room.canInvite) if (room.canInvite)
@ -67,7 +67,7 @@ class ChatMembersView extends StatelessWidget {
OutlinedButton.icon( OutlinedButton.icon(
onPressed: controller.refreshMembers, onPressed: controller.refreshMembers,
icon: const Icon(Icons.refresh_outlined), icon: const Icon(Icons.refresh_outlined),
label: Text(L10n.of(context)!.tryAgain), label: Text(L10n.of(context).tryAgain),
), ),
], ],
), ),
@ -91,7 +91,7 @@ class ChatMembersView extends StatelessWidget {
onChanged: controller.setFilter, onChanged: controller.setFilter,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.search_outlined), prefixIcon: const Icon(Icons.search_outlined),
hintText: L10n.of(context)!.search, hintText: L10n.of(context).search,
), ),
), ),
) )

View file

@ -2,11 +2,11 @@ import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_permissions_settings/chat_permissions_settings_view.dart'; import 'package:fluffychat/pages/chat_permissions_settings/chat_permissions_settings_view.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import 'package:fluffychat/widgets/permission_slider_dialog.dart'; import 'package:fluffychat/widgets/permission_slider_dialog.dart';
@ -31,7 +31,7 @@ class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
final room = Matrix.of(context).client.getRoomById(roomId!)!; final room = Matrix.of(context).client.getRoomById(roomId!)!;
if (!room.canSendEvent(EventTypes.RoomPowerLevels)) { if (!room.canSendEvent(EventTypes.RoomPowerLevels)) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.noPermission)), SnackBar(content: Text(L10n.of(context).noPermission)),
); );
return; return;
} }

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_permissions_settings/chat_permissions_settings.dart'; import 'package:fluffychat/pages/chat_permissions_settings/chat_permissions_settings.dart';
import 'package:fluffychat/pages/chat_permissions_settings/permission_list_tile.dart'; import 'package:fluffychat/pages/chat_permissions_settings/permission_list_tile.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
@ -18,7 +18,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.chatPermissions), title: Text(L10n.of(context).chatPermissions),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: StreamBuilder( child: StreamBuilder(
@ -29,7 +29,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
? null ? null
: Matrix.of(context).client.getRoomById(roomId); : Matrix.of(context).client.getRoomById(roomId);
if (room == null) { if (room == null) {
return Center(child: Text(L10n.of(context)!.noRoomsFound)); return Center(child: Text(L10n.of(context).noRoomsFound));
} }
final powerLevelsContent = Map<String, Object?>.from( final powerLevelsContent = Map<String, Object?>.from(
room.getState(EventTypes.RoomPowerLevels)?.content ?? {}, room.getState(EventTypes.RoomPowerLevels)?.content ?? {},
@ -59,7 +59,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
Divider(color: Theme.of(context).dividerColor), Divider(color: Theme.of(context).dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.notifications, L10n.of(context).notifications,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -94,7 +94,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
Divider(color: Theme.of(context).dividerColor), Divider(color: Theme.of(context).dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.configureChat, L10n.of(context).configureChat,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
class PermissionsListTile extends StatelessWidget { class PermissionsListTile extends StatelessWidget {
final String permissionKey; final String permissionKey;
@ -25,43 +25,43 @@ class PermissionsListTile extends StatelessWidget {
if (category == null) { if (category == null) {
switch (permissionKey) { switch (permissionKey) {
case 'users_default': case 'users_default':
return L10n.of(context)!.defaultPermissionLevel; return L10n.of(context).defaultPermissionLevel;
case 'events_default': case 'events_default':
return L10n.of(context)!.sendMessages; return L10n.of(context).sendMessages;
case 'state_default': case 'state_default':
return L10n.of(context)!.configureChat; return L10n.of(context).configureChat;
case 'ban': case 'ban':
return L10n.of(context)!.banFromChat; return L10n.of(context).banFromChat;
case 'kick': case 'kick':
return L10n.of(context)!.kickFromChat; return L10n.of(context).kickFromChat;
case 'redact': case 'redact':
return L10n.of(context)!.deleteMessage; return L10n.of(context).deleteMessage;
case 'invite': case 'invite':
return L10n.of(context)!.inviteContact; return L10n.of(context).inviteContact;
} }
} else if (category == 'notifications') { } else if (category == 'notifications') {
switch (permissionKey) { switch (permissionKey) {
case 'rooms': case 'rooms':
return L10n.of(context)!.notifications; return L10n.of(context).notifications;
} }
} else if (category == 'events') { } else if (category == 'events') {
switch (permissionKey) { switch (permissionKey) {
case EventTypes.RoomName: case EventTypes.RoomName:
return L10n.of(context)!.changeTheNameOfTheGroup; return L10n.of(context).changeTheNameOfTheGroup;
case EventTypes.RoomPowerLevels: case EventTypes.RoomPowerLevels:
return L10n.of(context)!.chatPermissions; return L10n.of(context).chatPermissions;
case EventTypes.HistoryVisibility: case EventTypes.HistoryVisibility:
return L10n.of(context)!.visibilityOfTheChatHistory; return L10n.of(context).visibilityOfTheChatHistory;
case EventTypes.RoomCanonicalAlias: case EventTypes.RoomCanonicalAlias:
return L10n.of(context)!.setInvitationLink; return L10n.of(context).setInvitationLink;
case EventTypes.RoomAvatar: case EventTypes.RoomAvatar:
return L10n.of(context)!.editRoomAvatar; return L10n.of(context).editRoomAvatar;
case EventTypes.RoomTombstone: case EventTypes.RoomTombstone:
return L10n.of(context)!.replaceRoomWithNewerVersion; return L10n.of(context).replaceRoomWithNewerVersion;
case EventTypes.Encryption: case EventTypes.Encryption:
return L10n.of(context)!.enableEncryption; return L10n.of(context).enableEncryption;
case 'm.room.server_acl': case 'm.room.server_acl':
return L10n.of(context)!.editBlockedServers; return L10n.of(context).editBlockedServers;
} }
} }
return permissionKey; return permissionKey;
@ -72,7 +72,7 @@ class PermissionsListTile extends StatelessWidget {
return ListTile( return ListTile(
title: Text(getLocalizedPowerLevelString(context)), title: Text(getLocalizedPowerLevelString(context)),
subtitle: Text( subtitle: Text(
L10n.of(context)!.minimumPowerLevel(permission.toString()), L10n.of(context).minimumPowerLevel(permission.toString()),
), ),
trailing: Material( trailing: Material(
borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2), borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
@ -86,19 +86,19 @@ class PermissionsListTile extends StatelessWidget {
items: [ items: [
DropdownMenuItem( DropdownMenuItem(
value: 0, value: 0,
child: Text(L10n.of(context)!.user), child: Text(L10n.of(context).user),
), ),
DropdownMenuItem( DropdownMenuItem(
value: 50, value: 50,
child: Text(L10n.of(context)!.moderator), child: Text(L10n.of(context).moderator),
), ),
DropdownMenuItem( DropdownMenuItem(
value: 100, value: 100,
child: Text(L10n.of(context)!.admin), child: Text(L10n.of(context).admin),
), ),
DropdownMenuItem( DropdownMenuItem(
value: null, value: null,
child: Text(L10n.of(context)!.custom), child: Text(L10n.of(context).custom),
), ),
], ],
), ),

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/date_time_extension.dart'; import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
@ -36,9 +36,9 @@ class ChatSearchFilesTab extends StatelessWidget {
const CircularProgressIndicator.adaptive(strokeWidth: 2), const CircularProgressIndicator.adaptive(strokeWidth: 2),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
L10n.of(context)!.searchIn( L10n.of(context).searchIn(
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
), ),
@ -52,7 +52,7 @@ class ChatSearchFilesTab extends StatelessWidget {
children: [ children: [
const Icon(Icons.file_present_outlined, size: 64), const Icon(Icons.file_present_outlined, size: 64),
const SizedBox(height: 8), const SizedBox(height: 8),
Text(L10n.of(context)!.nothingFound), Text(L10n.of(context).nothingFound),
], ],
); );
} }
@ -94,7 +94,7 @@ class ChatSearchFilesTab extends StatelessWidget {
icon: const Icon( icon: const Icon(
Icons.arrow_downward_outlined, Icons.arrow_downward_outlined,
), ),
label: Text(L10n.of(context)!.searchMore), label: Text(L10n.of(context).searchMore),
), ),
), ),
); );
@ -102,7 +102,7 @@ class ChatSearchFilesTab extends StatelessWidget {
final event = events[i]; final event = events[i];
final filename = event.content.tryGet<String>('filename') ?? final filename = event.content.tryGet<String>('filename') ??
event.content.tryGet<String>('body') ?? event.content.tryGet<String>('body') ??
L10n.of(context)!.unknownEvent('File'); L10n.of(context).unknownEvent('File');
final filetype = (filename.contains('.') final filetype = (filename.contains('.')
? filename.split('.').last.toUpperCase() ? filename.split('.').last.toUpperCase()
: event.content : event.content

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat/events/image_bubble.dart'; import 'package:fluffychat/pages/chat/events/image_bubble.dart';
import 'package:fluffychat/pages/chat/events/video_player.dart'; import 'package:fluffychat/pages/chat/events/video_player.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
@ -36,9 +36,9 @@ class ChatSearchImagesTab extends StatelessWidget {
const CircularProgressIndicator.adaptive(strokeWidth: 2), const CircularProgressIndicator.adaptive(strokeWidth: 2),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
L10n.of(context)!.searchIn( L10n.of(context).searchIn(
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
), ),
@ -51,7 +51,7 @@ class ChatSearchImagesTab extends StatelessWidget {
children: [ children: [
const Icon(Icons.photo_outlined, size: 64), const Icon(Icons.photo_outlined, size: 64),
const SizedBox(height: 8), const SizedBox(height: 8),
Text(L10n.of(context)!.nothingFound), Text(L10n.of(context).nothingFound),
], ],
); );
} }
@ -103,7 +103,7 @@ class ChatSearchImagesTab extends StatelessWidget {
icon: const Icon( icon: const Icon(
Icons.arrow_downward_outlined, Icons.arrow_downward_outlined,
), ),
label: Text(L10n.of(context)!.searchMore), label: Text(L10n.of(context).searchMore),
), ),
), ),
); );

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_linkify/flutter_linkify.dart'; import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/date_time_extension.dart'; import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/utils/url_launcher.dart'; import 'package:fluffychat/utils/url_launcher.dart';
@ -40,9 +40,9 @@ class ChatSearchMessageTab extends StatelessWidget {
const Icon(Icons.search_outlined, size: 64), const Icon(Icons.search_outlined, size: 64),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
L10n.of(context)!.searchIn( L10n.of(context).searchIn(
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
), ),
@ -91,7 +91,7 @@ class ChatSearchMessageTab extends StatelessWidget {
icon: const Icon( icon: const Icon(
Icons.arrow_downward_outlined, Icons.arrow_downward_outlined,
), ),
label: Text(L10n.of(context)!.searchMore), label: Text(L10n.of(context).searchMore),
), ),
), ),
); );
@ -99,7 +99,7 @@ class ChatSearchMessageTab extends StatelessWidget {
final event = events[i]; final event = events[i];
final sender = event.senderFromMemoryOrFallback; final sender = event.senderFromMemoryOrFallback;
final displayname = sender.calcDisplayname( final displayname = sender.calcDisplayname(
i18n: MatrixLocals(L10n.of(context)!), i18n: MatrixLocals(L10n.of(context)),
); );
return _MessageSearchResultListTile( return _MessageSearchResultListTile(
sender: sender, sender: sender,
@ -163,7 +163,7 @@ class _MessageSearchResultListTile extends StatelessWidget {
plaintextBody: true, plaintextBody: true,
removeMarkdown: true, removeMarkdown: true,
MatrixLocals( MatrixLocals(
L10n.of(context)!, L10n.of(context),
), ),
) )
.trim(), .trim(),

View file

@ -1,8 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/chat_search/chat_search_files_tab.dart'; import 'package:fluffychat/pages/chat_search/chat_search_files_tab.dart';
import 'package:fluffychat/pages/chat_search/chat_search_images_tab.dart'; import 'package:fluffychat/pages/chat_search/chat_search_images_tab.dart';
import 'package:fluffychat/pages/chat_search/chat_search_message_tab.dart'; import 'package:fluffychat/pages/chat_search/chat_search_message_tab.dart';
@ -20,12 +19,11 @@ class ChatSearchView extends StatelessWidget {
final room = controller.room; final room = controller.room;
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.oopsSomethingWentWrong)), appBar: AppBar(title: Text(L10n.of(context).oopsSomethingWentWrong)),
body: Center( body: Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat),
), ),
), ),
); );
@ -36,8 +34,8 @@ class ChatSearchView extends StatelessWidget {
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
titleSpacing: 0, titleSpacing: 0,
title: Text( title: Text(
L10n.of(context)!.searchIn( L10n.of(context).searchIn(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
), ),
), ),
), ),
@ -57,7 +55,7 @@ class ChatSearchView extends StatelessWidget {
autofocus: true, autofocus: true,
enabled: controller.tabController.index == 0, enabled: controller.tabController.index == 0,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.search, hintText: L10n.of(context).search,
suffixIcon: const Icon(Icons.search_outlined), suffixIcon: const Icon(Icons.search_outlined),
), ),
), ),
@ -65,9 +63,9 @@ class ChatSearchView extends StatelessWidget {
TabBar( TabBar(
controller: controller.tabController, controller: controller.tabController,
tabs: [ tabs: [
Tab(child: Text(L10n.of(context)!.messages)), Tab(child: Text(L10n.of(context).messages)),
Tab(child: Text(L10n.of(context)!.gallery)), Tab(child: Text(L10n.of(context).gallery)),
Tab(child: Text(L10n.of(context)!.files)), Tab(child: Text(L10n.of(context).files)),
], ],
), ),
Expanded( Expanded(

View file

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:collection/collection.dart' show IterableExtension; import 'package:collection/collection.dart' show IterableExtension;
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/encryption/utils/key_verification.dart'; import 'package:matrix/encryption/utils/key_verification.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/device_settings/device_settings_view.dart'; import 'package:fluffychat/pages/device_settings/device_settings_view.dart';
import 'package:fluffychat/pages/key_verification/key_verification_dialog.dart'; import 'package:fluffychat/pages/key_verification/key_verification_dialog.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
@ -35,10 +35,10 @@ class DevicesSettingsController extends State<DevicesSettings> {
void removeDevicesAction(List<Device> devices) async { void removeDevicesAction(List<Device> devices) async {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
message: L10n.of(context)!.removeDevicesDescription, message: L10n.of(context).removeDevicesDescription,
) == ) ==
OkCancelResult.cancel) return; OkCancelResult.cancel) return;
final matrix = Matrix.of(context); final matrix = Matrix.of(context);
@ -70,9 +70,9 @@ class DevicesSettingsController extends State<DevicesSettings> {
void renameDeviceAction(Device device) async { void renameDeviceAction(Device device) async {
final displayName = await showTextInputDialog( final displayName = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.changeDeviceName, title: L10n.of(context).changeDeviceName,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: device.displayName, hintText: device.displayName,
@ -94,10 +94,10 @@ class DevicesSettingsController extends State<DevicesSettings> {
void verifyDeviceAction(Device device) async { void verifyDeviceAction(Device device) async {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.verifyOtherDevice, title: L10n.of(context).verifyOtherDevice,
message: L10n.of(context)!.verifyOtherDeviceDescription, message: L10n.of(context).verifyOtherDeviceDescription,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;

View file

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/device_settings/device_settings.dart'; import 'package:fluffychat/pages/device_settings/device_settings.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import 'user_device_list_item.dart'; import 'user_device_list_item.dart';
@ -16,7 +15,7 @@ class DevicesSettingsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.devices), title: Text(L10n.of(context).devices),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: FutureBuilder<bool>( child: FutureBuilder<bool>(
@ -55,7 +54,7 @@ class DevicesSettingsView extends StatelessWidget {
), ),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
L10n.of(context)!.thisDevice, L10n.of(context).thisDevice,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
@ -83,7 +82,7 @@ class DevicesSettingsView extends StatelessWidget {
child: TextButton.icon( child: TextButton.icon(
label: Text( label: Text(
controller.errorDeletingDevices ?? controller.errorDeletingDevices ??
L10n.of(context)!.removeAllOtherDevices, L10n.of(context).removeAllOtherDevices,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Theme.of(context) foregroundColor: Theme.of(context)
@ -110,7 +109,7 @@ class DevicesSettingsView extends StatelessWidget {
Center( Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Text(L10n.of(context)!.noOtherDevicesFound), child: Text(L10n.of(context).noOtherDevicesFound),
), ),
), ),
], ],

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import '../../utils/date_time_extension.dart'; import '../../utils/date_time_extension.dart';
import '../../utils/matrix_sdk_extensions/device_extension.dart'; import '../../utils/matrix_sdk_extensions/device_extension.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
@ -55,30 +55,30 @@ class UserDeviceListItem extends StatelessWidget {
actions: [ actions: [
SheetAction( SheetAction(
key: UserDeviceListItemAction.rename, key: UserDeviceListItemAction.rename,
label: L10n.of(context)!.changeDeviceName, label: L10n.of(context).changeDeviceName,
), ),
if (!isOwnDevice && keys != null) ...{ if (!isOwnDevice && keys != null) ...{
SheetAction( SheetAction(
key: UserDeviceListItemAction.verify, key: UserDeviceListItemAction.verify,
label: L10n.of(context)!.verifyStart, label: L10n.of(context).verifyStart,
), ),
if (!keys.blocked) if (!keys.blocked)
SheetAction( SheetAction(
key: UserDeviceListItemAction.block, key: UserDeviceListItemAction.block,
label: L10n.of(context)!.blockDevice, label: L10n.of(context).blockDevice,
isDestructiveAction: true, isDestructiveAction: true,
), ),
if (keys.blocked) if (keys.blocked)
SheetAction( SheetAction(
key: UserDeviceListItemAction.unblock, key: UserDeviceListItemAction.unblock,
label: L10n.of(context)!.unblockDevice, label: L10n.of(context).unblockDevice,
isDestructiveAction: true, isDestructiveAction: true,
), ),
}, },
if (!isOwnDevice) if (!isOwnDevice)
SheetAction( SheetAction(
key: UserDeviceListItemAction.remove, key: UserDeviceListItemAction.remove,
label: L10n.of(context)!.delete, label: L10n.of(context).delete,
isDestructiveAction: true, isDestructiveAction: true,
), ),
], ],
@ -119,7 +119,7 @@ class UserDeviceListItem extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.lastActiveAgo( L10n.of(context).lastActiveAgo(
DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs ?? 0) DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs ?? 0)
.localizedTimeShort(context), .localizedTimeShort(context),
), ),
@ -129,10 +129,10 @@ class UserDeviceListItem extends StatelessWidget {
? null ? null
: Text( : Text(
keys.blocked keys.blocked
? L10n.of(context)!.blocked ? L10n.of(context).blocked
: keys.verified : keys.verified
? L10n.of(context)!.verified ? L10n.of(context).verified
: L10n.of(context)!.unverified, : L10n.of(context).unverified,
style: TextStyle( style: TextStyle(
color: keys.blocked color: keys.blocked
? Colors.red ? Colors.red

View file

@ -24,12 +24,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_foreground_task/flutter_foreground_task.dart'; import 'package:flutter_foreground_task/flutter_foreground_task.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart' hide VideoRenderer; import 'package:flutter_webrtc/flutter_webrtc.dart' hide VideoRenderer;
import 'package:just_audio/just_audio.dart'; import 'package:just_audio/just_audio.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:wakelock_plus/wakelock_plus.dart'; import 'package:wakelock_plus/wakelock_plus.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/utils/voip/video_renderer.dart'; import 'package:fluffychat/utils/voip/video_renderer.dart';
@ -134,7 +134,7 @@ class MyCallingPage extends State<Calling> {
Room? get room => call.room; Room? get room => call.room;
String get displayName => call.room.getLocalizedDisplayname( String get displayName => call.room.getLocalizedDisplayname(
MatrixLocals(L10n.of(widget.context)!), MatrixLocals(L10n.of(widget.context)),
); );
String get callId => widget.callId; String get callId => widget.callId;
@ -296,14 +296,14 @@ class MyCallingPage extends State<Calling> {
channelId: 'notification_channel_id', channelId: 'notification_channel_id',
channelName: 'Foreground Notification', channelName: 'Foreground Notification',
channelDescription: channelDescription:
L10n.of(widget.context)!.foregroundServiceRunning, L10n.of(widget.context).foregroundServiceRunning,
), ),
iosNotificationOptions: const IOSNotificationOptions(), iosNotificationOptions: const IOSNotificationOptions(),
foregroundTaskOptions: const ForegroundTaskOptions(), foregroundTaskOptions: const ForegroundTaskOptions(),
); );
FlutterForegroundTask.startService( FlutterForegroundTask.startService(
notificationTitle: L10n.of(widget.context)!.screenSharingTitle, notificationTitle: L10n.of(widget.context).screenSharingTitle,
notificationText: L10n.of(widget.context)!.screenSharingDetail, notificationText: L10n.of(widget.context).screenSharingDetail,
); );
} else { } else {
FlutterForegroundTask.stopService(); FlutterForegroundTask.stopService();
@ -457,7 +457,7 @@ class MyCallingPage extends State<Calling> {
var title = ''; var title = '';
if (call.localHold) { if (call.localHold) {
title = '${call.room.getLocalizedDisplayname( title = '${call.room.getLocalizedDisplayname(
MatrixLocals(L10n.of(widget.context)!), MatrixLocals(L10n.of(widget.context)),
)} held the call.'; )} held the call.';
} else if (call.remoteOnHold) { } else if (call.remoteOnHold) {
title = 'You held the call.'; title = 'You held the call.';

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart'; import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/homeserver_picker/public_homeserver.dart'; import 'package:fluffychat/pages/homeserver_picker/public_homeserver.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'homeserver_bottom_sheet.dart'; import 'homeserver_bottom_sheet.dart';
@ -30,11 +30,11 @@ class HomeserverAppBar extends StatelessWidget {
), ),
emptyBuilder: (context) => ListTile( emptyBuilder: (context) => ListTile(
leading: const Icon(Icons.search_outlined), leading: const Icon(Icons.search_outlined),
title: Text(L10n.of(context)!.nothingFound), title: Text(L10n.of(context).nothingFound),
), ),
loadingBuilder: (context) => ListTile( loadingBuilder: (context) => ListTile(
leading: const CircularProgressIndicator.adaptive(strokeWidth: 2), leading: const CircularProgressIndicator.adaptive(strokeWidth: 2),
title: Text(L10n.of(context)!.loadingPleaseWait), title: Text(L10n.of(context).loadingPleaseWait),
), ),
errorBuilder: (context, error) => ListTile( errorBuilder: (context, error) => ListTile(
leading: const Icon(Icons.error_outlined), leading: const Icon(Icons.error_outlined),
@ -92,10 +92,10 @@ class HomeserverAppBar extends StatelessWidget {
) )
: null, : null,
fillColor: FluffyThemes.isColumnMode(context) fillColor: FluffyThemes.isColumnMode(context)
? Theme.of(context).colorScheme.background ? Theme.of(context).colorScheme.surface
: Theme.of(context).colorScheme.surfaceVariant, : Theme.of(context).colorScheme.surfaceContainerHighest,
prefixText: '${L10n.of(context)!.homeserver}: ', prefixText: '${L10n.of(context).homeserver}: ',
hintText: L10n.of(context)!.enterYourHomeserver, hintText: L10n.of(context).enterYourHomeserver,
suffixIcon: const Icon(Icons.search), suffixIcon: const Icon(Icons.search),
), ),
textInputAction: TextInputAction.search, textInputAction: TextInputAction.search,

View file

@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; import 'package:flutter_web_auth_2/flutter_web_auth_2.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
@ -15,6 +14,7 @@ import 'package:matrix/matrix.dart';
import 'package:universal_html/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/homeserver_picker/homeserver_picker_view.dart'; import 'package:fluffychat/pages/homeserver_picker/homeserver_picker_view.dart';
import 'package:fluffychat/pages/homeserver_picker/public_homeserver.dart'; import 'package:fluffychat/pages/homeserver_picker/public_homeserver.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
@ -51,8 +51,8 @@ class HomeserverPickerController extends State<HomeserverPicker> {
(e, s) async { (e, s) async {
await showOkAlertDialog( await showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.indexedDbErrorTitle, title: L10n.of(context).indexedDbErrorTitle,
message: L10n.of(context)!.indexedDbErrorLong, message: L10n.of(context).indexedDbErrorLong,
); );
_checkTorBrowser(); _checkTorBrowser();
}, },

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/layouts/login_scaffold.dart'; import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import '../../config/themes.dart'; import '../../config/themes.dart';
@ -32,7 +32,7 @@ class HomeserverPickerView extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
titleSpacing: 12, titleSpacing: 12,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
surfaceTintColor: Theme.of(context).colorScheme.background, surfaceTintColor: Theme.of(context).colorScheme.surface,
title: HomeserverAppBar(controller: controller), title: HomeserverAppBar(controller: controller),
), ),
body: Column( body: Column(
@ -53,8 +53,8 @@ class HomeserverPickerView extends StatelessWidget {
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.surface,
child: ListTile( child: ListTile(
leading: const Icon(Icons.vpn_key), leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.hydrateTor), title: Text(L10n.of(context).hydrateTor),
subtitle: Text(L10n.of(context)!.hydrateTorLong), subtitle: Text(L10n.of(context).hydrateTorLong),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
onTap: controller.restoreBackup, onTap: controller.restoreBackup,
), ),
@ -87,7 +87,7 @@ class HomeserverPickerView extends StatelessWidget {
), ),
Center( Center(
child: Text( child: Text(
L10n.of(context)! L10n.of(context)
.pleaseTryAgainLaterOrChooseDifferentServer, .pleaseTryAgainLaterOrChooseDifferentServer,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
@ -134,10 +134,10 @@ class HomeserverPickerView extends StatelessWidget {
//isThumbnail: false, //isThumbnail: false,
), ),
), ),
label: L10n.of(context)!.signInWith( label: L10n.of(context).signInWith(
provider.name ?? provider.name ??
provider.brand ?? provider.brand ??
L10n.of(context)!.singlesignon, L10n.of(context).singlesignon,
), ),
onPressed: () => onPressed: () =>
controller.ssoLoginAction(provider.id), controller.ssoLoginAction(provider.id),
@ -147,7 +147,7 @@ class HomeserverPickerView extends StatelessWidget {
if (controller.supportsPasswordLogin) if (controller.supportsPasswordLogin)
_LoginButton( _LoginButton(
onPressed: controller.login, onPressed: controller.login,
label: L10n.of(context)!.signInWithPassword, label: L10n.of(context).signInWithPassword,
icon: const Icon(Icons.lock_open_outlined, size: 16), icon: const Icon(Icons.lock_open_outlined, size: 16),
), ),
if (regLink != null) if (regLink != null)
@ -157,11 +157,11 @@ class HomeserverPickerView extends StatelessWidget {
Icons.open_in_new_outlined, Icons.open_in_new_outlined,
size: 16, size: 16,
), ),
label: L10n.of(context)!.register, label: L10n.of(context).register,
), ),
_LoginButton( _LoginButton(
onPressed: controller.restoreBackup, onPressed: controller.restoreBackup,
label: L10n.of(context)!.hydrate, label: L10n.of(context).hydrate,
withBorder: false, withBorder: false,
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -207,9 +207,9 @@ class _LoginButton extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
foregroundColor: Theme.of(context).colorScheme.onBackground, foregroundColor: Theme.of(context).colorScheme.onSurface,
backgroundColor: withBorder backgroundColor: withBorder
? Theme.of(context).colorScheme.background ? Theme.of(context).colorScheme.surface
: Colors.transparent, : Colors.transparent,
), ),
onPressed: onPressed, onPressed: onPressed,

View file

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/mxc_image.dart'; import 'package:fluffychat/widgets/mxc_image.dart';
import 'image_viewer.dart'; import 'image_viewer.dart';
@ -22,7 +21,7 @@ class ImageViewerView extends StatelessWidget {
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop, onPressed: Navigator.of(context).pop,
color: Colors.white, color: Colors.white,
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
), ),
backgroundColor: const Color(0x44000000), backgroundColor: const Color(0x44000000),
actions: [ actions: [
@ -30,20 +29,20 @@ class ImageViewerView extends StatelessWidget {
icon: const Icon(Icons.reply_outlined), icon: const Icon(Icons.reply_outlined),
onPressed: controller.forwardAction, onPressed: controller.forwardAction,
color: Colors.white, color: Colors.white,
tooltip: L10n.of(context)!.share, tooltip: L10n.of(context).share,
), ),
IconButton( IconButton(
icon: const Icon(Icons.download_outlined), icon: const Icon(Icons.download_outlined),
onPressed: () => controller.saveFileAction(context), onPressed: () => controller.saveFileAction(context),
color: Colors.white, color: Colors.white,
tooltip: L10n.of(context)!.downloadFile, tooltip: L10n.of(context).downloadFile,
), ),
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
// Use builder context to correctly position the share dialog on iPad // Use builder context to correctly position the share dialog on iPad
Builder( Builder(
builder: (context) => IconButton( builder: (context) => IconButton(
onPressed: () => controller.shareFileAction(context), onPressed: () => controller.shareFileAction(context),
tooltip: L10n.of(context)!.share, tooltip: L10n.of(context).share,
color: Colors.white, color: Colors.white,
icon: Icon(Icons.adaptive.share_outlined), icon: Icon(Icons.adaptive.share_outlined),
), ),

View file

@ -3,10 +3,10 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/invitation_selection/invitation_selection_view.dart'; import 'package:fluffychat/pages/invitation_selection/invitation_selection_view.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -57,15 +57,15 @@ class InvitationSelectionController extends State<InvitationSelection> {
if (OkCancelResult.ok != if (OkCancelResult.ok !=
await showOkCancelAlertDialog( await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.inviteContact, title: L10n.of(context).inviteContact,
message: L10n.of(context)!.inviteContactToGroupQuestion( message: L10n.of(context).inviteContactToGroupQuestion(
displayname, displayname,
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
okLabel: L10n.of(context)!.invite, okLabel: L10n.of(context).invite,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
)) { )) {
return; return;
} }
@ -76,7 +76,7 @@ class InvitationSelectionController extends State<InvitationSelection> {
if (success.error == null) { if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(L10n.of(context)!.contactHasBeenInvitedToTheGroup), content: Text(L10n.of(context).contactHasBeenInvitedToTheGroup),
), ),
); );
} }

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/invitation_selection/invitation_selection.dart'; import 'package:fluffychat/pages/invitation_selection/invitation_selection.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
@ -20,20 +20,20 @@ class InvitationSelectionView extends StatelessWidget {
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.oopsSomethingWentWrong), title: Text(L10n.of(context).oopsSomethingWentWrong),
), ),
body: Center( body: Center(
child: Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat), child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
), ),
); );
} }
final groupName = room.name.isEmpty ? L10n.of(context)!.group : room.name; final groupName = room.name.isEmpty ? L10n.of(context).group : room.name;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
titleSpacing: 0, titleSpacing: 0,
title: Text(L10n.of(context)!.inviteContact), title: Text(L10n.of(context).inviteContact),
), ),
body: MaxWidthBody( body: MaxWidthBody(
innerPadding: const EdgeInsets.symmetric(vertical: 8), innerPadding: const EdgeInsets.symmetric(vertical: 8),
@ -44,7 +44,7 @@ class InvitationSelectionView extends StatelessWidget {
child: TextField( child: TextField(
textInputAction: TextInputAction.search, textInputAction: TextInputAction.search,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.inviteContactToGroup(groupName), hintText: L10n.of(context).inviteContactToGroup(groupName),
prefixIcon: controller.loading prefixIcon: controller.loading
? const Padding( ? const Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -80,7 +80,7 @@ class InvitationSelectionView extends StatelessWidget {
displayname: controller displayname: controller
.foundProfiles[i].displayName ?? .foundProfiles[i].displayName ??
controller.foundProfiles[i].userId.localpart ?? controller.foundProfiles[i].userId.localpart ??
L10n.of(context)!.user, L10n.of(context).user,
userId: controller.foundProfiles[i].userId, userId: controller.foundProfiles[i].userId,
isMember: participants isMember: participants
.contains(controller.foundProfiles[i].userId), .contains(controller.foundProfiles[i].userId),
@ -89,7 +89,7 @@ class InvitationSelectionView extends StatelessWidget {
controller.foundProfiles[i].userId, controller.foundProfiles[i].userId,
controller.foundProfiles[i].displayName ?? controller.foundProfiles[i].displayName ??
controller.foundProfiles[i].userId.localpart ?? controller.foundProfiles[i].userId.localpart ??
L10n.of(context)!.user, L10n.of(context).user,
), ),
), ),
) )
@ -113,7 +113,7 @@ class InvitationSelectionView extends StatelessWidget {
avatarUrl: contacts[i].avatarUrl, avatarUrl: contacts[i].avatarUrl,
displayname: contacts[i].displayName ?? displayname: contacts[i].displayName ??
contacts[i].id.localpart ?? contacts[i].id.localpart ??
L10n.of(context)!.user, L10n.of(context).user,
userId: contacts[i].id, userId: contacts[i].id,
isMember: participants.contains(contacts[i].id), isMember: participants.contains(contacts[i].id),
onTap: () => controller.inviteAction( onTap: () => controller.inviteAction(
@ -121,7 +121,7 @@ class InvitationSelectionView extends StatelessWidget {
contacts[i].id, contacts[i].id,
contacts[i].displayName ?? contacts[i].displayName ??
contacts[i].id.localpart ?? contacts[i].id.localpart ??
L10n.of(context)!.user, L10n.of(context).user,
), ),
), ),
); );
@ -176,7 +176,7 @@ class _InviteContactListTile extends StatelessWidget {
), ),
onTap: isMember ? null : onTap, onTap: isMember ? null : onTap,
trailing: isMember trailing: isMember
? Text(L10n.of(context)!.participant) ? Text(L10n.of(context).participant)
: const Icon(Icons.person_add_outlined), : const Icon(Icons.person_add_outlined),
), ),
); );

View file

@ -5,11 +5,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/encryption.dart'; import 'package:matrix/encryption.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
class KeyVerificationDialog extends StatefulWidget { class KeyVerificationDialog extends StatefulWidget {
@ -87,7 +87,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
await showOkAlertDialog( await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.incorrectPassphraseOrKey, message: L10n.of(context).incorrectPassphraseOrKey,
); );
} }
} }
@ -104,7 +104,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
} }
final displayName = final displayName =
user?.calcDisplayname() ?? widget.request.userId.localpart!; user?.calcDisplayname() ?? widget.request.userId.localpart!;
var title = Text(L10n.of(context)!.verifyTitle); var title = Text(L10n.of(context).verifyTitle);
Widget body; Widget body;
final buttons = <Widget>[]; final buttons = <Widget>[];
@ -122,7 +122,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Text( Text(
L10n.of(context)!.askSSSSSign, L10n.of(context).askSSSSSign,
style: const TextStyle(fontSize: 20), style: const TextStyle(fontSize: 20),
), ),
Container(height: 10), Container(height: 10),
@ -138,7 +138,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
maxLines: 1, maxLines: 1,
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.passphraseOrKey, hintText: L10n.of(context).passphraseOrKey,
prefixStyle: prefixStyle:
TextStyle(color: Theme.of(context).colorScheme.primary), TextStyle(color: Theme.of(context).colorScheme.primary),
suffixStyle: suffixStyle:
@ -152,7 +152,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton( TextButton(
child: Text( child: Text(
L10n.of(context)!.submit, L10n.of(context).submit,
), ),
onPressed: () => checkInput(textEditingController.text), onPressed: () => checkInput(textEditingController.text),
), ),
@ -160,14 +160,14 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton( TextButton(
child: Text( child: Text(
L10n.of(context)!.skip, L10n.of(context).skip,
), ),
onPressed: () => widget.request.openSSSS(skip: true), onPressed: () => widget.request.openSSSS(skip: true),
), ),
); );
break; break;
case KeyVerificationState.askAccept: case KeyVerificationState.askAccept:
title = Text(L10n.of(context)!.newVerificationRequest); title = Text(L10n.of(context).newVerificationRequest);
body = Column( body = Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -179,7 +179,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
L10n.of(context)!.askVerificationRequest(displayName), L10n.of(context).askVerificationRequest(displayName),
), ),
], ],
); );
@ -187,7 +187,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
TextButton.icon( TextButton.icon(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
style: TextButton.styleFrom(foregroundColor: Colors.red), style: TextButton.styleFrom(foregroundColor: Colors.red),
label: Text(L10n.of(context)!.reject), label: Text(L10n.of(context).reject),
onPressed: () => widget.request onPressed: () => widget.request
.rejectVerification() .rejectVerification()
.then((_) => Navigator.of(context, rootNavigator: false).pop()), .then((_) => Navigator.of(context, rootNavigator: false).pop()),
@ -196,7 +196,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton.icon( TextButton.icon(
icon: const Icon(Icons.check), icon: const Icon(Icons.check),
label: Text(L10n.of(context)!.accept), label: Text(L10n.of(context).accept),
onPressed: () => widget.request.acceptVerification(), onPressed: () => widget.request.acceptVerification(),
), ),
); );
@ -222,7 +222,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
L10n.of(context)!.waitingPartnerAcceptRequest, L10n.of(context).waitingPartnerAcceptRequest,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
], ],
@ -231,7 +231,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton.icon( TextButton.icon(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
label: Text(L10n.of(context)!.cancel), label: Text(L10n.of(context).cancel),
onPressed: () => widget.request.cancel(), onPressed: () => widget.request.cancel(),
), ),
); );
@ -244,7 +244,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
if (widget.request.sasTypes.contains('emoji')) { if (widget.request.sasTypes.contains('emoji')) {
title = Text( title = Text(
L10n.of(context)!.compareEmojiMatch, L10n.of(context).compareEmojiMatch,
maxLines: 1, maxLines: 1,
style: const TextStyle(fontSize: 16), style: const TextStyle(fontSize: 16),
); );
@ -254,7 +254,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
.toList(), .toList(),
); );
} else { } else {
title = Text(L10n.of(context)!.compareNumbersMatch); title = Text(L10n.of(context).compareNumbersMatch);
final numbers = widget.request.sasNumbers; final numbers = widget.request.sasNumbers;
final numbstr = '${numbers[0]}-${numbers[1]}-${numbers[2]}'; final numbstr = '${numbers[0]}-${numbers[1]}-${numbers[2]}';
compareWidget = compareWidget =
@ -275,22 +275,22 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Colors.red, foregroundColor: Colors.red,
), ),
label: Text(L10n.of(context)!.theyDontMatch), label: Text(L10n.of(context).theyDontMatch),
onPressed: () => widget.request.rejectSas(), onPressed: () => widget.request.rejectSas(),
), ),
); );
buttons.add( buttons.add(
TextButton.icon( TextButton.icon(
icon: const Icon(Icons.check_outlined), icon: const Icon(Icons.check_outlined),
label: Text(L10n.of(context)!.theyMatch), label: Text(L10n.of(context).theyMatch),
onPressed: () => widget.request.acceptSas(), onPressed: () => widget.request.acceptSas(),
), ),
); );
break; break;
case KeyVerificationState.waitingSas: case KeyVerificationState.waitingSas:
final acceptText = widget.request.sasTypes.contains('emoji') final acceptText = widget.request.sasTypes.contains('emoji')
? L10n.of(context)!.waitingPartnerEmoji ? L10n.of(context).waitingPartnerEmoji
: L10n.of(context)!.waitingPartnerNumbers; : L10n.of(context).waitingPartnerNumbers;
body = Column( body = Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
@ -314,7 +314,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
L10n.of(context)!.verifySuccess, L10n.of(context).verifySuccess,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
], ],
@ -322,7 +322,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton( TextButton(
child: Text( child: Text(
L10n.of(context)!.close, L10n.of(context).close,
), ),
onPressed: () => Navigator.of(context, rootNavigator: false).pop(), onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
), ),
@ -345,7 +345,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton( TextButton(
child: Text( child: Text(
L10n.of(context)!.close, L10n.of(context).close,
), ),
onPressed: () => Navigator.of(context, rootNavigator: false).pop(), onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
), ),

View file

@ -3,10 +3,10 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import '../../utils/platform_infos.dart'; import '../../utils/platform_infos.dart';
@ -33,12 +33,12 @@ class LoginController extends State<Login> {
void login() async { void login() async {
final matrix = Matrix.of(context); final matrix = Matrix.of(context);
if (usernameController.text.isEmpty) { if (usernameController.text.isEmpty) {
setState(() => usernameError = L10n.of(context)!.pleaseEnterYourUsername); setState(() => usernameError = L10n.of(context).pleaseEnterYourUsername);
} else { } else {
setState(() => usernameError = null); setState(() => usernameError = null);
} }
if (passwordController.text.isEmpty) { if (passwordController.text.isEmpty) {
setState(() => passwordError = L10n.of(context)!.pleaseEnterYourPassword); setState(() => passwordError = L10n.of(context).pleaseEnterYourPassword);
} else { } else {
setState(() => passwordError = null); setState(() => passwordError = null);
} }
@ -128,10 +128,9 @@ class LoginController extends State<Login> {
final dialogResult = await showOkCancelAlertDialog( final dialogResult = await showOkCancelAlertDialog(
context: context, context: context,
useRootNavigator: false, useRootNavigator: false,
message: message: L10n.of(context).noMatrixServer(newDomain, oldHomeserver!),
L10n.of(context)!.noMatrixServer(newDomain, oldHomeserver!), okLabel: L10n.of(context).ok,
okLabel: L10n.of(context)!.ok, cancelLabel: L10n.of(context).cancel,
cancelLabel: L10n.of(context)!.cancel,
); );
if (dialogResult == OkCancelResult.ok) { if (dialogResult == OkCancelResult.ok) {
if (mounted) setState(() => usernameError = null); if (mounted) setState(() => usernameError = null);
@ -159,16 +158,16 @@ class LoginController extends State<Login> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.passwordForgotten, title: L10n.of(context).passwordForgotten,
message: L10n.of(context)!.enterAnEmailAddress, message: L10n.of(context).enterAnEmailAddress,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
textFields: [ textFields: [
DialogTextField( DialogTextField(
initialText: initialText:
usernameController.text.isEmail ? usernameController.text : '', usernameController.text.isEmail ? usernameController.text : '',
hintText: L10n.of(context)!.enterAnEmailAddress, hintText: L10n.of(context).enterAnEmailAddress,
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
), ),
], ],
@ -188,10 +187,10 @@ class LoginController extends State<Login> {
final password = await showTextInputDialog( final password = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.passwordForgotten, title: L10n.of(context).passwordForgotten,
message: L10n.of(context)!.chooseAStrongPassword, message: L10n.of(context).chooseAStrongPassword,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
textFields: [ textFields: [
const DialogTextField( const DialogTextField(
@ -206,9 +205,9 @@ class LoginController extends State<Login> {
final ok = await showOkAlertDialog( final ok = await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.weSentYouAnEmail, title: L10n.of(context).weSentYouAnEmail,
message: L10n.of(context)!.pleaseClickOnLink, message: L10n.of(context).pleaseClickOnLink,
okLabel: L10n.of(context)!.iHaveClickedOnLink, okLabel: L10n.of(context).iHaveClickedOnLink,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
); );
if (ok != OkCancelResult.ok) return; if (ok != OkCancelResult.ok) return;
@ -233,7 +232,7 @@ class LoginController extends State<Login> {
); );
if (success.error == null) { if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.passwordHasBeenChanged)), SnackBar(content: Text(L10n.of(context).passwordHasBeenChanged)),
); );
usernameController.text = input.single; usernameController.text = input.single;
passwordController.text = password.single; passwordController.text = password.single;

View file

@ -1,8 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/layouts/login_scaffold.dart'; import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import 'login.dart'; import 'login.dart';
@ -19,12 +18,12 @@ class LoginView extends StatelessWidget {
.homeserver .homeserver
.toString() .toString()
.replaceFirst('https://', ''); .replaceFirst('https://', '');
final title = L10n.of(context)!.logInTo(homeserver); final title = L10n.of(context).logInTo(homeserver);
final titleParts = title.split(homeserver); final titleParts = title.split(homeserver);
final textFieldFillColor = FluffyThemes.isColumnMode(context) final textFieldFillColor = FluffyThemes.isColumnMode(context)
? Theme.of(context).colorScheme.background ? Theme.of(context).colorScheme.surface
: Theme.of(context).colorScheme.surfaceVariant; : Theme.of(context).colorScheme.surfaceContainerHighest;
return LoginScaffold( return LoginScaffold(
enforceMobileMode: Matrix.of(context).client.isLogged(), enforceMobileMode: Matrix.of(context).client.isLogged(),
@ -71,7 +70,7 @@ class LoginView extends StatelessWidget {
errorText: controller.usernameError, errorText: controller.usernameError,
errorStyle: const TextStyle(color: Colors.orange), errorStyle: const TextStyle(color: Colors.orange),
fillColor: textFieldFillColor, fillColor: textFieldFillColor,
hintText: L10n.of(context)!.emailOrUsername, hintText: L10n.of(context).emailOrUsername,
), ),
), ),
), ),
@ -101,7 +100,7 @@ class LoginView extends StatelessWidget {
color: Colors.black, color: Colors.black,
), ),
), ),
hintText: L10n.of(context)!.password, hintText: L10n.of(context).password,
), ),
), ),
), ),
@ -117,7 +116,7 @@ class LoginView extends StatelessWidget {
icon: const Icon(Icons.login_outlined), icon: const Icon(Icons.login_outlined),
label: controller.loading label: controller.loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Text(L10n.of(context)!.login), : Text(L10n.of(context).login),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -131,7 +130,7 @@ class LoginView extends StatelessWidget {
foregroundColor: Theme.of(context).colorScheme.error, foregroundColor: Theme.of(context).colorScheme.error,
), ),
icon: const Icon(Icons.safety_check_outlined), icon: const Icon(Icons.safety_check_outlined),
label: Text(L10n.of(context)!.passwordForgotten), label: Text(L10n.of(context).passwordForgotten),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),

View file

@ -1,8 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/new_group/new_group.dart'; import 'package:fluffychat/pages/new_group/new_group.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
@ -24,7 +23,7 @@ class NewGroupView extends StatelessWidget {
onPressed: controller.loading ? null : Navigator.of(context).pop, onPressed: controller.loading ? null : Navigator.of(context).pop,
), ),
), ),
title: Text(L10n.of(context)!.createGroup), title: Text(L10n.of(context).createGroup),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: Column( child: Column(
@ -61,7 +60,7 @@ class NewGroupView extends StatelessWidget {
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.people_outlined), prefixIcon: const Icon(Icons.people_outlined),
hintText: L10n.of(context)!.groupName, hintText: L10n.of(context).groupName,
), ),
), ),
), ),
@ -78,14 +77,14 @@ class NewGroupView extends StatelessWidget {
maxLength: 255, maxLength: 255,
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.addChatDescription, hintText: L10n.of(context).addChatDescription,
), ),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
SwitchListTile.adaptive( SwitchListTile.adaptive(
secondary: const Icon(Icons.public_outlined), secondary: const Icon(Icons.public_outlined),
title: Text(L10n.of(context)!.groupIsPublic), title: Text(L10n.of(context).groupIsPublic),
value: controller.publicGroup, value: controller.publicGroup,
onChanged: controller.loading ? null : controller.setPublicGroup, onChanged: controller.loading ? null : controller.setPublicGroup,
), ),
@ -94,7 +93,7 @@ class NewGroupView extends StatelessWidget {
child: controller.publicGroup child: controller.publicGroup
? SwitchListTile.adaptive( ? SwitchListTile.adaptive(
secondary: const Icon(Icons.search_outlined), secondary: const Icon(Icons.search_outlined),
title: Text(L10n.of(context)!.groupCanBeFoundViaSearch), title: Text(L10n.of(context).groupCanBeFoundViaSearch),
value: controller.groupCanBeFound, value: controller.groupCanBeFound,
onChanged: controller.loading onChanged: controller.loading
? null ? null
@ -105,12 +104,12 @@ class NewGroupView extends StatelessWidget {
SwitchListTile.adaptive( SwitchListTile.adaptive(
secondary: Icon( secondary: Icon(
Icons.lock_outlined, Icons.lock_outlined,
color: Theme.of(context).colorScheme.onBackground, color: Theme.of(context).colorScheme.onSurface,
), ),
title: Text( title: Text(
L10n.of(context)!.enableEncryption, L10n.of(context).enableEncryption,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.onBackground, color: Theme.of(context).colorScheme.onSurface,
), ),
), ),
value: !controller.publicGroup, value: !controller.publicGroup,
@ -133,7 +132,7 @@ class NewGroupView extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
L10n.of(context)!.createGroupAndInviteUsers, L10n.of(context).createGroupAndInviteUsers,
), ),
), ),
Icon(Icons.adaptive.arrow_forward_outlined), Icon(Icons.adaptive.arrow_forward_outlined),

View file

@ -4,9 +4,9 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/new_private_chat/new_private_chat_view.dart'; import 'package:fluffychat/pages/new_private_chat/new_private_chat_view.dart';
import 'package:fluffychat/pages/new_private_chat/qr_scanner_modal.dart'; import 'package:fluffychat/pages/new_private_chat/qr_scanner_modal.dart';
import 'package:fluffychat/pages/user_bottom_sheet/user_bottom_sheet.dart'; import 'package:fluffychat/pages/user_bottom_sheet/user_bottom_sheet.dart';
@ -74,7 +74,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
L10n.of(context)!.unsupportedAndroidVersionLong, L10n.of(context).unsupportedAndroidVersionLong,
), ),
), ),
); );
@ -94,7 +94,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
ClipboardData(text: Matrix.of(context).client.userID!), ClipboardData(text: Matrix.of(context).client.userID!),
); );
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.copiedToClipboard)), SnackBar(content: Text(L10n.of(context).copiedToClipboard)),
); );
} }

View file

@ -1,12 +1,12 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:pretty_qr_code/pretty_qr_code.dart'; import 'package:pretty_qr_code/pretty_qr_code.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/new_private_chat/new_private_chat.dart'; import 'package:fluffychat/pages/new_private_chat/new_private_chat.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
@ -27,13 +27,13 @@ class NewPrivateChatView extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
scrolledUnderElevation: 0, scrolledUnderElevation: 0,
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.newChat), title: Text(L10n.of(context).newChat),
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
actions: [ actions: [
TextButton( TextButton(
onPressed: onPressed:
UrlLauncher(context, AppConfig.startChatTutorial).launchUrl, UrlLauncher(context, AppConfig.startChatTutorial).launchUrl,
child: Text(L10n.of(context)!.help), child: Text(L10n.of(context).help),
), ),
], ],
), ),
@ -51,7 +51,7 @@ class NewPrivateChatView extends StatelessWidget {
controller: controller.controller, controller: controller.controller,
onChanged: controller.searchUsers, onChanged: controller.searchUsers,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.searchForUsers, hintText: L10n.of(context).searchForUsers,
prefixIcon: searchResponse == null prefixIcon: searchResponse == null
? const Icon(Icons.search_outlined) ? const Icon(Icons.search_outlined)
: FutureBuilder( : FutureBuilder(
@ -98,7 +98,7 @@ class NewPrivateChatView extends StatelessWidget {
TextSpan( TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: L10n.of(context)!.yourGlobalUserIdIs, text: L10n.of(context).yourGlobalUserIdIs,
), ),
TextSpan( TextSpan(
text: Matrix.of(context).client.userID, text: Matrix.of(context).client.userID,
@ -123,7 +123,7 @@ class NewPrivateChatView extends StatelessWidget {
Theme.of(context).colorScheme.onSecondaryContainer, Theme.of(context).colorScheme.onSecondaryContainer,
child: Icon(Icons.adaptive.share_outlined), child: Icon(Icons.adaptive.share_outlined),
), ),
title: Text(L10n.of(context)!.shareInviteLink), title: Text(L10n.of(context).shareInviteLink),
onTap: controller.inviteAction, onTap: controller.inviteAction,
), ),
ListTile( ListTile(
@ -134,7 +134,7 @@ class NewPrivateChatView extends StatelessWidget {
Theme.of(context).colorScheme.onTertiaryContainer, Theme.of(context).colorScheme.onTertiaryContainer,
child: const Icon(Icons.group_add_outlined), child: const Icon(Icons.group_add_outlined),
), ),
title: Text(L10n.of(context)!.createGroup), title: Text(L10n.of(context).createGroup),
onTap: () => context.go('/rooms/newgroup'), onTap: () => context.go('/rooms/newgroup'),
), ),
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
@ -146,7 +146,7 @@ class NewPrivateChatView extends StatelessWidget {
Theme.of(context).colorScheme.onPrimaryContainer, Theme.of(context).colorScheme.onPrimaryContainer,
child: const Icon(Icons.qr_code_scanner_outlined), child: const Icon(Icons.qr_code_scanner_outlined),
), ),
title: Text(L10n.of(context)!.scanQrCode), title: Text(L10n.of(context).scanQrCode),
onTap: controller.openScannerAction, onTap: controller.openScannerAction,
), ),
Center( Center(
@ -205,7 +205,7 @@ class NewPrivateChatView extends StatelessWidget {
OutlinedButton.icon( OutlinedButton.icon(
onPressed: controller.searchUsers, onPressed: controller.searchUsers,
icon: const Icon(Icons.refresh_outlined), icon: const Icon(Icons.refresh_outlined),
label: Text(L10n.of(context)!.tryAgain), label: Text(L10n.of(context).tryAgain),
), ),
], ],
); );
@ -223,7 +223,7 @@ class NewPrivateChatView extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Text( child: Text(
L10n.of(context)!.noUsersFoundWithQuery( L10n.of(context).noUsersFoundWithQuery(
controller.controller.text, controller.controller.text,
), ),
style: TextStyle( style: TextStyle(

View file

@ -3,9 +3,10 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart';
import 'package:fluffychat/l10n/l10n.dart';
class QrScannerModal extends StatefulWidget { class QrScannerModal extends StatefulWidget {
final void Function(String) onScan; final void Function(String) onScan;
const QrScannerModal({required this.onScan, super.key}); const QrScannerModal({required this.onScan, super.key});
@ -35,9 +36,9 @@ class QrScannerModalState extends State<QrScannerModal> {
leading: IconButton( leading: IconButton(
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: Navigator.of(context).pop, onPressed: Navigator.of(context).pop,
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
), ),
title: Text(L10n.of(context)!.scanQrCode), title: Text(L10n.of(context).scanQrCode),
), ),
body: Stack( body: Stack(
children: [ children: [

View file

@ -3,11 +3,11 @@ import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart' as sdk; import 'package:matrix/matrix.dart' as sdk;
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/new_space/new_space_view.dart'; import 'package:fluffychat/pages/new_space/new_space_view.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -53,7 +53,7 @@ class NewSpaceController extends State<NewSpace> {
}); });
if (nameController.text.isEmpty) { if (nameController.text.isEmpty) {
setState(() { setState(() {
nameError = L10n.of(context)!.pleaseChoose; nameError = L10n.of(context).pleaseChoose;
}); });
return; return;
} }

View file

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import 'new_space.dart'; import 'new_space.dart';
@ -16,7 +15,7 @@ class NewSpaceView extends StatelessWidget {
final avatar = controller.avatar; final avatar = controller.avatar;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.createNewSpace), title: Text(L10n.of(context).createNewSpace),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: Column( child: Column(
@ -27,7 +26,7 @@ class NewSpaceView extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 16.0), padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Icon(Icons.info_outlined), child: Icon(Icons.info_outlined),
), ),
subtitle: Text(L10n.of(context)!.newSpaceDescription), subtitle: Text(L10n.of(context).newSpaceDescription),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Padding( Padding(
@ -61,7 +60,7 @@ class NewSpaceView extends StatelessWidget {
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.people_outlined), prefixIcon: const Icon(Icons.people_outlined),
hintText: L10n.of(context)!.spaceName, hintText: L10n.of(context).spaceName,
errorText: controller.nameError, errorText: controller.nameError,
), ),
), ),
@ -79,14 +78,14 @@ class NewSpaceView extends StatelessWidget {
maxLength: 255, maxLength: 255,
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.addChatDescription, hintText: L10n.of(context).addChatDescription,
errorText: controller.topicError, errorText: controller.topicError,
), ),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
SwitchListTile.adaptive( 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,
), ),
@ -107,7 +106,7 @@ class NewSpaceView extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
L10n.of(context)!.createNewSpace, L10n.of(context).createNewSpace,
), ),
), ),
Icon(Icons.adaptive.arrow_forward_outlined), Icon(Icons.adaptive.arrow_forward_outlined),

View file

@ -5,11 +5,11 @@ import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/app_lock.dart'; import 'package:fluffychat/widgets/app_lock.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
@ -37,9 +37,9 @@ class SettingsController extends State<Settings> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.editDisplayname, title: L10n.of(context).editDisplayname,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
initialText: profile?.displayName ?? initialText: profile?.displayName ??
@ -64,11 +64,11 @@ class SettingsController extends State<Settings> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSureYouWantToLogout, title: L10n.of(context).areYouSureYouWantToLogout,
message: L10n.of(context)!.noBackupWarning, message: L10n.of(context).noBackupWarning,
isDestructiveAction: noBackup, isDestructiveAction: noBackup,
okLabel: L10n.of(context)!.logout, okLabel: L10n.of(context).logout,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.cancel) { OkCancelResult.cancel) {
return; return;
@ -86,19 +86,19 @@ class SettingsController extends State<Settings> {
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
SheetAction( SheetAction(
key: AvatarAction.camera, key: AvatarAction.camera,
label: L10n.of(context)!.openCamera, label: L10n.of(context).openCamera,
isDefaultAction: true, isDefaultAction: true,
icon: Icons.camera_alt_outlined, icon: Icons.camera_alt_outlined,
), ),
SheetAction( SheetAction(
key: AvatarAction.file, key: AvatarAction.file,
label: L10n.of(context)!.openGallery, label: L10n.of(context).openGallery,
icon: Icons.photo_outlined, icon: Icons.photo_outlined,
), ),
if (profile?.avatarUrl != null) if (profile?.avatarUrl != null)
SheetAction( SheetAction(
key: AvatarAction.remove, key: AvatarAction.remove,
label: L10n.of(context)!.removeYourAvatar, label: L10n.of(context).removeYourAvatar,
isDestructiveAction: true, isDestructiveAction: true,
icon: Icons.delete_outlined, icon: Icons.delete_outlined,
), ),
@ -107,7 +107,7 @@ class SettingsController extends State<Settings> {
? actions.single.key ? actions.single.key
: await showModalActionSheet<AvatarAction>( : await showModalActionSheet<AvatarAction>(
context: context, context: context,
title: L10n.of(context)!.changeYourAvatar, title: L10n.of(context).changeYourAvatar,
actions: actions, actions: actions,
); );
if (action == null) return; if (action == null) return;
@ -192,9 +192,9 @@ class SettingsController extends State<Settings> {
if (showChatBackupBanner != true) { if (showChatBackupBanner != true) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.chatBackup, title: L10n.of(context).chatBackup,
message: L10n.of(context)!.onlineKeyBackupEnabled, message: L10n.of(context).onlineKeyBackupEnabled,
okLabel: L10n.of(context)!.close, okLabel: L10n.of(context).close,
); );
return; return;
} }

View file

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/fluffy_share.dart'; import 'package:fluffychat/utils/fluffy_share.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
@ -27,17 +27,17 @@ class SettingsView extends StatelessWidget {
onPressed: () => context.go('/rooms'), onPressed: () => context.go('/rooms'),
), ),
), ),
title: Text(L10n.of(context)!.settings), title: Text(L10n.of(context).settings),
actions: [ actions: [
TextButton.icon( TextButton.icon(
onPressed: controller.logoutAction, onPressed: controller.logoutAction,
label: Text(L10n.of(context)!.logout), label: Text(L10n.of(context).logout),
icon: const Icon(Icons.logout_outlined), icon: const Icon(Icons.logout_outlined),
), ),
], ],
), ),
body: ListTileTheme( body: ListTileTheme(
iconColor: Theme.of(context).colorScheme.onBackground, iconColor: Theme.of(context).colorScheme.onSurface,
child: ListView( child: ListView(
key: const Key('SettingsListViewContent'), key: const Key('SettingsListViewContent'),
children: <Widget>[ children: <Widget>[
@ -46,7 +46,7 @@ class SettingsView extends StatelessWidget {
builder: (context, snapshot) { builder: (context, snapshot) {
final profile = snapshot.data; final profile = snapshot.data;
final mxid = final mxid =
Matrix.of(context).client.userID ?? L10n.of(context)!.user; Matrix.of(context).client.userID ?? L10n.of(context).user;
final displayname = final displayname =
profile?.displayName ?? mxid.localpart ?? mxid; profile?.displayName ?? mxid.localpart ?? mxid;
return Row( return Row(
@ -103,7 +103,7 @@ class SettingsView extends StatelessWidget {
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: foregroundColor:
Theme.of(context).colorScheme.onBackground, Theme.of(context).colorScheme.onSurface,
), ),
label: Text( label: Text(
displayname, displayname,
@ -143,7 +143,7 @@ class SettingsView extends StatelessWidget {
if (showChatBackupBanner == null) if (showChatBackupBanner == null)
ListTile( ListTile(
leading: const Icon(Icons.backup_outlined), leading: const Icon(Icons.backup_outlined),
title: Text(L10n.of(context)!.chatBackup), title: Text(L10n.of(context).chatBackup),
trailing: const CircularProgressIndicator.adaptive(), trailing: const CircularProgressIndicator.adaptive(),
) )
else else
@ -151,7 +151,7 @@ class SettingsView extends StatelessWidget {
controlAffinity: ListTileControlAffinity.trailing, controlAffinity: ListTileControlAffinity.trailing,
value: controller.showChatBackupBanner == false, value: controller.showChatBackupBanner == false,
secondary: const Icon(Icons.backup_outlined), secondary: const Icon(Icons.backup_outlined),
title: Text(L10n.of(context)!.chatBackup), title: Text(L10n.of(context).chatBackup),
onChanged: controller.firstRunBootstrapAction, onChanged: controller.firstRunBootstrapAction,
), ),
Divider( Divider(
@ -160,31 +160,31 @@ class SettingsView extends StatelessWidget {
), ),
ListTile( ListTile(
leading: const Icon(Icons.format_paint_outlined), leading: const Icon(Icons.format_paint_outlined),
title: Text(L10n.of(context)!.changeTheme), title: Text(L10n.of(context).changeTheme),
onTap: () => context.go('/rooms/settings/style'), onTap: () => context.go('/rooms/settings/style'),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
), ),
ListTile( ListTile(
leading: const Icon(Icons.notifications_outlined), leading: const Icon(Icons.notifications_outlined),
title: Text(L10n.of(context)!.notifications), title: Text(L10n.of(context).notifications),
onTap: () => context.go('/rooms/settings/notifications'), onTap: () => context.go('/rooms/settings/notifications'),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
), ),
ListTile( ListTile(
leading: const Icon(Icons.devices_outlined), leading: const Icon(Icons.devices_outlined),
title: Text(L10n.of(context)!.devices), title: Text(L10n.of(context).devices),
onTap: () => context.go('/rooms/settings/devices'), onTap: () => context.go('/rooms/settings/devices'),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
), ),
ListTile( ListTile(
leading: const Icon(Icons.forum_outlined), leading: const Icon(Icons.forum_outlined),
title: Text(L10n.of(context)!.chat), title: Text(L10n.of(context).chat),
onTap: () => context.go('/rooms/settings/chat'), onTap: () => context.go('/rooms/settings/chat'),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
), ),
ListTile( ListTile(
leading: const Icon(Icons.shield_outlined), leading: const Icon(Icons.shield_outlined),
title: Text(L10n.of(context)!.security), title: Text(L10n.of(context).security),
onTap: () => context.go('/rooms/settings/security'), onTap: () => context.go('/rooms/settings/security'),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
), ),
@ -194,19 +194,19 @@ class SettingsView extends StatelessWidget {
), ),
ListTile( ListTile(
leading: const Icon(Icons.help_outline_outlined), leading: const Icon(Icons.help_outline_outlined),
title: Text(L10n.of(context)!.help), title: Text(L10n.of(context).help),
onTap: () => launchUrlString(AppConfig.supportUrl), onTap: () => launchUrlString(AppConfig.supportUrl),
trailing: const Icon(Icons.open_in_new_outlined), trailing: const Icon(Icons.open_in_new_outlined),
), ),
ListTile( ListTile(
leading: const Icon(Icons.shield_sharp), leading: const Icon(Icons.shield_sharp),
title: Text(L10n.of(context)!.privacy), title: Text(L10n.of(context).privacy),
onTap: () => launchUrlString(AppConfig.privacyUrl), onTap: () => launchUrlString(AppConfig.privacyUrl),
trailing: const Icon(Icons.open_in_new_outlined), trailing: const Icon(Icons.open_in_new_outlined),
), ),
ListTile( ListTile(
leading: const Icon(Icons.info_outline_rounded), leading: const Icon(Icons.info_outline_rounded),
title: Text(L10n.of(context)!.about), title: Text(L10n.of(context).about),
onTap: () => PlatformInfos.showDialog(context), onTap: () => PlatformInfos.showDialog(context),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
), ),

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import 'settings_3pid_view.dart'; import 'settings_3pid_view.dart';
@ -22,12 +22,12 @@ class Settings3PidController extends State<Settings3Pid> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.enterAnEmailAddress, title: L10n.of(context).enterAnEmailAddress,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.enterAnEmailAddress, hintText: L10n.of(context).enterAnEmailAddress,
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
), ),
], ],
@ -46,9 +46,9 @@ class Settings3PidController extends State<Settings3Pid> {
final ok = await showOkAlertDialog( final ok = await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.weSentYouAnEmail, title: L10n.of(context).weSentYouAnEmail,
message: L10n.of(context)!.pleaseClickOnLink, message: L10n.of(context).pleaseClickOnLink,
okLabel: L10n.of(context)!.iHaveClickedOnLink, okLabel: L10n.of(context).iHaveClickedOnLink,
); );
if (ok != OkCancelResult.ok) return; if (ok != OkCancelResult.ok) return;
final success = await showFutureLoadingDialog( final success = await showFutureLoadingDialog(
@ -71,9 +71,9 @@ class Settings3PidController extends State<Settings3Pid> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
) != ) !=
OkCancelResult.ok) { OkCancelResult.ok) {
return; return;

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/settings_3pid/settings_3pid.dart'; import 'package:fluffychat/pages/settings_3pid/settings_3pid.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -18,12 +18,12 @@ class Settings3PidView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.passwordRecovery), title: Text(L10n.of(context).passwordRecovery),
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Icons.add_outlined), icon: const Icon(Icons.add_outlined),
onPressed: controller.add3PidAction, onPressed: controller.add3PidAction,
tooltip: L10n.of(context)!.addEmail, tooltip: L10n.of(context).addEmail,
), ),
], ],
), ),
@ -64,8 +64,8 @@ class Settings3PidView extends StatelessWidget {
), ),
title: Text( title: Text(
identifier.isEmpty identifier.isEmpty
? L10n.of(context)!.noPasswordRecoveryDescription ? L10n.of(context).noPasswordRecoveryDescription
: L10n.of(context)! : L10n.of(context)
.withTheseAddressesRecoveryDescription, .withTheseAddressesRecoveryDescription,
), ),
), ),
@ -82,7 +82,7 @@ class Settings3PidView extends StatelessWidget {
), ),
title: Text(identifier[i].address), title: Text(identifier[i].address),
trailing: IconButton( trailing: IconButton(
tooltip: L10n.of(context)!.delete, tooltip: L10n.of(context).delete,
icon: const Icon(Icons.delete_forever_outlined), icon: const Icon(Icons.delete_forever_outlined),
color: Colors.red, color: Colors.red,
onPressed: () => controller.delete3Pid(identifier[i]), onPressed: () => controller.delete3Pid(identifier[i]),

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/setting_keys.dart'; import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/utils/voip/callkeep_manager.dart'; import 'package:fluffychat/utils/voip/callkeep_manager.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
@ -19,48 +19,48 @@ class SettingsChatView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.chat)), appBar: AppBar(title: Text(L10n.of(context).chat)),
body: ListTileTheme( body: ListTileTheme(
iconColor: Theme.of(context).textTheme.bodyLarge!.color, iconColor: Theme.of(context).textTheme.bodyLarge!.color,
child: MaxWidthBody( child: MaxWidthBody(
child: Column( child: Column(
children: [ children: [
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.formattedMessages, title: L10n.of(context).formattedMessages,
subtitle: L10n.of(context)!.formattedMessagesDescription, subtitle: L10n.of(context).formattedMessagesDescription,
onChanged: (b) => AppConfig.renderHtml = b, onChanged: (b) => AppConfig.renderHtml = b,
storeKey: SettingKeys.renderHtml, storeKey: SettingKeys.renderHtml,
defaultValue: AppConfig.renderHtml, defaultValue: AppConfig.renderHtml,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideMemberChangesInPublicChats, title: L10n.of(context).hideMemberChangesInPublicChats,
subtitle: L10n.of(context)!.hideMemberChangesInPublicChatsBody, subtitle: L10n.of(context).hideMemberChangesInPublicChatsBody,
onChanged: (b) => AppConfig.hideUnimportantStateEvents = b, onChanged: (b) => AppConfig.hideUnimportantStateEvents = b,
storeKey: SettingKeys.hideUnimportantStateEvents, storeKey: SettingKeys.hideUnimportantStateEvents,
defaultValue: AppConfig.hideUnimportantStateEvents, defaultValue: AppConfig.hideUnimportantStateEvents,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideRedactedMessages, title: L10n.of(context).hideRedactedMessages,
subtitle: L10n.of(context)!.hideRedactedMessagesBody, subtitle: L10n.of(context).hideRedactedMessagesBody,
onChanged: (b) => AppConfig.hideRedactedEvents = b, onChanged: (b) => AppConfig.hideRedactedEvents = b,
storeKey: SettingKeys.hideRedactedEvents, storeKey: SettingKeys.hideRedactedEvents,
defaultValue: AppConfig.hideRedactedEvents, defaultValue: AppConfig.hideRedactedEvents,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideInvalidOrUnknownMessageFormats, title: L10n.of(context).hideInvalidOrUnknownMessageFormats,
onChanged: (b) => AppConfig.hideUnknownEvents = b, onChanged: (b) => AppConfig.hideUnknownEvents = b,
storeKey: SettingKeys.hideUnknownEvents, storeKey: SettingKeys.hideUnknownEvents,
defaultValue: AppConfig.hideUnknownEvents, defaultValue: AppConfig.hideUnknownEvents,
), ),
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
SettingsSwitchListTile.adaptive( 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,
), ),
SettingsSwitchListTile.adaptive( 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,
defaultValue: AppConfig.sendOnEnter ?? !PlatformInfos.isMobile, defaultValue: AppConfig.sendOnEnter ?? !PlatformInfos.isMobile,
@ -71,7 +71,7 @@ class SettingsChatView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.customEmojisAndStickers, L10n.of(context).customEmojisAndStickers,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -79,8 +79,8 @@ class SettingsChatView extends StatelessWidget {
), ),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.customEmojisAndStickers), title: Text(L10n.of(context).customEmojisAndStickers),
subtitle: Text(L10n.of(context)!.customEmojisAndStickersBody), subtitle: Text(L10n.of(context).customEmojisAndStickersBody),
onTap: () => context.go('/rooms/settings/chat/emotes'), onTap: () => context.go('/rooms/settings/chat/emotes'),
trailing: const Padding( trailing: const Padding(
padding: EdgeInsets.all(16.0), padding: EdgeInsets.all(16.0),
@ -93,7 +93,7 @@ class SettingsChatView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.calls, L10n.of(context).calls,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -101,7 +101,7 @@ class SettingsChatView extends StatelessWidget {
), ),
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.experimentalVideoCalls, title: L10n.of(context).experimentalVideoCalls,
onChanged: (b) { onChanged: (b) {
AppConfig.experimentalVoip = b; AppConfig.experimentalVoip = b;
Matrix.of(context).createVoipPlugin(); Matrix.of(context).createVoipPlugin();
@ -112,7 +112,7 @@ class SettingsChatView extends StatelessWidget {
), ),
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
ListTile( ListTile(
title: Text(L10n.of(context)!.callingPermissions), title: Text(L10n.of(context).callingPermissions),
onTap: () => onTap: () =>
CallKeepManager().checkoutPhoneAccountSetting(context), CallKeepManager().checkoutPhoneAccountSetting(context),
trailing: const Padding( trailing: const Padding(

View file

@ -6,9 +6,9 @@ import 'package:flutter/services.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:archive/archive.dart'; import 'package:archive/archive.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/settings_emotes/settings_emotes.dart'; import 'package:fluffychat/pages/settings_emotes/settings_emotes.dart';
import 'package:fluffychat/utils/client_manager.dart'; import 'package:fluffychat/utils/client_manager.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -44,7 +44,7 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text(L10n.of(context)!.importEmojis), title: Text(L10n.of(context).importEmojis),
content: _loading content: _loading
? Center( ? Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
@ -73,7 +73,7 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
actions: [ actions: [
TextButton( TextButton(
onPressed: _loading ? null : Navigator.of(context).pop, onPressed: _loading ? null : Navigator.of(context).pop,
child: Text(L10n.of(context)!.cancel), child: Text(L10n.of(context).cancel),
), ),
TextButton( TextButton(
onPressed: _loading onPressed: _loading
@ -81,7 +81,7 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
: _importMap.isNotEmpty : _importMap.isNotEmpty
? _addEmotePack ? _addEmotePack
: null, : null,
child: Text(L10n.of(context)!.importNow), child: Text(L10n.of(context).importNow),
), ),
], ],
); );
@ -121,10 +121,10 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
final result = await showOkCancelAlertDialog( final result = await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.emoteExists, title: L10n.of(context).emoteExists,
message: imageCode, message: imageCode,
cancelLabel: L10n.of(context)!.replace, cancelLabel: L10n.of(context).replace,
okLabel: L10n.of(context)!.skip, okLabel: L10n.of(context).skip,
); );
completer.complete(result); completer.complete(result);
}); });
@ -240,7 +240,7 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> {
IconButton( IconButton(
onPressed: widget.onRemove, onPressed: widget.onRemove,
icon: const Icon(Icons.remove_circle), icon: const Icon(Icons.remove_circle),
tooltip: L10n.of(context)!.remove, tooltip: L10n.of(context).remove,
), ),
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: hasErrorNotifier, valueListenable: hasErrorNotifier,
@ -276,7 +276,7 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> {
minLines: 1, minLines: 1,
maxLines: 1, maxLines: 1,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.emoteShortcode, hintText: L10n.of(context).emoteShortcode,
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
@ -325,7 +325,7 @@ class _ImageFileError extends StatelessWidget {
children: [ children: [
const Icon(Icons.error), const Icon(Icons.error),
Text( Text(
L10n.of(context)!.notAnImage, L10n.of(context).notAnImage,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.labelSmall, style: Theme.of(context).textTheme.labelSmall,
), ),

View file

@ -6,12 +6,12 @@ import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:http/http.dart' hide Client; import 'package:http/http.dart' hide Client;
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/client_manager.dart'; import 'package:fluffychat/utils/client_manager.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart';
import 'package:fluffychat/widgets/app_lock.dart'; import 'package:fluffychat/widgets/app_lock.dart';
@ -140,8 +140,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
showOkAlertDialog( showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteExists, message: L10n.of(context).emoteExists,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }
@ -150,8 +150,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
showOkAlertDialog( showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteInvalid, message: L10n.of(context).emoteInvalid,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }
@ -186,8 +186,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
await showOkAlertDialog( await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteWarnNeedToPick, message: L10n.of(context).emoteWarnNeedToPick,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }
@ -196,8 +196,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
await showOkAlertDialog( await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteExists, message: L10n.of(context).emoteExists,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }
@ -205,8 +205,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
await showOkAlertDialog( await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteInvalid, message: L10n.of(context).emoteInvalid,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import 'package:fluffychat/widgets/mxc_image.dart'; import 'package:fluffychat/widgets/mxc_image.dart';
@ -24,7 +24,7 @@ class EmotesSettingsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.customEmojisAndStickers), title: Text(L10n.of(context).customEmojisAndStickers),
actions: [ actions: [
PopupMenuButton<PopupMenuEmojiActions>( PopupMenuButton<PopupMenuEmojiActions>(
onSelected: (value) { onSelected: (value) {
@ -41,11 +41,11 @@ class EmotesSettingsView extends StatelessWidget {
itemBuilder: (context) => [ itemBuilder: (context) => [
PopupMenuItem( PopupMenuItem(
value: PopupMenuEmojiActions.import, value: PopupMenuEmojiActions.import,
child: Text(L10n.of(context)!.importFromZipFile), child: Text(L10n.of(context).importFromZipFile),
), ),
PopupMenuItem( PopupMenuItem(
value: PopupMenuEmojiActions.export, value: PopupMenuEmojiActions.export,
child: Text(L10n.of(context)!.exportEmotePack), child: Text(L10n.of(context).exportEmotePack),
), ),
], ],
), ),
@ -81,7 +81,7 @@ class EmotesSettingsView extends StatelessWidget {
minLines: 1, minLines: 1,
maxLines: 1, maxLines: 1,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.emoteShortcode, hintText: L10n.of(context).emoteShortcode,
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
prefixStyle: TextStyle( prefixStyle: TextStyle(
@ -112,7 +112,7 @@ class EmotesSettingsView extends StatelessWidget {
), ),
if (controller.room != null) if (controller.room != null)
SwitchListTile.adaptive( SwitchListTile.adaptive(
title: Text(L10n.of(context)!.enableEmotesGlobally), title: Text(L10n.of(context).enableEmotesGlobally),
value: controller.isGloballyActive(client), value: controller.isGloballyActive(client),
onChanged: controller.setIsGloballyActive, onChanged: controller.setIsGloballyActive,
), ),
@ -123,7 +123,7 @@ class EmotesSettingsView extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: Text( child: Text(
L10n.of(context)!.noEmotesFound, L10n.of(context).noEmotesFound,
style: const TextStyle(fontSize: 20), style: const TextStyle(fontSize: 20),
), ),
), ),
@ -184,7 +184,7 @@ class EmotesSettingsView extends StatelessWidget {
minLines: 1, minLines: 1,
maxLines: 1, maxLines: 1,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.emoteShortcode, hintText: L10n.of(context).emoteShortcode,
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
prefixStyle: TextStyle( prefixStyle: TextStyle(
@ -269,7 +269,7 @@ class _ImagePickerState extends State<_ImagePicker> {
if (widget.controller.value == null) { if (widget.controller.value == null) {
return ElevatedButton( return ElevatedButton(
onPressed: () => widget.onPressed(widget.controller), onPressed: () => widget.onPressed(widget.controller),
child: Text(L10n.of(context)!.pickImage), child: Text(L10n.of(context).pickImage),
); );
} else { } else {
return _EmoteImage(widget.controller.value!.url); return _EmoteImage(widget.controller.value!.url);

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
import 'settings_ignore_list_view.dart'; import 'settings_ignore_list_view.dart';
@ -34,7 +34,7 @@ class SettingsIgnoreListController extends State<SettingsIgnoreList> {
if (userId.isEmpty) return; if (userId.isEmpty) return;
if (!userId.isValidMatrixId || userId.sigil != '@') { if (!userId.isValidMatrixId || userId.sigil != '@') {
setState(() { setState(() {
errorText = L10n.of(context)!.invalidInput; errorText = L10n.of(context).invalidInput;
}); });
return; return;
} }

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
@ -20,7 +20,7 @@ class SettingsIgnoreListView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.blockedUsers), title: Text(L10n.of(context).blockedUsers),
), ),
body: MaxWidthBody( body: MaxWidthBody(
withScrolling: false, withScrolling: false,
@ -41,9 +41,9 @@ class SettingsIgnoreListView extends StatelessWidget {
errorText: controller.errorText, errorText: controller.errorText,
hintText: '@bad_guy:domain.abc', hintText: '@bad_guy:domain.abc',
floatingLabelBehavior: FloatingLabelBehavior.always, floatingLabelBehavior: FloatingLabelBehavior.always,
labelText: L10n.of(context)!.blockUsername, labelText: L10n.of(context).blockUsername,
suffixIcon: IconButton( suffixIcon: IconButton(
tooltip: L10n.of(context)!.block, tooltip: L10n.of(context).block,
icon: const Icon(Icons.send_outlined), icon: const Icon(Icons.send_outlined),
onPressed: () => controller.ignoreUser(context), onPressed: () => controller.ignoreUser(context),
), ),
@ -51,7 +51,7 @@ class SettingsIgnoreListView extends StatelessWidget {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
L10n.of(context)!.blockListDescription, L10n.of(context).blockListDescription,
style: const TextStyle(color: Colors.orange), style: const TextStyle(color: Colors.orange),
), ),
], ],
@ -81,7 +81,7 @@ class SettingsIgnoreListView extends StatelessWidget {
subtitle: subtitle:
Text(s.data?.userId ?? client.ignoredUsers[i]), Text(s.data?.userId ?? client.ignoredUsers[i]),
trailing: IconButton( trailing: IconButton(
tooltip: L10n.of(context)!.delete, tooltip: L10n.of(context).delete,
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
onPressed: () => showFutureLoadingDialog( onPressed: () => showFutureLoadingDialog(
context: context, context: context,

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/settings_multiple_emotes/settings_multiple_emotes.dart'; import 'package:fluffychat/pages/settings_multiple_emotes/settings_multiple_emotes.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -18,7 +18,7 @@ class MultipleEmotesSettingsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.emotePacks), title: Text(L10n.of(context).emotePacks),
), ),
body: StreamBuilder( body: StreamBuilder(
stream: room.client.onRoomState.stream stream: room.client.onRoomState.stream

View file

@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:collection/collection.dart' show IterableExtension; import 'package:collection/collection.dart' show IterableExtension;
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
import 'settings_notifications_view.dart'; import 'settings_notifications_view.dart';
@ -19,37 +19,37 @@ class NotificationSettingsItem {
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.underride, PushRuleKind.underride,
'.m.rule.message', '.m.rule.message',
(c) => L10n.of(c)!.allRooms, (c) => L10n.of(c).allRooms,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.underride, PushRuleKind.underride,
'.m.rule.room_one_to_one', '.m.rule.room_one_to_one',
(c) => L10n.of(c)!.directChats, (c) => L10n.of(c).directChats,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.override, PushRuleKind.override,
'.m.rule.contains_display_name', '.m.rule.contains_display_name',
(c) => L10n.of(c)!.containsDisplayName, (c) => L10n.of(c).containsDisplayName,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.content, PushRuleKind.content,
'.m.rule.contains_user_name', '.m.rule.contains_user_name',
(c) => L10n.of(c)!.containsUserName, (c) => L10n.of(c).containsUserName,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.override, PushRuleKind.override,
'.m.rule.invite_for_me', '.m.rule.invite_for_me',
(c) => L10n.of(c)!.inviteForMe, (c) => L10n.of(c).inviteForMe,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.override, PushRuleKind.override,
'.m.rule.member_event', '.m.rule.member_event',
(c) => L10n.of(c)!.memberChanges, (c) => L10n.of(c).memberChanges,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.override, PushRuleKind.override,
'.m.rule.suppress_notices', '.m.rule.suppress_notices',
(c) => L10n.of(c)!.botMessages, (c) => L10n.of(c).botMessages,
), ),
]; ];
} }
@ -145,7 +145,7 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
message: '${pusher.appDisplayName} (${pusher.appId})', message: '${pusher.appDisplayName} (${pusher.appId})',
actions: [ actions: [
SheetAction( SheetAction(
label: L10n.of(context)!.delete, label: L10n.of(context).delete,
isDestructiveAction: true, isDestructiveAction: true,
key: true, key: true,
), ),

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import '../../utils/localized_exception_extension.dart'; import '../../utils/localized_exception_extension.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
@ -18,7 +18,7 @@ class SettingsNotificationsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.notifications), title: Text(L10n.of(context).notifications),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: StreamBuilder( child: StreamBuilder(
@ -33,7 +33,7 @@ class SettingsNotificationsView extends StatelessWidget {
SwitchListTile.adaptive( 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,
), ),
onChanged: controller.isLoading onChanged: controller.isLoading
? null ? null
@ -42,7 +42,7 @@ class SettingsNotificationsView extends StatelessWidget {
Divider(color: Theme.of(context).dividerColor), Divider(color: Theme.of(context).dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.notifyMeFor, L10n.of(context).notifyMeFor,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -65,7 +65,7 @@ class SettingsNotificationsView extends StatelessWidget {
Divider(color: Theme.of(context).dividerColor), Divider(color: Theme.of(context).dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.devices, L10n.of(context).devices,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -95,7 +95,7 @@ class SettingsNotificationsView extends StatelessWidget {
return Center( return Center(
child: Padding( child: Padding(
padding: const EdgeInsets.only(bottom: 16.0), padding: const EdgeInsets.only(bottom: 16.0),
child: Text(L10n.of(context)!.noOtherDevicesFound), child: Text(L10n.of(context).noOtherDevicesFound),
), ),
); );
} }

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/settings_password/settings_password_view.dart'; import 'package:fluffychat/pages/settings_password/settings_password_view.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
@ -31,20 +31,20 @@ class SettingsPasswordController extends State<SettingsPassword> {
}); });
if (oldPasswordController.text.isEmpty) { if (oldPasswordController.text.isEmpty) {
setState(() { setState(() {
oldPasswordError = L10n.of(context)!.pleaseEnterYourPassword; oldPasswordError = L10n.of(context).pleaseEnterYourPassword;
}); });
return; return;
} }
if (newPassword1Controller.text.isEmpty || if (newPassword1Controller.text.isEmpty ||
newPassword1Controller.text.length < 6) { newPassword1Controller.text.length < 6) {
setState(() { setState(() {
newPassword1Error = L10n.of(context)!.pleaseChooseAStrongPassword; newPassword1Error = L10n.of(context).pleaseChooseAStrongPassword;
}); });
return; return;
} }
if (newPassword1Controller.text != newPassword2Controller.text) { if (newPassword1Controller.text != newPassword2Controller.text) {
setState(() { setState(() {
newPassword2Error = L10n.of(context)!.passwordsDoNotMatch; newPassword2Error = L10n.of(context).passwordsDoNotMatch;
}); });
return; return;
} }
@ -60,7 +60,7 @@ class SettingsPasswordController extends State<SettingsPassword> {
); );
scaffoldMessenger.showSnackBar( scaffoldMessenger.showSnackBar(
SnackBar( SnackBar(
content: Text(L10n.of(context)!.passwordHasBeenChanged), content: Text(L10n.of(context).passwordHasBeenChanged),
), ),
); );
if (mounted) context.pop(); if (mounted) context.pop();

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/pages/settings_password/settings_password.dart'; import 'package:fluffychat/pages/settings_password/settings_password.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
@ -14,16 +14,16 @@ class SettingsPasswordView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.changePassword), title: Text(L10n.of(context).changePassword),
actions: [ actions: [
TextButton( TextButton(
child: Text(L10n.of(context)!.passwordRecoverySettings), child: Text(L10n.of(context).passwordRecoverySettings),
onPressed: () => context.go('/rooms/settings/security/3pid'), onPressed: () => context.go('/rooms/settings/security/3pid'),
), ),
], ],
), ),
body: ListTileTheme( body: ListTileTheme(
iconColor: Theme.of(context).colorScheme.onBackground, iconColor: Theme.of(context).colorScheme.onSurface,
child: MaxWidthBody( child: MaxWidthBody(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@ -44,7 +44,7 @@ class SettingsPasswordView extends StatelessWidget {
autofocus: true, autofocus: true,
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.pleaseEnterYourCurrentPassword, hintText: L10n.of(context).pleaseEnterYourCurrentPassword,
errorText: controller.oldPasswordError, errorText: controller.oldPasswordError,
), ),
), ),
@ -55,7 +55,7 @@ class SettingsPasswordView extends StatelessWidget {
autocorrect: false, autocorrect: false,
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.newPassword, hintText: L10n.of(context).newPassword,
errorText: controller.newPassword1Error, errorText: controller.newPassword1Error,
), ),
), ),
@ -66,7 +66,7 @@ class SettingsPasswordView extends StatelessWidget {
autocorrect: false, autocorrect: false,
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.repeatPassword, hintText: L10n.of(context).repeatPassword,
errorText: controller.newPassword2Error, errorText: controller.newPassword2Error,
), ),
), ),
@ -79,7 +79,7 @@ class SettingsPasswordView extends StatelessWidget {
icon: const Icon(Icons.send_outlined), icon: const Icon(Icons.send_outlined),
label: controller.loading label: controller.loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Text(L10n.of(context)!.changePassword), : Text(L10n.of(context).changePassword),
), ),
), ),
], ],

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/app_lock.dart'; import 'package:fluffychat/widgets/app_lock.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import '../bootstrap/bootstrap_dialog.dart'; import '../bootstrap/bootstrap_dialog.dart';
@ -25,9 +25,9 @@ class SettingsSecurityController extends State<SettingsSecurity> {
final newLock = await showTextInputDialog( final newLock = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.pleaseChooseAPasscode, title: L10n.of(context).pleaseChooseAPasscode,
message: L10n.of(context)!.pleaseEnter4Digits, message: L10n.of(context).pleaseEnter4Digits,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
validator: (text) { validator: (text) {
@ -35,7 +35,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
(text.length == 4 && int.tryParse(text)! >= 0)) { (text.length == 4 && int.tryParse(text)! >= 0)) {
return null; return null;
} }
return L10n.of(context)!.pleaseEnter4Digits; return L10n.of(context).pleaseEnter4Digits;
}, },
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
obscureText: true, obscureText: true,
@ -54,10 +54,10 @@ class SettingsSecurityController extends State<SettingsSecurity> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.warning, title: L10n.of(context).warning,
message: L10n.of(context)!.deactivateAccountWarning, message: L10n.of(context).deactivateAccountWarning,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
isDestructiveAction: true, isDestructiveAction: true,
) == ) ==
OkCancelResult.cancel) { OkCancelResult.cancel) {
@ -67,17 +67,17 @@ class SettingsSecurityController extends State<SettingsSecurity> {
final mxids = await showTextInputDialog( final mxids = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.confirmMatrixId, title: L10n.of(context).confirmMatrixId,
textFields: [ textFields: [
DialogTextField( DialogTextField(
validator: (text) => text == supposedMxid validator: (text) => text == supposedMxid
? null ? null
: L10n.of(context)!.supposedMxid(supposedMxid), : L10n.of(context).supposedMxid(supposedMxid),
), ),
], ],
isDestructiveAction: true, isDestructiveAction: true,
okLabel: L10n.of(context)!.delete, okLabel: L10n.of(context).delete,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (mxids == null || mxids.length != 1 || mxids.single != supposedMxid) { if (mxids == null || mxids.length != 1 || mxids.single != supposedMxid) {
return; return;
@ -85,9 +85,9 @@ class SettingsSecurityController extends State<SettingsSecurity> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.pleaseEnterYourPassword, title: L10n.of(context).pleaseEnterYourPassword,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
isDestructiveAction: true, isDestructiveAction: true,
textFields: [ textFields: [
const DialogTextField( const DialogTextField(

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/setting_keys.dart'; import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/beautify_string_extension.dart'; import 'package:fluffychat/utils/beautify_string_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
@ -19,9 +19,9 @@ class SettingsSecurityView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.security)), appBar: AppBar(title: Text(L10n.of(context).security)),
body: ListTileTheme( body: ListTileTheme(
iconColor: Theme.of(context).colorScheme.onBackground, iconColor: Theme.of(context).colorScheme.onSurface,
child: MaxWidthBody( child: MaxWidthBody(
child: FutureBuilder( child: FutureBuilder(
future: Matrix.of(context) future: Matrix.of(context)
@ -43,7 +43,7 @@ class SettingsSecurityView extends StatelessWidget {
children: [ children: [
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.privacy, L10n.of(context).privacy,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -51,25 +51,25 @@ class SettingsSecurityView extends StatelessWidget {
), ),
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.sendTypingNotifications, title: L10n.of(context).sendTypingNotifications,
subtitle: subtitle:
L10n.of(context)!.sendTypingNotificationsDescription, L10n.of(context).sendTypingNotificationsDescription,
onChanged: (b) => AppConfig.sendTypingNotifications = b, onChanged: (b) => AppConfig.sendTypingNotifications = b,
storeKey: SettingKeys.sendTypingNotifications, storeKey: SettingKeys.sendTypingNotifications,
defaultValue: AppConfig.sendTypingNotifications, defaultValue: AppConfig.sendTypingNotifications,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.sendReadReceipts, title: L10n.of(context).sendReadReceipts,
subtitle: L10n.of(context)!.sendReadReceiptsDescription, subtitle: L10n.of(context).sendReadReceiptsDescription,
onChanged: (b) => AppConfig.sendPublicReadReceipts = b, onChanged: (b) => AppConfig.sendPublicReadReceipts = b,
storeKey: SettingKeys.sendPublicReadReceipts, storeKey: SettingKeys.sendPublicReadReceipts,
defaultValue: AppConfig.sendPublicReadReceipts, defaultValue: AppConfig.sendPublicReadReceipts,
), ),
ListTile( ListTile(
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.blockedUsers), title: Text(L10n.of(context).blockedUsers),
subtitle: Text( subtitle: Text(
L10n.of(context)!.thereAreCountUsersBlocked( L10n.of(context).thereAreCountUsersBlocked(
Matrix.of(context).client.ignoredUsers.length, Matrix.of(context).client.ignoredUsers.length,
), ),
), ),
@ -80,8 +80,8 @@ class SettingsSecurityView extends StatelessWidget {
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
ListTile( ListTile(
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.appLock), title: Text(L10n.of(context).appLock),
subtitle: Text(L10n.of(context)!.appLockDescription), subtitle: Text(L10n.of(context).appLockDescription),
onTap: controller.setAppLockAction, onTap: controller.setAppLockAction,
), ),
}, },
@ -91,7 +91,7 @@ class SettingsSecurityView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.account, L10n.of(context).account,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -99,7 +99,7 @@ class SettingsSecurityView extends StatelessWidget {
), ),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.yourPublicKey), title: Text(L10n.of(context).yourPublicKey),
leading: const Icon(Icons.vpn_key_outlined), leading: const Icon(Icons.vpn_key_outlined),
subtitle: SelectableText( subtitle: SelectableText(
Matrix.of(context).client.fingerprintKey.beautified, Matrix.of(context).client.fingerprintKey.beautified,
@ -111,7 +111,7 @@ class SettingsSecurityView extends StatelessWidget {
ListTile( ListTile(
leading: const Icon(Icons.password_outlined), leading: const Icon(Icons.password_outlined),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.changePassword), title: Text(L10n.of(context).changePassword),
onTap: () => onTap: () =>
context.go('/rooms/settings/security/password'), context.go('/rooms/settings/security/password'),
), ),
@ -119,7 +119,7 @@ class SettingsSecurityView extends StatelessWidget {
iconColor: Colors.orange, iconColor: Colors.orange,
leading: const Icon(Icons.tap_and_play), leading: const Icon(Icons.tap_and_play),
title: Text( title: Text(
L10n.of(context)!.dehydrate, L10n.of(context).dehydrate,
style: const TextStyle(color: Colors.orange), style: const TextStyle(color: Colors.orange),
), ),
onTap: controller.dehydrateAction, onTap: controller.dehydrateAction,
@ -128,7 +128,7 @@ class SettingsSecurityView extends StatelessWidget {
iconColor: Colors.red, iconColor: Colors.red,
leading: const Icon(Icons.delete_outlined), leading: const Icon(Icons.delete_outlined),
title: Text( title: Text(
L10n.of(context)!.deleteAccount, L10n.of(context).deleteAccount,
style: const TextStyle(color: Colors.red), style: const TextStyle(color: Colors.red),
), ),
onTap: controller.deleteAccountAction, onTap: controller.deleteAccountAction,

View file

@ -1,9 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/config/setting_keys.dart'; import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/account_config.dart'; import 'package:fluffychat/utils/account_config.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart'; import 'package:fluffychat/widgets/layouts/max_width_body.dart';
@ -25,7 +24,7 @@ class SettingsStyleView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.changeTheme), title: Text(L10n.of(context).changeTheme),
), ),
backgroundColor: Theme.of(context).colorScheme.surface, backgroundColor: Theme.of(context).colorScheme.surface,
body: MaxWidthBody( body: MaxWidthBody(
@ -33,7 +32,7 @@ class SettingsStyleView extends StatelessWidget {
children: [ children: [
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.setColorTheme, L10n.of(context).setColorTheme,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -90,16 +89,16 @@ class SettingsStyleView extends StatelessWidget {
size: 16, size: 16,
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.onBackground, .onSurface,
), ),
), ),
Text( Text(
L10n.of(context)!.systemTheme, L10n.of(context).systemTheme,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.onBackground, .onSurface,
), ),
), ),
], ],
@ -141,7 +140,7 @@ class SettingsStyleView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.setTheme, L10n.of(context).setTheme,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -151,19 +150,19 @@ class SettingsStyleView extends StatelessWidget {
RadioListTile<ThemeMode>( RadioListTile<ThemeMode>(
groupValue: controller.currentTheme, groupValue: controller.currentTheme,
value: ThemeMode.system, value: ThemeMode.system,
title: Text(L10n.of(context)!.systemTheme), title: Text(L10n.of(context).systemTheme),
onChanged: controller.switchTheme, onChanged: controller.switchTheme,
), ),
RadioListTile<ThemeMode>( RadioListTile<ThemeMode>(
groupValue: controller.currentTheme, groupValue: controller.currentTheme,
value: ThemeMode.light, value: ThemeMode.light,
title: Text(L10n.of(context)!.lightTheme), title: Text(L10n.of(context).lightTheme),
onChanged: controller.switchTheme, onChanged: controller.switchTheme,
), ),
RadioListTile<ThemeMode>( RadioListTile<ThemeMode>(
groupValue: controller.currentTheme, groupValue: controller.currentTheme,
value: ThemeMode.dark, value: ThemeMode.dark,
title: Text(L10n.of(context)!.darkTheme), title: Text(L10n.of(context).darkTheme),
onChanged: controller.switchTheme, onChanged: controller.switchTheme,
), ),
Divider( Divider(
@ -172,7 +171,7 @@ class SettingsStyleView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.overview, L10n.of(context).overview,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -180,13 +179,13 @@ class SettingsStyleView extends StatelessWidget {
), ),
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.presencesToggle, title: L10n.of(context).presencesToggle,
onChanged: (b) => AppConfig.showPresences = b, onChanged: (b) => AppConfig.showPresences = b,
storeKey: SettingKeys.showPresences, storeKey: SettingKeys.showPresences,
defaultValue: AppConfig.showPresences, defaultValue: AppConfig.showPresences,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.separateChatTypes, title: L10n.of(context).separateChatTypes,
onChanged: (b) => AppConfig.separateChatTypes = b, onChanged: (b) => AppConfig.separateChatTypes = b,
storeKey: SettingKeys.separateChatTypes, storeKey: SettingKeys.separateChatTypes,
defaultValue: AppConfig.separateChatTypes, defaultValue: AppConfig.separateChatTypes,
@ -197,7 +196,7 @@ class SettingsStyleView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.messagesStyle, L10n.of(context).messagesStyle,
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -270,7 +269,7 @@ class SettingsStyleView extends StatelessWidget {
), ),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.wallpaper), title: Text(L10n.of(context).wallpaper),
leading: const Icon(Icons.photo_outlined), leading: const Icon(Icons.photo_outlined),
trailing: accountConfig.wallpaperUrl == null trailing: accountConfig.wallpaperUrl == null
? null ? null
@ -286,7 +285,7 @@ class SettingsStyleView extends StatelessWidget {
curve: FluffyThemes.animationCurve, curve: FluffyThemes.animationCurve,
child: accountConfig.wallpaperUrl != null child: accountConfig.wallpaperUrl != null
? SwitchListTile.adaptive( ? SwitchListTile.adaptive(
title: Text(L10n.of(context)!.transparent), title: Text(L10n.of(context).transparent),
secondary: const Icon(Icons.blur_linear_outlined), secondary: const Icon(Icons.blur_linear_outlined),
value: !wallpaperOpacityIsDefault, value: !wallpaperOpacityIsDefault,
onChanged: (_) => onChanged: (_) =>
@ -301,7 +300,7 @@ class SettingsStyleView extends StatelessWidget {
}, },
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.fontSize), title: Text(L10n.of(context).fontSize),
trailing: Text('× ${AppConfig.fontSizeFactor}'), trailing: Text('× ${AppConfig.fontSizeFactor}'),
), ),
Slider.adaptive( Slider.adaptive(

View file

@ -1,12 +1,12 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/widgets/permission_slider_dialog.dart'; import 'package:fluffychat/widgets/permission_slider_dialog.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
import 'user_bottom_sheet_view.dart'; import 'user_bottom_sheet_view.dart';
@ -98,22 +98,22 @@ class UserBottomSheetController extends State<UserBottomSheet> {
final score = await showConfirmationDialog<int>( final score = await showConfirmationDialog<int>(
context: context, context: context,
title: L10n.of(context)!.reportUser, title: L10n.of(context).reportUser,
message: L10n.of(context)!.howOffensiveIsThisContent, message: L10n.of(context).howOffensiveIsThisContent,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
actions: [ actions: [
AlertDialogAction( AlertDialogAction(
key: -100, key: -100,
label: L10n.of(context)!.extremeOffensive, label: L10n.of(context).extremeOffensive,
), ),
AlertDialogAction( AlertDialogAction(
key: -50, key: -50,
label: L10n.of(context)!.offensive, label: L10n.of(context).offensive,
), ),
AlertDialogAction( AlertDialogAction(
key: 0, key: 0,
label: L10n.of(context)!.inoffensive, label: L10n.of(context).inoffensive,
), ),
], ],
); );
@ -121,10 +121,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
final reason = await showTextInputDialog( final reason = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.whyDoYouWantToReportThis, title: L10n.of(context).whyDoYouWantToReportThis,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)], textFields: [DialogTextField(hintText: L10n.of(context).reason)],
); );
if (reason == null || reason.single.isEmpty) return; if (reason == null || reason.single.isEmpty) return;
@ -139,7 +139,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
); );
if (result.error != null) return; if (result.error != null) return;
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.contentHasBeenReported)), SnackBar(content: Text(L10n.of(context).contentHasBeenReported)),
); );
break; break;
case UserBottomSheetAction.mention: case UserBottomSheetAction.mention:
@ -152,10 +152,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.banUserDescription, message: L10n.of(context).banUserDescription,
) == ) ==
OkCancelResult.ok) { OkCancelResult.ok) {
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -170,10 +170,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.unbanUserDescription, message: L10n.of(context).unbanUserDescription,
) == ) ==
OkCancelResult.ok) { OkCancelResult.ok) {
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -188,10 +188,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.kickUserDescription, message: L10n.of(context).kickUserDescription,
) == ) ==
OkCancelResult.ok) { OkCancelResult.ok) {
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -261,10 +261,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.makeAdminDescription, message: L10n.of(context).makeAdminDescription,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;
} }

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_linkify/flutter_linkify.dart'; import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/date_time_extension.dart'; import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/utils/fluffy_share.dart'; import 'package:fluffychat/utils/fluffy_share.dart';
import 'package:fluffychat/utils/url_launcher.dart'; import 'package:fluffychat/utils/url_launcher.dart';
@ -72,13 +72,13 @@ class UserBottomSheetView extends StatelessWidget {
), ),
if (presence.currentlyActive == true) if (presence.currentlyActive == true)
Text( Text(
L10n.of(context)!.currentlyActive, L10n.of(context).currentlyActive,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.bodySmall, style: Theme.of(context).textTheme.bodySmall,
) )
else if (lastActiveTimestamp != null) else if (lastActiveTimestamp != null)
Text( Text(
L10n.of(context)!.lastActiveAgo( L10n.of(context).lastActiveAgo(
lastActiveTimestamp.localizedTimeShort(context), lastActiveTimestamp.localizedTimeShort(context),
), ),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -97,7 +97,7 @@ class UserBottomSheetView extends StatelessWidget {
padding: const EdgeInsets.only(right: 8.0), padding: const EdgeInsets.only(right: 8.0),
child: IconButton( child: IconButton(
icon: const Icon(Icons.block_outlined), icon: const Icon(Icons.block_outlined),
tooltip: L10n.of(context)!.block, tooltip: L10n.of(context).block,
onPressed: () => controller onPressed: () => controller
.participantAction(UserBottomSheetAction.ignore), .participantAction(UserBottomSheetAction.ignore),
), ),
@ -119,7 +119,8 @@ class UserBottomSheetView extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Material( child: Material(
color: Theme.of(context).colorScheme.surfaceVariant, color:
Theme.of(context).colorScheme.surfaceContainerHighest,
borderRadius: borderRadius:
BorderRadius.circular(AppConfig.borderRadius), BorderRadius.circular(AppConfig.borderRadius),
child: ListTile( child: ListTile(
@ -127,7 +128,7 @@ class UserBottomSheetView extends StatelessWidget {
title: Padding( title: Padding(
padding: const EdgeInsets.only(bottom: 12.0), padding: const EdgeInsets.only(bottom: 12.0),
child: Text( child: Text(
L10n.of(context)! L10n.of(context)
.userWouldLikeToChangeTheChat(displayname), .userWouldLikeToChangeTheChat(displayname),
), ),
), ),
@ -136,13 +137,13 @@ class UserBottomSheetView extends StatelessWidget {
TextButton.icon( TextButton.icon(
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: backgroundColor:
Theme.of(context).colorScheme.background, Theme.of(context).colorScheme.surface,
foregroundColor: foregroundColor:
Theme.of(context).colorScheme.primary, Theme.of(context).colorScheme.primary,
), ),
onPressed: controller.knockAccept, onPressed: controller.knockAccept,
icon: const Icon(Icons.check_outlined), icon: const Icon(Icons.check_outlined),
label: Text(L10n.of(context)!.accept), label: Text(L10n.of(context).accept),
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
TextButton.icon( TextButton.icon(
@ -156,7 +157,7 @@ class UserBottomSheetView extends StatelessWidget {
), ),
onPressed: controller.knockDecline, onPressed: controller.knockDecline,
icon: const Icon(Icons.cancel_outlined), icon: const Icon(Icons.cancel_outlined),
label: Text(L10n.of(context)!.decline), label: Text(L10n.of(context).decline),
), ),
], ],
), ),
@ -205,7 +206,7 @@ class UserBottomSheetView extends StatelessWidget {
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: foregroundColor:
Theme.of(context).colorScheme.onBackground, Theme.of(context).colorScheme.onSurface,
), ),
label: Text( label: Text(
displayname, displayname,
@ -252,8 +253,8 @@ class UserBottomSheetView extends StatelessWidget {
icon: const Icon(Icons.forum_outlined), icon: const Icon(Icons.forum_outlined),
label: Text( label: Text(
controller.widget.user == null controller.widget.user == null
? L10n.of(context)!.startConversation ? L10n.of(context).startConversation
: L10n.of(context)!.sendAMessage, : L10n.of(context).sendAMessage,
), ),
), ),
), ),
@ -283,7 +284,7 @@ class UserBottomSheetView extends StatelessWidget {
if (controller.widget.onMention != null) if (controller.widget.onMention != null)
ListTile( ListTile(
leading: const Icon(Icons.alternate_email_outlined), leading: const Icon(Icons.alternate_email_outlined),
title: Text(L10n.of(context)!.mention), title: Text(L10n.of(context).mention),
onTap: () => controller onTap: () => controller
.participantAction(UserBottomSheetAction.mention), .participantAction(UserBottomSheetAction.mention),
), ),
@ -291,7 +292,7 @@ class UserBottomSheetView extends StatelessWidget {
Divider(color: Theme.of(context).dividerColor), Divider(color: Theme.of(context).dividerColor),
ListTile( ListTile(
title: Text( title: Text(
'${L10n.of(context)!.userRole} (${user.powerLevel})', '${L10n.of(context).userRole} (${user.powerLevel})',
), ),
leading: const Icon(Icons.person_outlined), leading: const Icon(Icons.person_outlined),
trailing: Material( trailing: Material(
@ -315,19 +316,19 @@ class UserBottomSheetView extends StatelessWidget {
items: [ items: [
DropdownMenuItem( DropdownMenuItem(
value: 0, value: 0,
child: Text(L10n.of(context)!.user), child: Text(L10n.of(context).user),
), ),
DropdownMenuItem( DropdownMenuItem(
value: 50, value: 50,
child: Text(L10n.of(context)!.moderator), child: Text(L10n.of(context).moderator),
), ),
DropdownMenuItem( DropdownMenuItem(
value: 100, value: 100,
child: Text(L10n.of(context)!.admin), child: Text(L10n.of(context).admin),
), ),
DropdownMenuItem( DropdownMenuItem(
value: null, value: null,
child: Text(L10n.of(context)!.custom), child: Text(L10n.of(context).custom),
), ),
], ],
), ),
@ -339,7 +340,7 @@ class UserBottomSheetView extends StatelessWidget {
ListTile( ListTile(
textColor: Theme.of(context).colorScheme.error, textColor: Theme.of(context).colorScheme.error,
iconColor: Theme.of(context).colorScheme.error, iconColor: Theme.of(context).colorScheme.error,
title: Text(L10n.of(context)!.kickFromChat), title: Text(L10n.of(context).kickFromChat),
leading: const Icon(Icons.exit_to_app_outlined), leading: const Icon(Icons.exit_to_app_outlined),
onTap: () => controller onTap: () => controller
.participantAction(UserBottomSheetAction.kick), .participantAction(UserBottomSheetAction.kick),
@ -350,7 +351,7 @@ class UserBottomSheetView extends StatelessWidget {
ListTile( ListTile(
textColor: Theme.of(context).colorScheme.onErrorContainer, textColor: Theme.of(context).colorScheme.onErrorContainer,
iconColor: Theme.of(context).colorScheme.onErrorContainer, iconColor: Theme.of(context).colorScheme.onErrorContainer,
title: Text(L10n.of(context)!.banFromChat), title: Text(L10n.of(context).banFromChat),
leading: const Icon(Icons.warning_sharp), leading: const Icon(Icons.warning_sharp),
onTap: () => onTap: () =>
controller.participantAction(UserBottomSheetAction.ban), controller.participantAction(UserBottomSheetAction.ban),
@ -359,7 +360,7 @@ class UserBottomSheetView extends StatelessWidget {
user.canBan && user.canBan &&
user.membership == Membership.ban) user.membership == Membership.ban)
ListTile( ListTile(
title: Text(L10n.of(context)!.unbanFromChat), title: Text(L10n.of(context).unbanFromChat),
leading: const Icon(Icons.warning_outlined), leading: const Icon(Icons.warning_outlined),
onTap: () => controller onTap: () => controller
.participantAction(UserBottomSheetAction.unban), .participantAction(UserBottomSheetAction.unban),
@ -368,7 +369,7 @@ class UserBottomSheetView extends StatelessWidget {
ListTile( ListTile(
textColor: Theme.of(context).colorScheme.onErrorContainer, textColor: Theme.of(context).colorScheme.onErrorContainer,
iconColor: Theme.of(context).colorScheme.onErrorContainer, iconColor: Theme.of(context).colorScheme.onErrorContainer,
title: Text(L10n.of(context)!.reportUser), title: Text(L10n.of(context).reportUser),
leading: const Icon(Icons.report_outlined), leading: const Icon(Icons.report_outlined),
onTap: () => controller onTap: () => controller
.participantAction(UserBottomSheetAction.report), .participantAction(UserBottomSheetAction.report),
@ -380,7 +381,7 @@ class UserBottomSheetView extends StatelessWidget {
color: Colors.orange, color: Colors.orange,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.profileNotFound, L10n.of(context).profileNotFound,
style: const TextStyle(color: Colors.orange), style: const TextStyle(color: Colors.orange),
), ),
), ),

Some files were not shown because too many files have changed in this diff Show more