refactor: Migrate to Flutter 3.7.0

This commit is contained in:
Christian Pauly 2023-01-26 09:47:30 +01:00
commit 35174cb859
54 changed files with 876 additions and 2124 deletions

View file

@ -269,7 +269,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
labelStyle: TextStyle(
fontFamily: Theme.of(context)
.textTheme
.bodyText1
.bodyLarge
?.fontFamily),
labelText: L10n.of(context)!.recoveryKey,
errorText: _recoveryKeyInputError,

View file

@ -1072,11 +1072,13 @@ class ChatController extends State<Chat> {
Matrix.of(context).voipPlugin!.voip.requestTurnServerCredentials());
if (success.result != null) {
final voipPlugin = Matrix.of(context).voipPlugin;
await voipPlugin!.voip.inviteToCall(room!.id, callType).catchError((e) {
try {
await voipPlugin!.voip.inviteToCall(room!.id, callType);
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text((e as Object).toLocalizedString(context))),
SnackBar(content: Text(e.toLocalizedString(context))),
);
});
}
} else {
await showOkAlertDialog(
context: context,

View file

@ -69,7 +69,7 @@ class _CuteContentState extends State<CuteContent> {
},
),
);
Overlay.of(context)?.insert(overlay);
Overlay.of(context).insert(overlay);
}
generateLabel(User? user) {

View file

@ -52,7 +52,7 @@ class HtmlMessage extends StatelessWidget {
defaultTextStyle: defaultTextStyle,
emoteSize: emoteSize,
linkStyle: linkStyle ??
themeData.textTheme.bodyText2!.copyWith(
themeData.textTheme.bodyMedium!.copyWith(
color: themeData.colorScheme.secondary,
decoration: TextDecoration.underline,
),

View file

@ -303,8 +303,11 @@ class Message extends StatelessWidget {
child: Center(
child: Material(
color: displayTime
? Theme.of(context).backgroundColor
: Theme.of(context).backgroundColor.withOpacity(0.33),
? Theme.of(context).colorScheme.background
: Theme.of(context)
.colorScheme
.background
.withOpacity(0.33),
borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
clipBehavior: Clip.antiAlias,
child: Padding(

View file

@ -37,7 +37,7 @@ class VerificationRequestContent extends StatelessWidget {
color: Theme.of(context).dividerColor,
),
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
),
child: Row(
mainAxisSize: MainAxisSize.min,

View file

@ -232,7 +232,7 @@ class InputBar extends StatelessWidget {
hint,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.caption,
style: Theme.of(context).textTheme.bodySmall,
),
],
),

View file

@ -160,7 +160,7 @@ class RecordingDialogState extends State<RecordingDialog> {
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyText2
.bodyMedium
?.color
?.withAlpha(150),
),
@ -183,7 +183,7 @@ class RecordingDialogState extends State<RecordingDialog> {
L10n.of(context)!.cancel.toUpperCase(),
style: TextStyle(
color:
Theme.of(context).textTheme.bodyText2?.color?.withAlpha(150),
Theme.of(context).textTheme.bodyMedium?.color?.withAlpha(150),
),
),
),

View file

@ -80,7 +80,7 @@ class _EditContent extends StatelessWidget {
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Theme.of(context).textTheme.bodyText2!.color,
color: Theme.of(context).textTheme.bodyMedium!.color,
),
);
}),

View file

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

View file

@ -49,6 +49,7 @@ class SendFileDialogState extends State<SendFileDialog> {
scaffoldMessenger.showSnackBar(
SnackBar(content: Text(e.toLocalizedString())),
);
return null;
});
}
Navigator.of(context, rootNavigator: false).pop();

View file

