fix: Crash in settings when using MAS

pull/1641/head
krille-chan 1 week ago
parent 7a83927833
commit 99c49e3df2
No known key found for this signature in database

@ -199,14 +199,6 @@ class SettingsController extends State<Settings> {
checkBootstrap(); checkBootstrap();
} }
Future<String?> getOidcAccountManageUrl() async {
final client = Matrix.of(context).client;
final wellKnown = client.wellKnown ?? await client.getWellknown();
return wellKnown.additionalProperties
.tryGetMap<String, Object?>('org.matrix.msc2965.authentication')
?.tryGet<String>('account');
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final client = Matrix.of(context).client; final client = Matrix.of(context).client;

@ -25,6 +25,12 @@ class SettingsView extends StatelessWidget {
final showChatBackupBanner = controller.showChatBackupBanner; final showChatBackupBanner = controller.showChatBackupBanner;
final activeRoute = final activeRoute =
GoRouter.of(context).routeInformationProvider.value.uri.path; GoRouter.of(context).routeInformationProvider.value.uri.path;
final accountManageUrl = Matrix.of(context)
.client
.wellKnown
?.additionalProperties
.tryGetMap<String, Object?>('org.matrix.msc2965.authentication')
?.tryGet<String>('account');
return Row( return Row(
children: [ children: [
if (FluffyThemes.isColumnMode(context)) ...[ if (FluffyThemes.isColumnMode(context)) ...[
@ -52,11 +58,7 @@ class SettingsView extends StatelessWidget {
), ),
body: ListTileTheme( body: ListTileTheme(
iconColor: theme.colorScheme.onSurface, iconColor: theme.colorScheme.onSurface,
child: FutureBuilder( child: ListView(
future: controller.getOidcAccountManageUrl(),
builder: (context, snapshot) {
final accountManageUrl = snapshot.data;
return ListView(
key: const Key('SettingsListViewContent'), key: const Key('SettingsListViewContent'),
children: <Widget>[ children: <Widget>[
FutureBuilder<Profile>( FutureBuilder<Profile>(
@ -100,8 +102,7 @@ class SettingsView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
TextButton.icon( TextButton.icon(
onPressed: onPressed: controller.setDisplaynameAction,
controller.setDisplaynameAction,
icon: const Icon( icon: const Icon(
Icons.edit_outlined, Icons.edit_outlined,
size: 16, size: 16,
@ -177,8 +178,7 @@ 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),
tileColor: tileColor: activeRoute.startsWith('/rooms/settings/style')
activeRoute.startsWith('/rooms/settings/style')
? theme.colorScheme.surfaceContainerHigh ? theme.colorScheme.surfaceContainerHigh
: null, : null,
onTap: () => context.go('/rooms/settings/style'), onTap: () => context.go('/rooms/settings/style'),
@ -186,19 +186,17 @@ class SettingsView extends StatelessWidget {
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),
tileColor: activeRoute tileColor:
.startsWith('/rooms/settings/notifications') activeRoute.startsWith('/rooms/settings/notifications')
? theme.colorScheme.surfaceContainerHigh ? theme.colorScheme.surfaceContainerHigh
: null, : null,
onTap: () => onTap: () => context.go('/rooms/settings/notifications'),
context.go('/rooms/settings/notifications'),
), ),
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'),
tileColor: tileColor: activeRoute.startsWith('/rooms/settings/devices')
activeRoute.startsWith('/rooms/settings/devices')
? theme.colorScheme.surfaceContainerHigh ? theme.colorScheme.surfaceContainerHigh
: null, : null,
), ),
@ -206,8 +204,7 @@ class SettingsView extends StatelessWidget {
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'),
tileColor: tileColor: activeRoute.startsWith('/rooms/settings/chat')
activeRoute.startsWith('/rooms/settings/chat')
? theme.colorScheme.surfaceContainerHigh ? theme.colorScheme.surfaceContainerHigh
: null, : null,
), ),
@ -252,8 +249,6 @@ class SettingsView extends StatelessWidget {
onTap: controller.logoutAction, onTap: controller.logoutAction,
), ),
], ],
);
},
), ),
), ),
), ),

@ -35,7 +35,7 @@ class SettingsHomeserverView extends StatelessWidget {
), ),
), ),
body: MaxWidthBody( body: MaxWidthBody(
withScrolling: false, withScrolling: true,
child: SelectionArea( child: SelectionArea(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

Loading…
Cancel
Save