when i add CustomScrollView get exception

107 views Asked by At

I need to scroll on all screens, not just one listview, so I use CustomScrollView, but it gives me a renderbox exception. and code has two listviews first listview is horizontal, and second listview is vertical, and I need to scroll in the vertical direction, not just scroll the vertical listview but scroll the horizontal and vertical listview. this my code :

import 'package:flutter/material.dart';


void main() {
  runApp(const NewsApp());
}

class NewsApp extends StatelessWidget {
  const NewsApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: NewsHome(),
    );
  }
}


class NewsHome extends StatelessWidget {
  const NewsHome({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.white,
        elevation: 0,
        title: const Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              'News',
              style: TextStyle(fontSize: 20, color: Colors.black),
            ),
            Text(
              'Cloud',
              style: TextStyle(fontSize: 20, color: Color(0xFFFF9800)),
            ),
          ],
        ),
      ),
      body: const Column(
        children: [
          CustomScrollView(
            physics: BouncingScrollPhysics(),
            slivers: [
              SliverToBoxAdapter(
                child: HomeNewsListView(),
              )
            ],
          )
        ],
      ),
    );
  }
}


class HomeNewsListView extends StatelessWidget {
  const HomeNewsListView({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      shrinkWrap: true,
      physics: const NeverScrollableScrollPhysics(),
      itemCount: 10,
      itemBuilder: (context, index) => const HomeNews(),
    );
  }
}



class HomeNews extends StatelessWidget {
  const HomeNews({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Padding(
          padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
          child: ClipRRect(
            borderRadius: BorderRadius.circular(20),
            child: Image.asset('assets/tesla.jpg'),
          ),
        ),
        const Padding(
          padding: EdgeInsets.symmetric(horizontal: 20),
          child: Text(
            'George Santos says lawmakers bullying him as expulsion vote looms - The Washinton embeded system',
            style: TextStyle(fontSize: 20, overflow: TextOverflow.ellipsis),
            maxLines: 2,
          ),
        )
      ],
    );
  }
}

and this is exception

    Restarted application in 696ms.
