fix: App crash on page navigation with open popup menu

This commit is contained in:
Christian Kußowski 2025-05-29 12:44:06 +02:00
commit 49780b01fe
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
8 changed files with 10 additions and 0 deletions

View file

@ -118,6 +118,7 @@ class ChatInputRow extends StatelessWidget {
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: PopupMenuButton<String>( child: PopupMenuButton<String>(
useRootNavigator: true,
icon: const Icon(Icons.add_circle_outline), icon: const Icon(Icons.add_circle_outline),
iconColor: theme.colorScheme.onPrimaryContainer, iconColor: theme.colorScheme.onPrimaryContainer,
onSelected: controller.onAddPopupMenuButtonSelected, onSelected: controller.onAddPopupMenuButtonSelected,
@ -198,6 +199,7 @@ class ChatInputRow extends StatelessWidget {
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: PopupMenuButton( child: PopupMenuButton(
useRootNavigator: true,
icon: const Icon(Icons.camera_alt_outlined), icon: const Icon(Icons.camera_alt_outlined),
onSelected: controller.onAddPopupMenuButtonSelected, onSelected: controller.onAddPopupMenuButtonSelected,
iconColor: theme.colorScheme.onPrimaryContainer, iconColor: theme.colorScheme.onPrimaryContainer,
@ -365,6 +367,7 @@ class _ChatAccountPicker extends StatelessWidget {
child: FutureBuilder<Profile>( child: FutureBuilder<Profile>(
future: controller.sendingClient.fetchOwnProfile(), future: controller.sendingClient.fetchOwnProfile(),
builder: (context, snapshot) => PopupMenuButton<String>( builder: (context, snapshot) => PopupMenuButton<String>(
useRootNavigator: true,
onSelected: (mxid) => _popupMenuButtonSelected(mxid, context), onSelected: (mxid) => _popupMenuButtonSelected(mxid, context),
itemBuilder: (BuildContext context) => clients itemBuilder: (BuildContext context) => clients
.map( .map(

View file

@ -72,6 +72,7 @@ class ChatView extends StatelessWidget {
), ),
if (controller.selectedEvents.length == 1) if (controller.selectedEvents.length == 1)
PopupMenuButton<_EventContextAction>( PopupMenuButton<_EventContextAction>(
useRootNavigator: true,
onSelected: (action) { onSelected: (action) {
switch (action) { switch (action) {
case _EventContextAction.info: case _EventContextAction.info:

View file

@ -162,6 +162,7 @@ class ClientChooserButton extends StatelessWidget {
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
color: Colors.transparent, color: Colors.transparent,
child: PopupMenuButton<Object>( child: PopupMenuButton<Object>(
useRootNavigator: true,
popUpAnimationStyle: FluffyThemes.isColumnMode(context) popUpAnimationStyle: FluffyThemes.isColumnMode(context)
? AnimationStyle.noAnimation ? AnimationStyle.noAnimation
: null, // https://github.com/flutter/flutter/issues/167180 : null, // https://github.com/flutter/flutter/issues/167180

View file

@ -265,6 +265,7 @@ class _SpaceViewState extends State<SpaceView> {
), ),
actions: [ actions: [
PopupMenuButton<SpaceActions>( PopupMenuButton<SpaceActions>(
useRootNavigator: true,
onSelected: _onSpaceAction, onSelected: _onSpaceAction,
itemBuilder: (context) => [ itemBuilder: (context) => [
PopupMenuItem( PopupMenuItem(

View file

@ -35,6 +35,7 @@ class HomeserverPickerView extends StatelessWidget {
), ),
actions: [ actions: [
PopupMenuButton<MoreLoginActions>( PopupMenuButton<MoreLoginActions>(
useRootNavigator: true,
onSelected: controller.onMoreAction, onSelected: controller.onMoreAction,
itemBuilder: (_) => [ itemBuilder: (_) => [
PopupMenuItem( PopupMenuItem(

View file

@ -29,6 +29,7 @@ class EmotesSettingsView extends StatelessWidget {
title: Text(L10n.of(context).customEmojisAndStickers), title: Text(L10n.of(context).customEmojisAndStickers),
actions: [ actions: [
PopupMenuButton<PopupMenuEmojiActions>( PopupMenuButton<PopupMenuEmojiActions>(
useRootNavigator: true,
onSelected: (value) { onSelected: (value) {
switch (value) { switch (value) {
case PopupMenuEmojiActions.export: case PopupMenuEmojiActions.export:

View file

@ -52,6 +52,7 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
children: [ children: [
const SizedBox.shrink(), const SizedBox.shrink(),
PopupMenuButton<ChatPopupMenuActions>( PopupMenuButton<ChatPopupMenuActions>(
useRootNavigator: true,
onSelected: (choice) async { onSelected: (choice) async {
switch (choice) { switch (choice) {
case ChatPopupMenuActions.leave: case ChatPopupMenuActions.leave:

View file

@ -36,6 +36,7 @@ class LogViewerState extends State<LogViewer> {
onPressed: () => setState(() => fontSize--), onPressed: () => setState(() => fontSize--),
), ),
PopupMenuButton<Level>( PopupMenuButton<Level>(
useRootNavigator: true,
itemBuilder: (context) => Level.values itemBuilder: (context) => Level.values
.map( .map(
(level) => PopupMenuItem( (level) => PopupMenuItem(