@ -42,7 +42,7 @@ class ChatDetailsView extends StatelessWidget {
(room.summary.mJoinedMemberCount ?? 0);
final canRequestMoreMembers =
controller.members!.length < actualMembersCount;
final iconColor = Theme.of(context).textTheme.bodyText1!.color;
final iconColor = Theme.of(context).textTheme.bodyLarge!.color;
return StreamBuilder(
stream: room.onUpdate.stream,
builder: (context, snapshot) {
@ -127,7 +127,7 @@ class ChatDetailsView extends StatelessWidget {
fontSize: 14,
color: Theme.of(context)
.textTheme
.bodyText2!
.bodyMedium!
.color,
),
onLinkTap: (url) =>

View file

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/config/app_config.dart';
@ -30,7 +30,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
title: Text(L10n.of(context)!.endToEndEncryption),
actions: [
TextButton(
onPressed: () => launch(AppConfig.encryptionTutorial),
onPressed: () =>
launchUrlString(AppConfig.encryptionTutorial),
child: Text(L10n.of(context)!.help),
),
],

View file

@ -228,9 +228,9 @@ class ChatListViewBody extends StatelessWidget {
}
const dummyChatCount = 5;
final titleColor =
Theme.of(context).textTheme.bodyText1!.color!.withAlpha(100);
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(100);
final subtitleColor =
Theme.of(context).textTheme.bodyText1!.color!.withAlpha(50);
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(50);
return ListView.builder(
key: const Key('dummychats'),
itemCount: dummyChatCount,
@ -241,7 +241,7 @@ class ChatListViewBody extends StatelessWidget {
backgroundColor: titleColor,
child: CircularProgressIndicator(
strokeWidth: 1,
color: Theme.of(context).textTheme.bodyText1!.color,
color: Theme.of(context).textTheme.bodyLarge!.color,
),
),
title: Row(

View file

@ -189,7 +189,7 @@ class ChatListItem extends StatelessWidget {
fontSize: 13,
color: unread
? Theme.of(context).colorScheme.secondary
: Theme.of(context).textTheme.bodyText2!.color,
: Theme.of(context).textTheme.bodyMedium!.color,
),
),
),

View file

@ -102,7 +102,7 @@ class ClientChooserButton extends StatelessWidget {
Text(
bundle!,
style: TextStyle(
color: Theme.of(context).textTheme.subtitle1!.color,
color: Theme.of(context).textTheme.titleMedium!.color,
fontSize: 14,
),
),

View file

@ -158,7 +158,7 @@ class _SpaceViewState extends State<SpaceView> {
MatrixLocals(L10n.of(context)!),
);
return Material(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
child: ListTile(
leading: Avatar(
mxContent: rootSpace.avatar,

View file

@ -94,7 +94,7 @@ class StoriesHeader extends StatelessWidget {
leading: CircleAvatar(
radius: Avatar.defaultSize / 2,
backgroundColor: Theme.of(context).colorScheme.surface,
foregroundColor: Theme.of(context).textTheme.bodyText1?.color,
foregroundColor: Theme.of(context).textTheme.bodyLarge?.color,
child: const Icon(Icons.camera_alt_outlined),
),
title: Text(L10n.of(context)!.addToStory),
@ -226,7 +226,7 @@ class _StoryButton extends StatelessWidget {
backgroundColor:
Theme.of(context).colorScheme.surface,
foregroundColor:
Theme.of(context).textTheme.bodyText1?.color,
Theme.of(context).textTheme.bodyLarge?.color,
child: Hero(
tag: heroTag,
child: Avatar(

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:matrix_homeserver_recommendations/matrix_homeserver_recommendations.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
class HomeserverBottomSheet extends StatelessWidget {
final HomeserverBenchmarkResult homeserver;
@ -38,25 +38,26 @@ class HomeserverBottomSheet extends StatelessWidget {
title: Text(homeserverSoftware),
),
ListTile(
onTap: () => launch(homeserver.homeserver.baseUrl.toString()),
onTap: () =>
launchUrlString(homeserver.homeserver.baseUrl.toString()),
leading: const Icon(Icons.link_outlined),
title: Text(homeserver.homeserver.baseUrl.toString()),
),
if (registration != null)
ListTile(
onTap: () => launch(registration.toString()),
onTap: () => launchUrlString(registration.toString()),
leading: const Icon(Icons.person_add_outlined),
title: Text(registration.toString()),
),
if (rules != null)
ListTile(
onTap: () => launch(rules.toString()),
onTap: () => launchUrlString(rules.toString()),
leading: const Icon(Icons.visibility_outlined),
title: Text(rules.toString()),
),
if (privacy != null)
ListTile(
onTap: () => launch(privacy.toString()),
onTap: () => launchUrlString(privacy.toString()),
leading: const Icon(Icons.shield_outlined),
title: Text(privacy.toString()),
),

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
@ -121,7 +121,7 @@ class HomeserverPickerView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
TextButton(
onPressed: () => launch(AppConfig.privacyUrl),
onPressed: () => launchUrlString(AppConfig.privacyUrl),
child: Text(L10n.of(context)!.privacy),
),
TextButton(

View file

@ -115,10 +115,7 @@ class LoginController extends State<Login> {
// do nothing, newDomain is already set to a reasonable fallback
}
if (newDomain != oldHomeserver) {
Matrix.of(context)
.getLoginClient()
.checkHomeserver(newDomain)
.catchError((e) {});
await Matrix.of(context).getLoginClient().checkHomeserver(newDomain);
if (Matrix.of(context).getLoginClient().homeserver == null) {
Matrix.of(context).getLoginClient().homeserver = oldHomeserver;

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/config/app_config.dart';
@ -93,12 +93,12 @@ class SettingsView extends StatelessWidget {
ListTile(
leading: const Icon(Icons.help_outline_outlined),
title: Text(L10n.of(context)!.help),
onTap: () => launch(AppConfig.supportUrl),
onTap: () => launchUrlString(AppConfig.supportUrl),
),
ListTile(
leading: const Icon(Icons.shield_sharp),
title: Text(L10n.of(context)!.privacy),
onTap: () => launch(AppConfig.privacyUrl),
onTap: () => launchUrlString(AppConfig.privacyUrl),
),
ListTile(
leading: const Icon(Icons.info_outline_rounded),

View file

@ -17,7 +17,7 @@ class SettingsAccountView extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.account)),
body: ListTileTheme(
iconColor: Theme.of(context).textTheme.bodyText1!.color,
iconColor: Theme.of(context).textTheme.bodyLarge!.color,
child: MaxWidthBody(
withScrolling: true,
child: Column(

View file

@ -22,7 +22,7 @@ class SettingsChatView extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.chat)),
body: ListTileTheme(
iconColor: Theme.of(context).textTheme.bodyText1!.color,
iconColor: Theme.of(context).textTheme.bodyLarge!.color,
child: MaxWidthBody(
withScrolling: true,
child: Column(

View file

@ -19,7 +19,7 @@ class SettingsSecurityView extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.security)),
body: ListTileTheme(
iconColor: Theme.of(context).textTheme.bodyText1!.color,
iconColor: Theme.of(context).textTheme.bodyLarge!.color,
child: MaxWidthBody(
withScrolling: true,
child: Column(

View file

@ -123,7 +123,7 @@ class SettingsStyleView extends StatelessWidget {
title: Text(L10n.of(context)!.changeWallpaper),
trailing: Icon(
Icons.photo_outlined,
color: Theme.of(context).textTheme.bodyText1?.color,
color: Theme.of(context).textTheme.bodyLarge?.color,
),
onTap: controller.setWallpaperAction,
);