1

i am creating a website on flutter. I have and issue that when refresh my current page like i am on 3rd page, it refreshes the whole website and firstly goes on login screen and then goes to the home screen. after refreshing it does not comes back to the 3rd screen.

i have used LayoutBuilder to navigate through screens of different sizes.

print("Height= $screenHeight");
    print("Width= $screenWidth");
    return GraphQLProvider(
      client: _grapghClass.client,
      child: ScreenUtilInit(builder: (context, widget) {
        return GetMaterialApp(
          title: 'All Wallet',
          debugShowCheckedModeBanner: false,
          key: appKey,
          scrollBehavior: AppScrollBehavior(),
          theme: ThemeData(
            fontFamily: 'AvenirLT',
            primarySwatch: AppColors.primaryColor,
            primaryColor: AppColors.primaryColor,
          ),
          home: const MyMainScreen(),
        );
      }),
    );

This code block from my Main.dart file and this is

Widget build(BuildContext context) {
    html.window.onLoadStart.listen((event) {
      print("home_screen");
      html.window.location.reload();
      Get.off(() => const BottomNavigatorScreen());
    });
    return Scaffold(
      body: LayoutBuilder(
          builder: (BuildContext context, BoxConstraints constraints) {
            if (constraints.maxWidth > 1200) {
              return const DesktopAuthTabsScreen();
            } else if (constraints.maxWidth > 600 && constraints.maxWidth < 1200) {
              return const DesktopAuthTabsScreen();
            } else {
              return const MobileAuthTabsScreen();
            }
          },
        ),
      );

from MyMainScreen.dart file

Aqeel Mughal
  • 2,105
  • 2
  • 6
  • 14

0 Answers0