ResponsiveFramework icon indicating copy to clipboard operation
ResponsiveFramework copied to clipboard

Command "Inspect Widget" resets state when using ResponsiveWrapper

Open Eerey opened this issue 3 years ago • 1 comments

Whenever I enable/disable "Inspect Widget" the entire app state is reset. Here is how I use ResponsiveWrapper (see below). I appreciate any help :)



class MainApp extends StatelessWidget {
  const MainApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => MainBlocProvider(
        child: Builder(builder: (context) {
          final appRouter = CUSTOMER_VIEW ? customerRouter : router;
          return MaterialApp.router(
            debugShowCheckedModeBanner: false,
            // scrollBehavior: CupertinoScrollBehavior(),
            routeInformationParser: appRouter.routeInformationParser,
            routerDelegate: appRouter.routerDelegate,
            builder: (context, child) => MainResponsiveBuilder(
              child: child ?? NoMainChildErrorPage(),
            ),
          );
        }),
      );
}




class MainResponsiveBuilder extends StatelessWidget {
  const MainResponsiveBuilder({Key? key, required this.child})
      : super(key: key);
  final Widget child;

  @override
  Widget build(BuildContext context) => ResponsiveWrapper.builder(
        BouncingScrollWrapper.builder(context, child),
        minWidth: 1024,
        defaultScale: true,
        mediaQueryData: MediaQuery.of(context).copyWith(textScaleFactor: 1),
        alignment: Alignment.center,
        defaultScaleFactor: 1,
        defaultScaleLandscape: true,
        breakpoints: [
          const ResponsiveBreakpoint.resize(450, name: MOBILE),
          const ResponsiveBreakpoint.autoScale(1000, name: DESKTOP),
          const ResponsiveBreakpoint.autoScale(1200,
              scaleFactor: 0.7, name: DESKTOP),
          const ResponsiveBreakpoint.autoScale(2000,
              scaleFactor: 1.5, name: "4K"),
        ],
      );
}

Eerey avatar Apr 13 '22 12:04 Eerey

I think the problem is not in the responsive_framework library, but in the router. I have the same problem in the app with router, but without responsive_framework.

abigotado avatar Aug 05 '22 10:08 abigotado