refactor: Update to Dart 3.10 with . shorthands

This commit is contained in:
Christian Kußowski 2025-11-30 12:54:06 +01:00
commit 1ea649f01e
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
167 changed files with 3351 additions and 3912 deletions

View file

@ -52,8 +52,9 @@ class NewPrivateChatController extends State<NewPrivateChat> {
}
Future<List<Profile>> _searchUser(String searchTerm) async {
final result =
await Matrix.of(context).client.searchUserDirectory(searchTerm);
final result = await Matrix.of(
context,
).client.searchUserDirectory(searchTerm);
final profiles = result.results;
if (searchTerm.isValidMatrixId &&
@ -73,9 +74,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
if (info.version.sdkInt < 21) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
L10n.of(context).unsupportedAndroidVersionLong,
),
content: Text(L10n.of(context).unsupportedAndroidVersionLong),
),
);
return;
@ -93,15 +92,13 @@ class NewPrivateChatController extends State<NewPrivateChat> {
await Clipboard.setData(
ClipboardData(text: Matrix.of(context).client.userID!),
);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context).copiedToClipboard)),
);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(L10n.of(context).copiedToClipboard)));
}
void openUserModal(Profile profile) => UserDialog.show(
context: context,
profile: profile,
);
void openUserModal(Profile profile) =>
UserDialog.show(context: context, profile: profile);
@override
Widget build(BuildContext context) => NewPrivateChatView(this);

View file

@ -35,8 +35,10 @@ class NewPrivateChatView extends StatelessWidget {
backgroundColor: theme.scaffoldBackgroundColor,
actions: [
TextButton(
onPressed:
UrlLauncher(context, AppConfig.startChatTutorial).launchUrl,
onPressed: UrlLauncher(
context,
AppConfig.startChatTutorial,
).launchUrl,
child: Text(L10n.of(context).help),
),
],
@ -105,8 +107,9 @@ class NewPrivateChatView extends StatelessWidget {
? ListView(
children: [
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 18.0),
padding: const EdgeInsets.symmetric(
horizontal: 18.0,
),
child: SelectableText.rich(
TextSpan(
children: [
@ -157,8 +160,9 @@ class NewPrivateChatView extends StatelessWidget {
theme.colorScheme.primaryContainer,
foregroundColor:
theme.colorScheme.onPrimaryContainer,
child:
const Icon(Icons.qr_code_scanner_outlined),
child: const Icon(
Icons.qr_code_scanner_outlined,
),
),
title: Text(L10n.of(context).scanQrCode),
onTap: controller.openScannerAction,
@ -185,15 +189,14 @@ class NewPrivateChatView extends StatelessWidget {
borderRadius: BorderRadius.circular(
AppConfig.borderRadius,
),
onTap: () => showQrCodeViewer(
context,
userId,
),
onTap: () =>
showQrCodeViewer(context, userId),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: ConstrainedBox(
constraints:
const BoxConstraints(maxWidth: 200),
constraints: const BoxConstraints(
maxWidth: 200,
),
child: PrettyQrView.data(
data: 'https://matrix.to/#/$userId',
decoration: PrettyQrDecoration(
@ -218,7 +221,7 @@ class NewPrivateChatView extends StatelessWidget {
final error = snapshot.error;
if (error != null) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: .center,
children: [
Text(
error.toLocalizedString(context),
@ -243,7 +246,7 @@ class NewPrivateChatView extends StatelessWidget {
}
if (result.isEmpty) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: .center,
children: [
const Icon(Icons.search_outlined, size: 86),
Padding(
@ -265,7 +268,8 @@ class NewPrivateChatView extends StatelessWidget {
itemCount: result.length,
itemBuilder: (context, i) {
final contact = result[i];
final displayname = contact.displayName ??
final displayname =
contact.displayName ??
contact.userId.localpart ??
contact.userId;
return ListTile(