Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Exception thrown with showDivider property #10

Closed
fernando-s97 opened this issue Aug 27, 2020 · 2 comments
Closed

Exception thrown with showDivider property #10

fernando-s97 opened this issue Aug 27, 2020 · 2 comments

Comments

@fernando-s97
Copy link
Contributor

fernando-s97 commented Aug 27, 2020

With the following code

showMaterialScrollPicker(
      context: context,
      maxLongSide: 350,
      title: 'Pick a language'.tr(),
      selectedItem: getSupportedLanguage(
        nameOrLocale: Right(context.locale),
      ).name,
      items: kSupportedLanguages.map((e) => e.name).toList(),
      onChanged: (value) {
        context.locale = getSupportedLanguage(
          nameOrLocale: Left(value),
        ).locale;
      },
      // showDivider: false,
    )

I'm receiving the following exception:

═══════════════════════════════════════════════════════
The following assertion was thrown building LayoutBuilder:
Failed assertion: boolean expression must not be null

The relevant error-causing widget was:
MaterialApp file:..../lib/presentation/core/app_widget.dart:61:14
When the exception was thrown, this was the stack:
#0 _ScrollPickerState.build. (package:flutter_material_pickers/pickers/scroll_picker.dart:92:34)
#1 _LayoutBuilderElement._layout. (package:flutter/src/widgets/layout_builder.dart:121:33)
#2 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2620:19)
#3 _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:117:11)
#4 RenderObject.invokeLayoutCallback. (package:flutter/src/rendering/object.dart:1868:58)
...
═══════════════════════════════════════════════════════

I need to manually set showDivider to either true or false. The default true value isn't working

OBS: version 1.7.3

@fernando-s97
Copy link
Contributor Author

As per my debug, the ScrollPicker class constructor should be

ScrollPicker({
    Key key,
    @required this.items,
    @required this.initialValue,
    @required this.onChanged,
    **bool showDivider,**
  })  : assert(items != null),
        **showDivider = showDivider ?? true,**
        super(key: key);

instead of

ScrollPicker({
    Key key,
    @required this.items,
    @required this.initialValue,
    @required this.onChanged,
    this.showDivider: true,
  })  : assert(items != null),
        super(key: key);

@codegrue
Copy link
Owner

Fixed in 1.7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants