Getting "XCEPTION CAUGHT BY RENDERING LIBRARY" while calling a custome widget

I have created a Widget CustomButtonWidget, When I try to call it inside a Row() I am getting the error.

  1. Find the log
Restarted application in 94ms.
══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
RenderCustomMultiChildLayoutBox object was given an infinite size during layout.
This probably means that it is a render object that tries to be as big as possible, but it was put
inside another render object that allows its children to pick their own size.
The nearest ancestor providing an unbounded width constraint is: RenderFlex#cd613 relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
  creator: Row ← Column ← _BodyBuilder ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ←
    CustomMultiChildLayout ← AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ←
    _InkFeatures-[GlobalKey#ad5f0 ink renderer] ← NotificationListener<LayoutChangedNotification> ←
    PhysicalModel ← ⋯
  parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
  constraints: BoxConstraints(0.0<=w<=342.0, 0.0<=h<=Infinity)
  size: MISSING
  direction: horizontal
  mainAxisAlignment: start
  mainAxisSize: max
  crossAxisAlignment: center
  textDirection: ltr
  verticalDirection: down
The nearest ancestor providing an unbounded height constraint is: RenderFlex#28dd1 relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
  creator: Column ← _BodyBuilder ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ←
    CustomMultiChildLayout ← AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ←
    _InkFeatures-[GlobalKey#ad5f0 ink renderer] ← NotificationListener<LayoutChangedNotification> ←
    PhysicalModel ← AnimatedPhysicalModel ← ⋯
  parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body (can use size)
  constraints: BoxConstraints(0.0<=w<=342.0, 0.0<=h<=753.0)
  size: MISSING
  direction: vertical
  mainAxisAlignment: start
  mainAxisSize: max
  crossAxisAlignment: center
  verticalDirection: down
The constraints that applied to the RenderCustomMultiChildLayoutBox were:
  BoxConstraints(unconstrained)
The exact size it was given was:
  Size(Infinity, Infinity)
See https://flutter.dev/docs/development/ui/layout/box-constraints for more information.

The relevant error-causing widget was:
  Scaffold file:///home/mahadev/AndroidStudioProjects/some_geeta/lib/widgets/custom_button.dart:12:12

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 214:49  throw_
packages/flutter/src/rendering/box.dart 1966:9                                <fn>
packages/flutter/src/rendering/box.dart 2033:14                               debugAssertDoesMeetConstraints
packages/flutter/src/rendering/box.dart 1752:7                                <fn>
packages/flutter/src/rendering/box.dart 1753:14                               set size
packages/flutter/src/rendering/custom_layout.dart 398:5                       performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/proxy_box.dart 1267:11                         performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/flex.dart 746:14                               performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/flex.dart 746:14                               performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/custom_layout.dart 171:10                      layoutChild
packages/flutter/src/material/scaffold.dart 480:7                             performLayout
packages/flutter/src/rendering/custom_layout.dart 240:7                       [_callPerformLayout]
packages/flutter/src/rendering/custom_layout.dart 399:14                      performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/proxy_box.dart 1267:11                         performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/proxy_box.dart 3219:13                         performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/widgets/overlay.dart 700:14                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/proxy_box.dart 113:13                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                             layout
packages/flutter/src/rendering/view.dart 167:48                               performLayout
packages/flutter/src/rendering/object.dart 1630:7                             [_layoutWithoutResize]
packages/flutter/src/rendering/object.dart 887:17                             flushLayout
packages/flutter/src/rendering/binding.dart 402:19                            drawFrame
packages/flutter/src/widgets/binding.dart 865:13                              drawFrame
packages/flutter/src/rendering/binding.dart 284:5                             [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1113:15                           [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1052:9                            handleDrawFrame
packages/flutter/src/scheduler/binding.dart 861:7                             <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:19       internalCallback

The following RenderObject was being processed when the exception was fired: RenderCustomMultiChildLayoutBox#8f582 relayoutBoundary=up5 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
  creator: CustomMultiChildLayout ← AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ←
    _InkFeatures-[GlobalKey#a9593 ink renderer] ← NotificationListener<LayoutChangedNotification> ←
    PhysicalModel ← AnimatedPhysicalModel ← Material ← PrimaryScrollController ← _ScaffoldScope ←
    Scaffold ← ⋯
  parentData: <none> (can use size)
  constraints: BoxConstraints(unconstrained)
  size: Size(Infinity, Infinity)
This RenderObject had the following descendants (showing up to depth 5):
    child 1: RenderPositionedBox#57f98 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
      child: RenderDecoratedBox#7e033 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
        child: RenderPadding#72cb9 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
          child: RenderSemanticsAnnotations#2d168 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
            child: RenderExcludeSemantics#0a54a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
    child 2: RenderStack#2ba55 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
      child 1: RenderTransform#58157 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
        child: RenderTransform#0c502 NEEDS-LAYOUT NEEDS-PAINT
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: _RenderInkFeatures object was given an infinite size during layout.
Another exception was thrown: RenderPhysicalModel object was given an infinite size during layout.
Another exception was thrown: RenderCustomMultiChildLayoutBox object was given an infinite size during layout.
Another exception was thrown: _RenderInkFeatures object was given an infinite size during layout.
Another exception was thrown: RenderPhysicalModel object was given an infinite size during layout.
Another exception was thrown: RenderFlex object was given an infinite size during layout.
Another exception was thrown: NoSuchMethodError: '<Unexpected Null Value>'
Another exception was thrown: A RenderFlex overflowed by Infinity pixels on the bottom.

Please find my Custom Widget code

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:somegeeta/core/const.dart';

class CustomeButtonWidget extends StatelessWidget {
  final Widget child;

  CustomeButtonWidget({@required this.child});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.mainColor,
      body: Center(
        child: Container(
          width: 50,
          height: 50,
          decoration: BoxDecoration(
              borderRadius: BorderRadius.all(Radius.circular(200)),
              border: Border.all(
                width: 2,
                color: AppColors.mainColor,
              ),
              boxShadow: [
                BoxShadow(
                  color: AppColors.lightBlueShadow,
                  blurRadius: 10,
                  offset: Offset(5,5),
                  spreadRadius: 3,
                ),
                BoxShadow(
                  color: Colors.white,
                  blurRadius: 4,
                  offset: Offset(-5,-5),
                  spreadRadius: 3,
                )
              ],
              gradient: RadialGradient(
                  colors: [
                    AppColors.mainColor,
                    AppColors.mainColor,
                    AppColors.mainColor,
                    Colors.white,
                  ]
              )

          ),
          child: Icon(Icons.favorite),
        ),
      ),
    );
  }
}

This is Where I am trying to call the custom Widget

class _ListPageState extends State<ListPage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.mainColor,
      appBar: AppBar(
        elevation: 0,
        backgroundColor: AppColors.mainColor,
        centerTitle: true,
        title: Text(
          "Test- Music",
          style: TextStyle(color: AppColors.styleColor),
        ),
      ),
      body: Column(
        children: <Widget>[
          Row(
            children: <Widget>[
              CustomeButtonWidget(
                child: Icon(Icons.favorite),
              ),
              CustomeButtonWidget(
                child: Icon(Icons.menu),
              )
            ],
          )
        ],
      ),
    );
  }
}

