fix: Crash when opening settings in column mode from popup menu

pull/1850/head
krille-chan 5 months ago
parent cf1dc0c37a
commit 24e25c1d9b
No known key found for this signature in database

@ -4,6 +4,7 @@ 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/config/themes.dart';
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart'; import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.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';
@ -66,16 +67,17 @@ class ClientChooserButton extends StatelessWidget {
], ],
), ),
), ),
PopupMenuItem( if (!FluffyThemes.isColumnMode(context))
value: SettingsAction.settings, PopupMenuItem(
child: Row( value: SettingsAction.settings,
children: [ child: Row(
const Icon(Icons.settings_outlined), children: [
const SizedBox(width: 18), const Icon(Icons.settings_outlined),
Text(L10n.of(context).settings), const SizedBox(width: 18),
], Text(L10n.of(context).settings),
],
),
), ),
),
const PopupMenuDivider(), const PopupMenuDivider(),
for (final bundle in bundles) ...[ for (final bundle in bundles) ...[
if (matrix.accountBundles[bundle]!.length != 1 || if (matrix.accountBundles[bundle]!.length != 1 ||
@ -156,30 +158,22 @@ class ClientChooserButton extends StatelessWidget {
matrix.accountBundles.forEach((key, value) => clientCount += value.length); matrix.accountBundles.forEach((key, value) => clientCount += value.length);
return FutureBuilder<Profile>( return FutureBuilder<Profile>(
future: matrix.client.fetchOwnProfile(), future: matrix.client.fetchOwnProfile(),
builder: (context, snapshot) => Stack( builder: (context, snapshot) => Material(
alignment: Alignment.center, clipBehavior: Clip.hardEdge,
children: [ borderRadius: BorderRadius.circular(99),
...List.generate( color: Colors.transparent,
clientCount, child: PopupMenuButton<Object>(
(index) => const SizedBox.shrink(), onSelected: (o) => _clientSelected(o, context),
), itemBuilder: _bundleMenuItems,
const SizedBox.shrink(), child: Center(
const SizedBox.shrink(), child: Avatar(
PopupMenuButton<Object>( mxContent: snapshot.data?.avatarUrl,
onSelected: (o) => _clientSelected(o, context), name:
itemBuilder: _bundleMenuItems, snapshot.data?.displayName ?? matrix.client.userID!.localpart,
child: Material( size: 32,
color: Colors.transparent,
borderRadius: BorderRadius.circular(99),
child: Avatar(
mxContent: snapshot.data?.avatarUrl,
name: snapshot.data?.displayName ??
matrix.client.userID!.localpart,
size: 32,
),
), ),
), ),
], ),
), ),
); );
} }

@ -810,10 +810,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: go_router name: go_router
sha256: f02fd7d2a4dc512fec615529824fdd217fecb3a3d3de68360293a551f21634b3 sha256: "0b1e06223bee260dee31a171fb1153e306907563a0b0225e8c1733211911429a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "14.8.1" version: "15.1.2"
gtk: gtk:
dependency: transitive dependency: transitive
description: description:

@ -49,7 +49,7 @@ dependencies:
flutter_web_auth_2: ^3.1.1 # Version 4 blocked by https://github.com/MixinNetwork/flutter-plugins/issues/379 flutter_web_auth_2: ^3.1.1 # Version 4 blocked by https://github.com/MixinNetwork/flutter-plugins/issues/379
flutter_webrtc: ^0.12.9 flutter_webrtc: ^0.12.9
geolocator: ^13.0.1 geolocator: ^13.0.1
go_router: ^14.8.1 go_router: ^15.1.2
handy_window: ^0.4.0 handy_window: ^0.4.0
hive: ^2.2.3 hive: ^2.2.3
hive_flutter: ^1.1.0 hive_flutter: ^1.1.0

Loading…
Cancel
Save