abuanwar072/Flutter-Responsive-Admin-Panel-or-Dashboard

Work fine, but crash with navigation of widgets in MainScreen

Closed this issue · 0 comments

Describe the bug
The bug occurs when trying to change the body widget or even when trying to navigate to a new screen.

It happens that when changing the Dashboard body widget for another body widget, for example Transactions, the site breaks and does not render correctly the Sidebar and Header area.

Here is a short video example of the problem:

To Reproduce
Steps to reproduce the behavior:

  1. Change widget of body Dashboard for any other with StreamBuilder or Navigator

Code of MainScreen

class MainScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: context.read<MenuController>().scaffoldKey,
      drawer: SideMenu(),
      body: SafeArea(
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            if (Responsive.isDesktop(context))
              Expanded(
                child: SideMenu(),
              ),
            Expanded(
              flex: 5,
              child: StreamBuilder<Widget>(
                stream: outGetWidget,
                builder: (context, w) {
                  if(w.connectionState == ConnectionState.waiting || w.data == null) return const Center(child: CircularProgressIndicator(),);
                  return w.data!;
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}

All other codes are original for the scripts, the bug is only i change the widget of body.

I tested several alternatives to try to fix this problem, but nothing went right.
How do I navigate multiple screens responsively?
Apparently it's only usable for a single screen.

Video for show the bug
https://youtu.be/y9DCPI628dc