I am bit new to flutter, please support on this.

Got the solution, I was trying to call scaffold inside the scaffold

Hello and welcome!

[Sorry, I answered at the same time of you, didn’t see your solution]
I tried your custom widget in a test project, and with small modification I got Flutter to render it: I removed the custom widget Scaffold, like in the snippet below:

@override
  Widget build(BuildContext context) {
    return Container(
      width: 50,
      height: 50,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.all(Radius.circular(200)),
        border: Border.all(
          width: 2,
          color: Colors.red,
        ),
        boxShadow: [
          BoxShadow(
            color: Colors.black,
            blurRadius: 10,
            offset: Offset(5, 5),
            spreadRadius: 3,
          ),
          BoxShadow(
            color: Colors.white,
            blurRadius: 4,
            offset: Offset(-5, -5),
            spreadRadius: 3,
          )
        ],
        gradient: RadialGradient(
          colors: [
            Colors.blue,
            Colors.blue,
            Colors.blue,
            Colors.white,
          ],
        ),
      ),
      child: Icon(Icons.favorite),
    );
  }

I’m not sure if you really needed a nested scaffold here, but the Scaffold class doc page gives this advice:

Although there are some use cases, like a presentation app that shows embedded flutter content, where nested scaffolds are appropriate, it’s best to avoid nesting scaffolds.

Hth.