Skip to content

nonexistent breakpoint on migration from 0.2.0 -> 1.1.1 #156

@SirBarksALot

Description

@SirBarksALot

Error:

A conditional value was caught referencing a nonexistent breakpoint.

ResponsiveValue requires a parent ResponsiveBreakpoint to reference breakpoints. Add a ResponsiveBreakpoint or remove breakpoint references.

I'm trying to migrate to 1.1.1, I just want to scale from 0 to 450 and resize when above 450, it worked perfectly on 0.2.0, but I cannot get it to work on 1.1.1 despite following the migration guide.

0.2.0 code:

Widget responsiveness(BuildContext context, Widget child) {
  return ResponsiveWrapper.builder(
    child,
    defaultScale: true,
    minWidth: 450,
    breakpoints: [
      const ResponsiveBreakpoint.resize(450, name: MOBILE),
    ],
  );
}

1.1.1 code:

Widget responsiveness(BuildContext context, Widget child) {
  return ResponsiveBreakpoints.builder(
    useShortestSide: true,
    breakpoints: [
      const Breakpoint(
        start: 0,
        end: 450,
        name: MOBILE,
      ),
      const Breakpoint(
        start: 450.1,
        end: double.infinity,
        name: 'rest',
      ),
    ],
    child: ResponsiveScaledBox(
      width: ResponsiveValue<double>(
        context,
        conditionalValues: [
          Condition.equals(name: MOBILE, value: 450),
        ],
      ).value,
      child: child,
    ),
  );
}

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