Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

🐛 [FlyoutListTile] in 4.1.1 throws "Null check operator used on a null value" #650

Closed
arrowxpr opened this issue Dec 12, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@arrowxpr
Copy link

Just upgraded from 3.12 to 4.1.1 and all my FlyoutListTile widgets throw exception

the mere use of it: FlyoutListTile(text: Text('text')),

The following _CastError was thrown building FlyoutListTile(dirty, dependencies: [_FluentTheme]):
Null check operator used on a null value

When the exception was thrown, this was the stack: 
#0      ContentSizeInfo.of (package:fluent_ui/src/utils/popup.dart:618:73)
#1      FlyoutListTile.build (package:fluent_ui/src/controls/surfaces/flyout/content.dart:131:34)
#2      StatelessElement.build (package:flutter/src/widgets/framework.dart:4949:49)
#3      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4878:15)
#4      Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#5      ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4859:5)
#6      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4853:5)
...     Normal element mounting (9 frames)
#15     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3863:16)
#16     MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6435:36)
#17     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6447:32)
...     Normal element mounting (108 frames)
#125    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3863:16)
#126    MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6435:36)
#127    MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6447:32)
...     Normal element mounting (16 frames)
#143    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3863:16)
#144    MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6435:36)
#145    MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6447:32)
...     Normal element mounting (114 frames)
#259    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3863:16)
#260    Element.updateChild (package:flutter/src/widgets/framework.dart:3586:20)
#261    SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1405:37)
#262    SliverMultiBoxAdaptorElement.performRebuild.processElement (package:flutter/src/widgets/sliver.dart:1306:35)
#263    Iterable.forEach (dart:core/iterable.dart:325:35)
#264    SliverMultiBoxAdaptorElement.performRebuild (package:flutter/src/widgets/sliver.dart:1353:24)
#265    SliverMultiBoxAdaptorElement.update (package:flutter/src/widgets/sliver.dart:1282:7)
#266    Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)```




Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b8f7f1f986 (3 weeks ago) • 2022-11-23 06:43:51 +0900
Engine • revision 8f2221fbef
Tools • Dart 2.18.5 • DevTools 2.15.0

@arrowxpr
Copy link
Author

issue persists in fluent_ui 4.1.2

@arrowxpr
Copy link
Author

The problem seems to be coming from final size = ContentSizeInfo.of(context).size; which is inside the build of FlyoutListTile.

For a temporary fix I just commented lines 131 and 173 in the content.dart file which contains FlyoutListTile

@bdlukaa
Copy link
Owner

bdlukaa commented Dec 12, 2022

FlyoutListTile were made to be used inside of a Flyout. Can you post a reproducible snippet?

@arrowxpr
Copy link
Author

arrowxpr commented Dec 13, 2022

FlyoutListTile were made to be used inside of a Flyout. Can you post a reproducible snippet?

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return FluentApp(
      debugShowCheckedModeBanner: false,
      home: Flyout(
        content: (_) => FlyoutListTile(onPressed: () {}, text: const Text('')),
        child: FlyoutListTile(onPressed: () {}, text: const Text('')),
      ),
    );
  }
}

The FlyoutListTile doesn't throw (but also doesn't behave like one) if it's supplied to the content parameter, while the child one throws the exception mentioned earlier. I don't understand why would not FlyoutListTile be allowed to be used as such, just like in version 3.12, where I jumped from right to the latest.

@bdlukaa bdlukaa added bug Something isn't working and removed waiting response labels Dec 14, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants