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

@ -42,8 +42,10 @@ class HomeserverPickerController extends State<HomeserverPicker> {
/// well-known information and forwards to the login page depending on the
/// login type.
Future<void> checkHomeserverAction({bool legacyPasswordLogin = false}) async {
final homeserverInput =
homeserverController.text.trim().toLowerCase().replaceAll(' ', '-');
final homeserverInput = homeserverController.text
.trim()
.toLowerCase()
.replaceAll(' ', '-');
if (homeserverInput.isEmpty) {
final client = await Matrix.of(context).getLoginClient();
@ -113,14 +115,12 @@ class HomeserverPickerController extends State<HomeserverPicker> {
void ssoLoginAction() async {
final redirectUrl = kIsWeb
? Uri.parse(html.window.location.href)
.resolveUri(
Uri(pathSegments: ['auth.html']),
)
.toString()
? Uri.parse(
html.window.location.href,
).resolveUri(Uri(pathSegments: ['auth.html'])).toString()
: isDefaultPlatform
? '${AppConfig.appOpenUrlScheme.toLowerCase()}://login'
: 'http://localhost:3001//login';
? '${AppConfig.appOpenUrlScheme.toLowerCase()}://login'
: 'http://localhost:3001//login';
final client = await Matrix.of(context).getLoginClient();
final url = client.homeserver!.replace(
path: '/_matrix/client/v3/login/sso/redirect',

View file

@ -15,18 +15,16 @@ import 'homeserver_picker.dart';
class HomeserverPickerView extends StatelessWidget {
final HomeserverPickerController controller;
const HomeserverPickerView(
this.controller, {
super.key,
});
const HomeserverPickerView(this.controller, {super.key});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return LoginScaffold(
enforceMobileMode:
Matrix.of(context).widget.clients.any((client) => client.isLogged()),
enforceMobileMode: Matrix.of(
context,
).widget.clients.any((client) => client.isLogged()),
appBar: AppBar(
centerTitle: true,
title: Text(
@ -42,7 +40,7 @@ class HomeserverPickerView extends StatelessWidget {
PopupMenuItem(
value: MoreLoginActions.importBackup,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisSize: .min,
children: [
const Icon(Icons.import_export_outlined),
const SizedBox(width: 12),
@ -53,7 +51,7 @@ class HomeserverPickerView extends StatelessWidget {
PopupMenuItem(
value: MoreLoginActions.privacy,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisSize: .min,
children: [
const Icon(Icons.privacy_tip_outlined),
const SizedBox(width: 12),
@ -64,7 +62,7 @@ class HomeserverPickerView extends StatelessWidget {
PopupMenuItem(
value: MoreLoginActions.about,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisSize: .min,
children: [
const Icon(Icons.info_outlined),
const SizedBox(width: 12),
@ -100,8 +98,9 @@ class HomeserverPickerView extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: SelectableLinkify(
text: L10n.of(context).appIntroduction,
textScaleFactor:
MediaQuery.textScalerOf(context).scale(1),
textScaleFactor: MediaQuery.textScalerOf(
context,
).scale(1),
textAlign: TextAlign.center,
linkStyle: TextStyle(
color: theme.colorScheme.secondary,
@ -114,8 +113,8 @@ class HomeserverPickerView extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(32.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: .min,
crossAxisAlignment: .stretch,
children: [
TextField(
onSubmitted: (_) =>
@ -147,11 +146,13 @@ class HomeserverPickerView extends StatelessWidget {
L10n.of(context).whatIsAHomeserver,
),
content: Linkify(
text: L10n.of(context)
.homeserverDescription,
text: L10n.of(
context,
).homeserverDescription,
textScaleFactor:
MediaQuery.textScalerOf(context)
.scale(1),
MediaQuery.textScalerOf(
context,
).scale(1),
options: const LinkifyOptions(
humanize: false,
),
@ -169,8 +170,9 @@ class HomeserverPickerView extends StatelessWidget {
Uri.https('servers.joinmatrix.org'),
),
child: Text(
L10n.of(context)
.discoverHomeservers,
L10n.of(
context,
).discoverHomeservers,
),
),
AdaptiveDialogAction(
@ -206,8 +208,8 @@ class HomeserverPickerView extends StatelessWidget {
onPressed: controller.isLoading
? null
: () => controller.checkHomeserverAction(
legacyPasswordLogin: true,
),
legacyPasswordLogin: true,
),
child: Text(L10n.of(context).loginWithMatrixId),
),
],