Skip to content

ResponsiveVisibility error #169

@MarceloRab

Description

@MarceloRab

... pub.dev\responsive_framework-1.1.1\lib\responsive_value.dart

=> Throws error when screen exceeds size 600

  • my code
@override
  Widget build(BuildContext context) {
    return AppBar(
      title: const Text('HomeView'),
      centerTitle: true,
      leading: ResponsiveVisibility(
        visible: false,
        hiddenConditions: [Condition.largerThan(name: TABLET, value: 600)],
        child: IconButton(
          icon: const Icon(Icons.menu),
          onPressed: () {},
        ),
      ),
  • code classe ResponsiveVisibility

...

bool? visibleValue = visible;
...

@override
  Widget build(BuildContext context) {
    List<Condition> conditions = [];
    bool? visibleValue = visible;  //=>🚩 Here he received a boolean

...

In the bottom line it throws an error  //🔻
    visibleValue = ResponsiveValue(context,
            defaultValue: visibleValue, conditionalValues: conditions)
        .value;

= > Exception has occurred. _TypeError (type 'int' is not a subtype of type 'bool?')

  • Suggestion

=>>> No need to "?" in [visibleValue] and this parameter cannot receive an int.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions