Home IOS Development android – Vertical viewport was given unbounded peak. when Utilizing flutter_riverpod Supplier for Drawer

android – Vertical viewport was given unbounded peak. when Utilizing flutter_riverpod Supplier for Drawer

0
android – Vertical viewport was given unbounded peak. when Utilizing flutter_riverpod Supplier for Drawer

[ad_1]

After I use flutter_riverpod Supplier for the Drawer, it really works on the Similar Display, however when I attempt to Push the display, I get an error:

Vertical viewport was given unbounded peak.

The next assertion was thrown throughout performLayout():
RenderBox was not laid out: RenderViewport#2eecb NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
‘bundle:flutter/src/rendering/field.dart’:
Failed assertion: line 1966 pos 12: ‘hasSize’.

My code Under:

 class FirstScreen extends ConsumerStatefulWidget {
  const FirstScreen({tremendous.key});

  @override
  ConsumerState<FirstScreen> createState() {
    // TODO: implement createState
    return _FirstScreenState();
  }
}

class _FirstScreenState extends ConsumerState<FirstScreen> {
  int currentIndex = 0;
  String currentDrawer = "Dwelling";

  void selectedTab(int nowIndex) {
    setState(() {
      currentIndex = nowIndex;
    });
  }

  @override
  Widget construct(context) {
    String drawerProviders = ref.watch(drawerProvider);
    Widget content material = const AlphabetScreen(language: "Bangle");
    String appTittle = "Bangle";

    if (drawerProviders == "Dwelling") {
      if (currentIndex == 0) {
        content material = const AlphabetScreen(language: "Bangle");
        appTittle = "Bangle";
      }

      if (currentIndex == 1) {
        content material = const AlphabetScreen(language: "english");
        appTittle = "English/ইংরেজি";
      }
    }

    if (drawerProviders == "Query") {
      if (currentIndex == 0) {
        content material = const QuizHomeScreen(language: "Bangle");
        appTittle = "Bangle Query";
      }

      if (currentIndex == 1) {
        content material = const QuizHomeScreen(language: "english");
        appTittle = "English/ইংরেজি Query";
      }
    }

    if (drawerProviders == "Recreation") {
      Future.delayed(Period.zero, () async {
        Navigator.of(context).push(
          MaterialPageRoute(
            builder: (context) => const GameScreen(),
          ),
        );
      });
    }

    // TODO: implement construct
    return Scaffold(
      appBar: AppBar(
        title: Textual content(appTittle),
      ),
      bottomNavigationBar: BottomNavigationBar(
        onTap: (index) => selectedTab(index),
        currentIndex: currentIndex,
        gadgets: [
          BottomNavigationBarItem(
            icon: Image.asset(
              "assets/icons/bangla_alp_icon.png",
              width: 15,
              height: 15,
            ),
            label: "বাংলা",
          ),
          BottomNavigationBarItem(
            icon: Image.asset(
              "assets/icons/a.png",
              width: 15,
              height: 15,
            ),
            label: "English/ইংরেজি",
          ),
        ],
      ),
      physique: content material,
      drawer: const MainDrawer(),
    );
  }
}

Drawback confronted when executing (drawerProviders == “Recreation”) operate. Under is my Drawer supplier:

class DrawerStateNotifier extends StateNotifier<String> {
  DrawerStateNotifier() : tremendous("Dwelling");

  void selectDrawer(String drawer, BuildContext context) {
    state = drawer;
    Navigator.of(context).pop();
  }
}

last drawerProvider = StateNotifierProvider<DrawerStateNotifier, String>(
    (ref) => DrawerStateNotifier());

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here