I/flutter ( 6594): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 6594): The following assertion was thrown during performResize():
I/flutter ( 6594): Vertical viewport was given unbounded height.
I/flutter ( 6594): Viewports expand in the scrolling direction to fill their container. In this case, a vertical
I/flutter ( 6594): viewport was given an unlimited amount of vertical space in which to expand. This situation
I/flutter ( 6594): typically happens when a scrollable widget is nested inside another scrollable widget.
I/flutter ( 6594): If this widget is always nested in a scrollable widget there is no need to use a viewport because
I/flutter ( 6594): there will always be enough vertical space for the children. In this case, consider using a Column
I/flutter ( 6594): or Wrap instead. Otherwise, consider using a CustomScrollView to concatenate arbitrary slivers into
I/flutter ( 6594): a single scrollable.
I/flutter ( 6594):
I/flutter ( 6594): The relevant error-causing widget was:
I/flutter ( 6594):   CustomScrollView
I/flutter ( 6594):   CustomScrollView:file:///W:/Projects/flutter/news_app/lib/screens/home_page.dart:33:20
I/flutter ( 6594):
I/flutter ( 6594): When the exception was thrown, this was the stack:
I/flutter ( 6594): #0      debugCheckHasBoundedAxis.<anonymous closure> (package:flutter/src/rendering/debug.dart:337:13)
I/flutter ( 6594): #1      debugCheckHasBoundedAxis (package:flutter/src/rendering/debug.dart:396:4)
I/flutter ( 6594): #2      RenderViewport.computeDryLayout (package:flutter/src/rendering/viewport.dart:1373:12)
I/flutter ( 6594): #3      RenderBox.performResize (package:flutter/src/rendering/box.dart:2393:12)
I/flutter ( 6594): #4      RenderObject.layout (package:flutter/src/rendering/object.dart:2472:9)
I/flutter ( 6594): #5      RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #6      RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #7      RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #8      RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #9      RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #10     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #11     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #12     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #13     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #14     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #15     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #16     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #17     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #18     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #19     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #20     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #21     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #22     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #23     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #24     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #25     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #26     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #27     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #28     RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:554:11)
I/flutter ( 6594): #29     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #30     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #31     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #32     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #33     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #34     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:238:12)
I/flutter ( 6594): #35     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #36     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #37     ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:52:11)
I/flutter ( 6594): #38     RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:808:43)
I/flutter ( 6594): #39     RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:903:32)
I/flutter ( 6594): #40     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #41     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #42     MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:173:12)
I/flutter ( 6594): #43     _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1056:7)
I/flutter ( 6594): #44     MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:237:7)
I/flutter ( 6594): #45     RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:405:14)
I/flutter ( 6594): #46     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #47     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #48     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #49     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #50     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #51     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #52     _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1431:11)
I/flutter ( 6594): #53     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #54     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #55     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #56     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #57     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #58     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #59     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #60     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #61     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #62     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #63     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #64     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #65     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #66     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #67     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #68     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #69     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #70     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #71     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #72     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #73     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #74     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #75     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #76     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #77     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #78     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #79     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #80     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #81     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #82     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #83     RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3732:13)
I/flutter ( 6594): #84     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #85     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #86     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #87     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #88     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #89     _RenderTheaterMixin.performLayout (package:flutter/src/widgets/overlay.dart:838:15)
I/flutter ( 6594): #90     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #91     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #92     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #93     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #94     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #95     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #96     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #97     RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #98     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #99     RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #100    RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #101    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #102    RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #103    RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #104    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #105    RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #106    RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #107    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #108    RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #109    RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #110    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #111    RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #112    RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #113    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #114    RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #115    RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #116    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:21)
I/flutter ( 6594): #117    RenderObject.layout (package:flutter/src/rendering/object.dart:2493:7)
I/flutter ( 6594): #118    RenderBox.layout (package:flutter/src/rendering/box.dart:2382:11)
I/flutter ( 6594): #119    RenderView.performLayout (package:flutter/src/rendering/view.dart:178:14)
I/flutter ( 6594): #120    RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2332:7)
I/flutter ( 6594): #121    PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1013:18)
I/flutter ( 6594): #122    RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:494:19)
I/flutter ( 6594): #123    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:918:13)
I/flutter ( 6594): #124    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:360:5)
I/flutter ( 6594): #125    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1297:15)
I/flutter ( 6594): #126    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9)
I/flutter ( 6594): #127    SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:952:7)
I/flutter ( 6594): #131    _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
I/flutter ( 6594): (elided 3 frames from class _Timer and dart:async-patch)
I/flutter ( 6594):
I/flutter ( 6594): The following RenderObject was being processed when the exception was fired: RenderViewport#af43a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
I/flutter ( 6594):   needs compositing
I/flutter ( 6594):   creator: Viewport ← IgnorePointer-[GlobalKey#2b652] ← Semantics ← Listener ← _GestureSemantics ←
I/flutter ( 6594):     RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#660b1] ← Listener ← _ScrollableScope
I/flutter ( 6594):     ← _ScrollSemantics-[GlobalKey#2784f] ← NotificationListener<ScrollMetricsNotification> ←
I/flutter ( 6594):     RepaintBoundary ← CustomPaint ← ⋯
D/EGL_emulation( 6594): app_time_stats: avg=5455.27ms min=5455.27ms max=5455.27ms count=1
I/flutter ( 6594):   parentData: <none> (can use size)
I/flutter ( 6594):   constraints: BoxConstraints(0.0<=w<=379.4, 0.0<=h<=Infinity)
I/flutter ( 6594):   size: MISSING
I/flutter ( 6594):   axisDirection: down
I/flutter ( 6594):   crossAxisDirection: right
I/flutter ( 6594):   offset: ScrollPositionWithSingleContext#81fd5(offset: 0.0, range: null..null, viewport: null,
I/flutter ( 6594):     ScrollableState, BouncingScrollPhysics -> ClampingScrollPhysics -> RangeMaintainingScrollPhysics,
I/flutter ( 6594):     IdleScrollActivity#3d6ed, ScrollDirection.idle)
I/flutter ( 6594):   anchor: 0.0
I/flutter ( 6594): This RenderObject had the following descendants (showing up to depth 5):
I/flutter ( 6594):     center child: RenderSliverToBoxAdapter#e44d2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594):       child: RenderRepaintBoundary#8fecd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594):         child: RenderCustomPaint#45fbb NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594):           child: RenderRepaintBoundary#b66f5 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594):             child: _RenderScrollSemantics#df0c0 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderViewport#af43a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderViewport#af43a NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#7146e relayoutBoundary=up11 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#43cf5 relayoutBoundary=up10 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#5c6eb relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#d9df0 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#cf2c4 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#c6d0f relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#1e836 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#d6573 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#62e47 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderPadding#65525 relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderFlex#e4f7e relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 6594): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#62e47 relayoutBoundary=up3 NEEDS-PAINT

and I try to make

shrinkWrap: true, physics: const NeverScrollableScrollPhysics()

but still not worked.

and tried to add an expand widget over CustomScrollView, but it still has not worked.

2

There are 2 answers

0
shun On

How about wrapping CustomScrollView with SafeArea?

body: const SafeArea(
    child: CustomScrollView(
      physics: BouncingScrollPhysics(),
      slivers: [
        SliverToBoxAdapter(
          child: HomeNewsListView(),
        )
      ],
    ),
  ),
0
Lingeshwaran78 On

after adding shrinkwrap : true in customscrollview and wrapping the singlechildscrollview for overflow issue . I didn't get any issue

const SingleChildScrollView(
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        CustomScrollView(
          physics: BouncingScrollPhysics(),
          shrinkWrap: true,
          slivers: [
            SliverToBoxAdapter(
              child: HomeNewsListView(),
            )
          ],
        ),
        // HomeNewsListView(),
      ],
    ),
  ),