简体   繁体   中英

Try to create Nested Listview in flutter

i have tried to make nested ListView , the parent list view scrolls in vertical direction and the child list scrolls horizontally but this error are thrown :

[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: 'package:flutter/src/rendering/mouse_tracking.dart': Failed assertion: line 301 pos 12: '!_debugDuringDeviceUpdate': is not true.

i also tried to use column with one ListView and other widgets vertically and the same error are thrown

I could solve that by using CustomScrollView Widget and its delegate SliverChildListDelegate(), this part of my code solution

CustomScrollView(
      slivers: [
        SliverList(
          delegate: SliverChildListDelegate([
            Center(
              child: Column(
                children: [
                  Stack(
                    children: [
                      SingleChildScrollView(
                        scrollDirection: Axis.horizontal,
                        child: Row(
                          children: [
                            // height: MediaQuery.of(context).size.width,
                            Column(
                              children: [
                                InkWell(
                                  onTap: () {},
                                  onHover: (value) {
                                    if (value) {
                                      setState(() {
                                        assetImage =
                                            "assets/DentalChart/1.png";
                                        showHoverImage = true;
                                        hoverText = "Frontal Tooth";
                                        hoverWidth = 100;
                                        hoverHeight = 130;
                                        hoverOffset = Offset(100, 50);
                                      });
                                    } else {
                                      setState(() {
                                        showHoverImage = false;
                                      });
                                    }
                                  },
                                  child: Container(
                                    child: Image.asset(
                                      "assets/Images/1.png",
                                      height: 80,
                                      width: 60,
                                    ),
                                  ),
                                ),
                                SizedBox(
                                  height: 10,
                                ),
                                InkWell(
                                  onTap: () {},
                                  onHover: (value) {
                                    if (value) {
                                      setState(() {
                                        assetImage =
                                            "assets/images/1base.png";
                                        showHoverImage = true;
                                        hoverText = "Tooth Base";
                                        hoverWidth = 80;
                                        hoverHeight = 80;
                                        hoverOffset = Offset(100, 50);
                                      });
                                    } else {
                                      setState(() {
                                        showHoverImage = false;
                                      });
                                    }
                                  },
                                  child: Container(
                                    child: Image.asset(
                                      "assets/images/1base.png",
                                      height: 40,
                                      width: 60,
                                    ),
                                  ),
                                ),
                                SizedBox(
                                  height: 10,
                                ),
                            
                                ),
                              ],
                            ),

                    ],
                  ),
                  Padding(
                    padding: const EdgeInsets.only(top: 41.0),
                    child: Text("dsjnkjdvsnkldvsnlkdsn"),
                  )
                ],
              ),
            ),
          ]),
        )
      ],
    ),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM