robert-luoqing/flutter_list_view

PopupMenuButton doesn't work

Closed this issue · 2 comments

I'm trying to integrate PopupMenuButton with FlutterListView but it doesn't show menu buttons when I click on more_vertical icon.

FlutterListView(
                  controller: ctl.listViewController,
                  delegate: FlutterListViewDelegate((context, index) {
                    return ListTile(
                      title: Text('index: $index'),
                      trailing: PopupMenuButton<String>(
                        key: ValueKey(index),
                        offset: const Offset(0, 8),
                        child: const Icon(Icons.more_vert),
                        itemBuilder: (context) {
                          return const [
                            PopupMenuItem(
                              value: 'edit',
                              child: Text('Edit'),
                            ),
                            PopupMenuItem(
                              value: 'delete',
                              child: Text('Delete'),
                            )
                          ];
                        },
                        onSelected: (val) {
                          Fluttertoast.showToast(msg: val);
                        },
                      ),
                    );

2022-03-24 18 31 13

After clicking on more_vertical icon It show these errors:

══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════
The following assertion was thrown during a scheduler callback:
Offset argument contained a NaN value.
'dart:ui/painting.dart':
Failed assertion: line 43 pos 10: '<optimized out>'

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack:
#2      _offsetIsValid (dart:ui/painting.dart:43:10)
#3      Path.contains (dart:ui/painting.dart:2557:12)
#4      PhysicalModelLayer.findAnnotations (package:flutter/src/rendering/layer.dart:2055:20)
#5      ContainerLayer.findAnnotations (package:flutter/src/rendering/layer.dart:986:37)
#6      OffsetLayer.findAnnotations (package:flutter/src/rendering/layer.dart:1217:18)
#7      ContainerLayer.findAnnotations (package:flutter/src/rendering/layer.dart:986:37)
#8      OffsetLayer.findAnnotations (package:flutter/src/rendering/layer.dart:1217:18)
#9      ContainerLayer.findAnnotations (package:flutter/src/rendering/layer.dart:986:37)
#10     OffsetLayer.findAnnotations (package:flutter/src/rendering/layer.dart:1217:18)
#11     ContainerLayer.findAnnotations (package:flutter/src/rendering/layer.dart:986:37)
#12     OffsetLayer.findAnnotations (package:flutter/src/rendering/layer.dart:1217:18)
#13     TransformLayer.findAnnotations (package:flutter/src/rendering/layer.dart:1702:18)
#14     Layer.find (package:flutter/src/rendering/layer.dart:494:5)
#15     RenderView._updateSystemChrome (package:flutter/src/rendering/view.dart:287:60)
#16     RenderView.compositeFrame (package:flutter/src/rendering/view.dart:230:9)
#17     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:501:18)
#18     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#19     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#20     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#21     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1081:9)
#22     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:995:5)
#26     _invoke (dart:ui/hooks.dart:151:10)
#27     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#28     _drawFrame (dart:ui/hooks.dart:115:31)
(elided 5 frames from class _AssertionError and dart:async)

Doctor summery

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.2 21D49 darwin-x64, locale en-KH)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.65.2)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

• No issues found!

@serey168 Bug has fixed, please update to flutter_list_view: ^1.1.11

Thanks

@robert-bitguild Now, It's working. Thank you so much!