title: Getting error "Incorrect use of ParentDataWidget." on flutter
body: <p>The following assertion was thrown while applying parent data.:
  Incorrect use of ParentDataWidget.
  The ParentDataWidget Flexible(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type ParentData.</p>
  <p>Usually, this means that the Flexible widget has the wrong ancestor RenderObjectWidget. Typically, Flexible widgets are placed directly inside Flex widgets.
  The offending Flexible is currently placed inside a RepaintBoundary widget.</p>
  <p><a href="https://i.stack.imgur.com/PZB2Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PZB2Z.png" alt="enter image description here" /></a></p>
  <p>My Code is</p>
  <pre><code>class Search extends StatelessWidget {
    //final homeProvider;
    final HomeProvider homeProvider;
  
    Search(this.homeProvider);
  
    @override
    Widget build(BuildContext context) {
    return Container(
      child: SmartRefresher(
       controller: homeProvider.getSearchRefreshControllerLook(),
       enablePullDown: true,
       enablePullUp: true,
       onRefresh: () {
        debugPrint('on pull to refresh ');
        
       
      //modistaboxApplicationProvider.getTrendingLooksWithLoginStatus();
        homeProvider.getAllLooks();
      },
      onLoading: () {
        debugPrint('next loading --------- ');
        homeProvider.getAllNextLooks();
  
      },
  
      child: ListView(
        controller: homeProvider.controllerLooksList,
        children: [
          Selector&lt;HomeProvider, NetWorkResponseStatus&gt;(
              builder: (context, data, child) {
                Widget lookWidget;
                switch (data) {
                  case NetWorkResponseStatus.ResponseError:
                    lookWidget = Column(
                      children: &lt;Widget&gt;[
                        SizedBox(
                          height: MediaQuery.of(context).size.height / 3,
                        ),
                        const ModistaboxErrorWidget(
                          error: 'No Internet',
                          visible: true,
                        )
                      ],
                    );
                    break;
                  case NetWorkResponseStatus.ResponseEmpty:
                    lookWidget = const EmptyWidget(
                      visible: true,
                    );
                    break;
                  case NetWorkResponseStatus.NetworkError:
                    lookWidget = const EmptyWidget(
                      visible: true,
                    );
                    break;
                  case NetWorkResponseStatus.ResponseData:
                    lookWidget = getLooksWidget(context, homeProvider);
                    break;
                  default:
                    lookWidget = Column(
                      children: &lt;Widget&gt;[
                        SizedBox(
                          height: MediaQuery.of(context).size.height / 3,
                        ),
                        Center(child: CustomProgressIndicator())
                      ],
                    );
                    break;
                }
                return Padding(
                  padding: const EdgeInsets.only(left: 5, right: 5),
                  child: lookWidget,
                );
              },
              selector: (buildContext, provider) =&gt; homeProvider.lookResponseStatus),
        ],
      ),
    ),
  );
  }
  
  
  
   Widget getLooksWidget(context, HomeProvider homeProvider) {
      return homeProvider.lookListResponce != null &amp;&amp;
      homeProvider.lookListResponce.results.length &gt; 0
      ? GridView.builder(
         shrinkWrap: true,
         itemCount: homeProvider.lookListResponce.results.length,
         scrollDirection: Axis.vertical,
         physics: const ScrollPhysics(),
         gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 3,
         crossAxisSpacing: 5,
        mainAxisSpacing: 5,
        childAspectRatio: 2 / 3,
    ),
    itemBuilder: (BuildContext context, int index) {
      return lookWidget(index, context,
          homeProvider.lookListResponce.results[index], homeProvider);
    },
  )
      : const EmptyWidget(
    visible: true,
    );
   }
  
   Widget lookWidget(int index, context, ResultsLook look,
    HomeProvider homeProvider) {
    return Stack(
     children: &lt;Widget&gt;[
      InkWell(
        onTap: () {
          debugPrint('look data --- $look');
  
          
      Navigator.pushNamed(context,TagrankRoutes.lookTagging,arguments: 
         look.image);
  
        },
        child: CachedNetworkImage(
            imageUrl: look.image,
            fit: BoxFit.fitHeight,
            height: (MediaQuery.of(context).size.height) - 80),
      ),
      Positioned(
        left: 5,
        bottom: 5,
        child: InkWell(
          onTap: () {
            //debugPrint(&quot;this is inkwell&quot;);
            if (TagRankPreferences().getLoginStatus()) {
              
            } else {
              
              Fluttertoast.showToast(msg: 'Please login to see user profile');
  
            }
          
          },
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: &lt;Widget&gt;[
              SizedBox(
                width: 5,
              ),
              Text(
                look.username ?? '',
                style: textStyle12White,
              ),
            ],
          ),
        ),
      ),
  
      Positioned(
        child: Container(
          height: 16,
          width: 16,
          child: Checkbox(
            checkColor: Colors.red  ,
            activeColor: Colors.white
            //checkColor: dividerColor,
            onChanged:(newValue){
              homeProvider.onClickCheckBox(look);
            },
            value: true,
          ),
        ),
        /*child: Row(
          mainAxisAlignment: MainAxisAlignment.end,
          crossAxisAlignment: CrossAxisAlignment.end,
          children: &lt;Widget&gt;[
            *//* InkWell(
                   child: Icon(
                     Icons.share,
                     color: white,
              ),
            ),*//*
  
          ],
        ),*/
        right: 5,
        bottom: 5,
      )
  
    ],
  );
  </code></pre>
  <p>}
  }</p>